Compare commits
79
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
67fd444281 | ||
|
|
5ccb29d877 | ||
|
|
c3e033939c | ||
|
|
206e984b94 | ||
|
|
2c3dd9e7e2 | ||
|
|
76bbdfadd7 | ||
|
|
1aafadcfb9 | ||
|
|
b80efd6bc5 | ||
|
|
5cddb27885 | ||
|
|
47c4a7af1d | ||
|
|
af57b64994 | ||
|
|
4818a5a153 | ||
|
|
8bcd2560e2 | ||
|
|
13ae5bb136 | ||
|
|
0c4d7b878c | ||
|
|
13a464fa11 | ||
|
|
b4fe97ecda | ||
|
|
434aeabbb4 | ||
|
|
98c991d13f | ||
|
|
397a35f988 | ||
|
|
48a0f006ff | ||
|
|
978fd06d1f | ||
|
|
050e616f66 | ||
|
|
f6795b163d | ||
|
|
2e6ca74422 | ||
|
|
aa5ddbf8fe | ||
|
|
c0abeaa470 | ||
|
|
197204a31c | ||
|
|
c96b4b55f3 | ||
|
|
b55428b188 | ||
|
|
e084fcae44 | ||
|
|
789730b666 | ||
|
|
c4e98b741b | ||
|
|
cfcafa57ec | ||
|
|
9aa1c6cb27 | ||
|
|
c318b92fd6 | ||
|
|
a93d5412cb | ||
|
|
72394d1a3e | ||
|
|
fe396d3941 | ||
|
|
853c012a3c | ||
|
|
fd6f59db22 | ||
|
|
c6e66a7681 | ||
|
|
81cda82fb0 | ||
|
|
7e39d25e3f | ||
|
|
d5d67707d2 | ||
|
|
bc8ee42330 | ||
|
|
467a981225 | ||
|
|
9f1915a970 | ||
|
|
10b840936c | ||
|
|
b152b04c28 | ||
|
|
a624f1f4bc | ||
|
|
5df6377e9d | ||
|
|
dd40245e5b | ||
|
|
1f0a39a525 | ||
|
|
b2241a4754 | ||
|
|
0d94a5d71e | ||
|
|
e147df2e90 | ||
|
|
889226ae9a | ||
|
|
00d9c42868 | ||
|
|
2f06e9da25 | ||
|
|
49a521fa06 | ||
|
|
592a7a7a45 | ||
|
|
aba6f4ba7b | ||
|
|
5517d5f7b5 | ||
|
|
b88a682917 | ||
|
|
c474c82340 | ||
|
|
799afeb796 | ||
|
|
386e4eaaed | ||
|
|
61fb4e42ab | ||
|
|
09086ccd46 | ||
|
|
746f28a2d3 | ||
|
|
6dd8ff72eb | ||
|
|
9a40041e25 | ||
|
|
b318cecd93 | ||
|
|
4a7ca55b40 | ||
|
|
d08a9d79f1 | ||
|
|
7d9c63da1b | ||
|
|
5a1dd6b34d | ||
|
|
f4b85ae24e |
@@ -1 +1,2 @@
|
|||||||
* @actions/actions-service
|
* @actions/actions-service
|
||||||
|
* @actions/runner-images-team
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
name: Basic validation
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
paths-ignore:
|
||||||
|
- '**.md'
|
||||||
|
pull_request:
|
||||||
|
paths-ignore:
|
||||||
|
- '**.md'
|
||||||
|
jobs:
|
||||||
|
call-basic-validation:
|
||||||
|
name: Basic validation
|
||||||
|
uses: actions/reusable-workflows/.github/workflows/basic-validation.yml@main
|
||||||
@@ -1,8 +1,3 @@
|
|||||||
# `dist/index.js` is a special file in Actions.
|
|
||||||
# When you reference an action with `uses:` in a workflow,
|
|
||||||
# `index.js` is the code that will run.
|
|
||||||
# For our project, we generate this file through a build process from other source files.
|
|
||||||
# We need to make sure the checked-in `index.js` actually matches what we expect it to be.
|
|
||||||
name: Check dist/
|
name: Check dist/
|
||||||
|
|
||||||
on:
|
on:
|
||||||
@@ -17,36 +12,6 @@ on:
|
|||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
check-dist:
|
call-check-dist:
|
||||||
runs-on: ubuntu-latest
|
name: Check dist/
|
||||||
|
uses: actions/reusable-workflows/.github/workflows/check-dist.yml@main
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
|
|
||||||
- name: Set Node.js 16.x
|
|
||||||
uses: actions/setup-node@v3
|
|
||||||
with:
|
|
||||||
node-version: 16.x
|
|
||||||
cache: npm
|
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
run: npm ci
|
|
||||||
|
|
||||||
- name: Rebuild the dist/ directory
|
|
||||||
run: npm run build
|
|
||||||
|
|
||||||
- name: Compare the expected and actual dist/ directories
|
|
||||||
run: |
|
|
||||||
if [ "$(git diff --ignore-space-at-eol dist/ | wc -l)" -gt "0" ]; then
|
|
||||||
echo "Detected uncommitted changes after build. See status below:"
|
|
||||||
git diff
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
id: diff
|
|
||||||
|
|
||||||
# If index.js was different than expected, upload the expected version as an artifact
|
|
||||||
- uses: actions/upload-artifact@v2
|
|
||||||
if: ${{ failure() && steps.diff.conclusion == 'failure' }}
|
|
||||||
with:
|
|
||||||
name: dist
|
|
||||||
path: dist/
|
|
||||||
@@ -1,47 +1,13 @@
|
|||||||
name: "Code scanning - action"
|
name: CodeQL analysis
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ 'main' ]
|
branches: [ 'main' ]
|
||||||
pull_request:
|
pull_request:
|
||||||
schedule:
|
schedule:
|
||||||
- cron: '25 3 * * 5'
|
- cron: '0 3 * * 0'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
CodeQL-Build:
|
call-codeQL-analysis:
|
||||||
|
name: CodeQL analysis
|
||||||
strategy:
|
uses: actions/reusable-workflows/.github/workflows/codeql-analysis.yml@main
|
||||||
fail-fast: false
|
|
||||||
|
|
||||||
# CodeQL runs on ubuntu-latest and windows-latest
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
|
|
||||||
# Initializes the CodeQL tools for scanning.
|
|
||||||
- name: Initialize CodeQL
|
|
||||||
uses: github/codeql-action/init@v1
|
|
||||||
# Override language selection by uncommenting this and choosing your languages
|
|
||||||
# with:
|
|
||||||
# languages: go, javascript, csharp, python, cpp, java
|
|
||||||
|
|
||||||
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
|
||||||
# If this step fails, then you should remove it and run the build manually (see below)
|
|
||||||
- name: Autobuild
|
|
||||||
uses: github/codeql-action/autobuild@v1
|
|
||||||
|
|
||||||
# ℹ️ Command-line programs to run using the OS shell.
|
|
||||||
# 📚 https://git.io/JvXDl
|
|
||||||
|
|
||||||
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
|
|
||||||
# and modify them (or add more) to build your code if your project
|
|
||||||
# uses a compiled language
|
|
||||||
|
|
||||||
#- run: |
|
|
||||||
# make bootstrap
|
|
||||||
# make release
|
|
||||||
|
|
||||||
- name: Perform CodeQL Analysis
|
|
||||||
uses: github/codeql-action/analyze@v1
|
|
||||||
@@ -72,15 +72,15 @@ jobs:
|
|||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- name: Install poetry
|
- name: Install poetry
|
||||||
run: pipx install poetry
|
run: pipx install poetry
|
||||||
|
- name: Init pyproject.toml
|
||||||
|
run: mv ./__tests__/data/pyproject.toml .
|
||||||
- name: Setup Python
|
- name: Setup Python
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
python-version: ${{ matrix.python-version }}
|
python-version: ${{ matrix.python-version }}
|
||||||
cache: 'poetry'
|
cache: 'poetry'
|
||||||
- name: Init pyproject.toml
|
|
||||||
run: poetry init -n
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: poetry add flake8
|
run: poetry install
|
||||||
|
|
||||||
python-pip-dependencies-caching-path:
|
python-pip-dependencies-caching-path:
|
||||||
name: Test pip (Python ${{ matrix.python-version}}, ${{ matrix.os }})
|
name: Test pip (Python ${{ matrix.python-version}}, ${{ matrix.os }})
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
name: Main workflow
|
name: e2e tests
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
@@ -8,31 +9,17 @@ on:
|
|||||||
pull_request:
|
pull_request:
|
||||||
paths-ignore:
|
paths-ignore:
|
||||||
- '**.md'
|
- '**.md'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
run:
|
test-setup-python:
|
||||||
name: Run
|
name: Test setup-python
|
||||||
runs-on: ${{ matrix.operating-system }}
|
runs-on: ${{ matrix.operating-system }}
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
operating-system: [ubuntu-latest, windows-latest]
|
operating-system: [ubuntu-20.04, windows-latest]
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Set Node.js 16.x
|
|
||||||
uses: actions/setup-node@v3
|
|
||||||
with:
|
|
||||||
node-version: 16.x
|
|
||||||
cache: npm
|
|
||||||
|
|
||||||
- name: npm ci
|
|
||||||
run: npm ci
|
|
||||||
|
|
||||||
- name: Lint
|
|
||||||
run: npm run format-check
|
|
||||||
|
|
||||||
- name: npm test
|
|
||||||
run: npm test
|
|
||||||
|
|
||||||
- name: Run with setup-python 2.7
|
- name: Run with setup-python 2.7
|
||||||
uses: ./
|
uses: ./
|
||||||
@@ -68,7 +55,7 @@ jobs:
|
|||||||
python-version: 3.8
|
python-version: 3.8
|
||||||
- name: Verify 3.8
|
- name: Verify 3.8
|
||||||
run: python __tests__/verify-python.py 3.8
|
run: python __tests__/verify-python.py 3.8
|
||||||
|
|
||||||
- name: Run with setup-python 3.7.5
|
- name: Run with setup-python 3.7.5
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
@@ -98,4 +85,4 @@ jobs:
|
|||||||
- name: Verify 3.10
|
- name: Verify 3.10
|
||||||
run: python __tests__/verify-python.py 3.10
|
run: python __tests__/verify-python.py 3.10
|
||||||
- name: Run python-path sample 3.10
|
- name: Run python-path sample 3.10
|
||||||
run: pipx run --python '${{ steps.cp310.outputs.python-path }}' nox --version
|
run: pipx run --python '${{ steps.cp310.outputs.python-path }}' nox --version
|
||||||
@@ -9,21 +9,6 @@ on:
|
|||||||
- main
|
- main
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
call-licensed:
|
||||||
runs-on: ubuntu-latest
|
name: Licensed
|
||||||
name: Check licenses
|
uses: actions/reusable-workflows/.github/workflows/licensed.yml@main
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
- name: Set Node.js 16.x
|
|
||||||
uses: actions/setup-node@v3
|
|
||||||
with:
|
|
||||||
node-version: 16.x
|
|
||||||
cache: npm
|
|
||||||
- run: npm ci
|
|
||||||
- name: Install licensed
|
|
||||||
run: |
|
|
||||||
cd $RUNNER_TEMP
|
|
||||||
curl -Lfs -o licensed.tar.gz https://github.com/github/licensed/releases/download/3.4.4/licensed-3.4.4-linux-x64.tar.gz
|
|
||||||
sudo tar -xzf licensed.tar.gz
|
|
||||||
sudo mv licensed /usr/local/bin/licensed
|
|
||||||
- run: licensed status
|
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
name: Release new action version
|
name: Release new action version
|
||||||
|
|
||||||
on:
|
on:
|
||||||
release:
|
release:
|
||||||
types: [released]
|
types: [released]
|
||||||
@@ -21,7 +22,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Update the ${{ env.TAG_NAME }} tag
|
- name: Update the ${{ env.TAG_NAME }} tag
|
||||||
uses: actions/publish-action@v0.1.0
|
uses: actions/publish-action@v0.2.1
|
||||||
with:
|
with:
|
||||||
source-tag: ${{ env.TAG_NAME }}
|
source-tag: ${{ env.TAG_NAME }}
|
||||||
slack-webhook: ${{ secrets.SLACK_WEBHOOK }}
|
slack-webhook: ${{ secrets.SLACK_WEBHOOK }}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
name: Validate PyPy e2e
|
name: Validate PyPy e2e
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
@@ -34,7 +35,7 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: setup-python ${{ matrix.pypy }}
|
- name: setup-python ${{ matrix.pypy }}
|
||||||
id: setup-python
|
id: setup-python
|
||||||
@@ -91,3 +92,78 @@ jobs:
|
|||||||
|
|
||||||
- name: Run simple code
|
- name: Run simple code
|
||||||
run: ${{ steps.setup-python.outputs.python-path }} -c 'import math; print(math.factorial(5))'
|
run: ${{ steps.setup-python.outputs.python-path }} -c 'import math; print(math.factorial(5))'
|
||||||
|
|
||||||
|
check-latest:
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- name: Setup PyPy and check latest
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
python-version: 'pypy-3.7-v7.3.x'
|
||||||
|
check-latest: true
|
||||||
|
- name: PyPy and Python version
|
||||||
|
run: python --version
|
||||||
|
|
||||||
|
- name: Run simple code
|
||||||
|
run: python -c 'import math; print(math.factorial(5))'
|
||||||
|
|
||||||
|
- name: Assert PyPy is running
|
||||||
|
run: |
|
||||||
|
import platform
|
||||||
|
assert platform.python_implementation().lower() == "pypy"
|
||||||
|
shell: python
|
||||||
|
|
||||||
|
- name: Assert expected binaries (or symlinks) are present
|
||||||
|
run: |
|
||||||
|
EXECUTABLE="pypy-3.7-v7.3.x"
|
||||||
|
EXECUTABLE=${EXECUTABLE/-/} # remove the first '-' in "pypy-X.Y" -> "pypyX.Y" to match executable name
|
||||||
|
EXECUTABLE=${EXECUTABLE%%-*} # remove any -* suffixe
|
||||||
|
${EXECUTABLE} --version
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
setup-pypy-multiple-versions:
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- name: Setup PyPy and check latest
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
python-version: |
|
||||||
|
pypy-3.7-v7.3.x
|
||||||
|
pypy3.8
|
||||||
|
check-latest: true
|
||||||
|
- name: PyPy and Python version
|
||||||
|
run: python --version
|
||||||
|
|
||||||
|
- name: Run simple code
|
||||||
|
run: python -c 'import math; print(math.factorial(5))'
|
||||||
|
|
||||||
|
- name: Assert PyPy is running
|
||||||
|
run: |
|
||||||
|
import platform
|
||||||
|
assert platform.python_implementation().lower() == "pypy"
|
||||||
|
shell: python
|
||||||
|
|
||||||
|
- name: Assert expected binaries (or symlinks) are present
|
||||||
|
run: |
|
||||||
|
EXECUTABLE="pypy-3.7-v7.3.x"
|
||||||
|
EXECUTABLE=${EXECUTABLE/-/} # remove the first '-' in "pypy-X.Y" -> "pypyX.Y" to match executable name
|
||||||
|
EXECUTABLE=${EXECUTABLE%%-*} # remove any -* suffixe
|
||||||
|
${EXECUTABLE} --version
|
||||||
|
shell: bash
|
||||||
|
- name: Assert expected binaries (or symlinks) are present
|
||||||
|
run: |
|
||||||
|
EXECUTABLE='pypy3.8'
|
||||||
|
EXECUTABLE=${EXECUTABLE/pypy-/pypy} # remove the first '-' in "pypy-X.Y" -> "pypyX.Y" to match executable name
|
||||||
|
EXECUTABLE=${EXECUTABLE%%-*} # remove any -* suffixe
|
||||||
|
${EXECUTABLE} --version
|
||||||
|
shell: bash
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
name: Validate Python e2e
|
name: Validate Python e2e
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
@@ -172,3 +173,54 @@ jobs:
|
|||||||
|
|
||||||
- name: Run simple code
|
- name: Run simple code
|
||||||
run: ${{ steps.setup-python.outputs.python-path }} -c 'import math; print(math.factorial(5))'
|
run: ${{ steps.setup-python.outputs.python-path }} -c 'import math; print(math.factorial(5))'
|
||||||
|
|
||||||
|
check-latest:
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||||
|
python-version: ["3.8", "3.9", "3.10"]
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- name: Setup Python and check latest
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
python-version: ${{ matrix.python-version }}
|
||||||
|
check-latest: true
|
||||||
|
- name: Validate version
|
||||||
|
run: |
|
||||||
|
$pythonVersion = (python --version)
|
||||||
|
if ("$pythonVersion" -NotMatch "${{ matrix.python-version }}"){
|
||||||
|
Write-Host "The current version is $pythonVersion; expected version is ${{ matrix.python-version }}"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
$pythonVersion
|
||||||
|
shell: pwsh
|
||||||
|
|
||||||
|
setup-python-multiple-python-versions:
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- name: Setup Python and check latest
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
python-version: |
|
||||||
|
3.7
|
||||||
|
3.8
|
||||||
|
3.9
|
||||||
|
3.10
|
||||||
|
check-latest: true
|
||||||
|
- name: Validate version
|
||||||
|
run: |
|
||||||
|
$pythonVersion = (python --version)
|
||||||
|
if ("$pythonVersion" -NotMatch "3.10"){
|
||||||
|
Write-Host "The current version is $pythonVersion; expected version is 3.10"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
$pythonVersion
|
||||||
|
shell: pwsh
|
||||||
Generated
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
name: "@actions/cache"
|
name: "@actions/cache"
|
||||||
version: 3.0.0
|
version: 3.0.4
|
||||||
type: npm
|
type: npm
|
||||||
summary: Actions cache lib
|
summary: Actions cache lib
|
||||||
homepage: https://github.com/actions/toolkit/tree/main/packages/cache
|
homepage: https://github.com/actions/toolkit/tree/main/packages/cache
|
||||||
|
|||||||
Generated
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
name: "@actions/core"
|
name: "@actions/core"
|
||||||
version: 1.7.0
|
version: 1.10.0
|
||||||
type: npm
|
type: npm
|
||||||
summary: Actions core lib
|
summary: Actions core lib
|
||||||
homepage: https://github.com/actions/toolkit/tree/main/packages/core
|
homepage: https://github.com/actions/toolkit/tree/main/packages/core
|
||||||
|
|||||||
-32
@@ -1,32 +0,0 @@
|
|||||||
---
|
|
||||||
name: "@actions/http-client"
|
|
||||||
version: 1.0.11
|
|
||||||
type: npm
|
|
||||||
summary: Actions Http Client
|
|
||||||
homepage: https://github.com/actions/http-client#readme
|
|
||||||
license: mit
|
|
||||||
licenses:
|
|
||||||
- sources: LICENSE
|
|
||||||
text: |
|
|
||||||
Actions Http Client for Node.js
|
|
||||||
|
|
||||||
Copyright (c) GitHub, Inc.
|
|
||||||
|
|
||||||
All rights reserved.
|
|
||||||
|
|
||||||
MIT License
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
|
|
||||||
associated documentation files (the "Software"), to deal in the Software without restriction,
|
|
||||||
including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
||||||
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
|
|
||||||
subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
|
|
||||||
LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
|
||||||
NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
||||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
||||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
notices: []
|
|
||||||
Generated
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
name: minimatch
|
name: minimatch
|
||||||
version: 3.0.4
|
version: 3.1.2
|
||||||
type: npm
|
type: npm
|
||||||
summary: a glob matcher in javascript
|
summary: a glob matcher in javascript
|
||||||
homepage: https://github.com/isaacs/minimatch#readme
|
homepage: https://github.com/isaacs/minimatch#readme
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
import * as core from '@actions/core';
|
import * as core from '@actions/core';
|
||||||
import * as cache from '@actions/cache';
|
import * as cache from '@actions/cache';
|
||||||
import * as exec from '@actions/exec';
|
import * as exec from '@actions/exec';
|
||||||
|
import * as io from '@actions/io';
|
||||||
import {getCacheDistributor} from '../src/cache-distributions/cache-factory';
|
import {getCacheDistributor} from '../src/cache-distributions/cache-factory';
|
||||||
|
import * as utils from './../src/utils';
|
||||||
|
|
||||||
describe('restore-cache', () => {
|
describe('restore-cache', () => {
|
||||||
const pipFileLockHash =
|
const pipFileLockHash =
|
||||||
@@ -35,6 +37,9 @@ virtualenvs.path = "{cache-dir}/virtualenvs" # /Users/patrick/Library/Caches/py
|
|||||||
// exec spy
|
// exec spy
|
||||||
let getExecOutputSpy: jest.SpyInstance;
|
let getExecOutputSpy: jest.SpyInstance;
|
||||||
|
|
||||||
|
// io spy
|
||||||
|
let whichSpy: jest.SpyInstance;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
process.env['RUNNER_OS'] = process.env['RUNNER_OS'] ?? 'linux';
|
process.env['RUNNER_OS'] = process.env['RUNNER_OS'] ?? 'linux';
|
||||||
|
|
||||||
@@ -61,6 +66,9 @@ virtualenvs.path = "{cache-dir}/virtualenvs" # /Users/patrick/Library/Caches/py
|
|||||||
if (input.includes('poetry')) {
|
if (input.includes('poetry')) {
|
||||||
return {stdout: poetryConfigOutput, stderr: '', exitCode: 0};
|
return {stdout: poetryConfigOutput, stderr: '', exitCode: 0};
|
||||||
}
|
}
|
||||||
|
if (input.includes('lsb_release')) {
|
||||||
|
return {stdout: 'Ubuntu\n20.04', stderr: '', exitCode: 0};
|
||||||
|
}
|
||||||
|
|
||||||
return {stdout: '', stderr: 'Error occured', exitCode: 2};
|
return {stdout: '', stderr: 'Error occured', exitCode: 2};
|
||||||
});
|
});
|
||||||
@@ -74,6 +82,9 @@ virtualenvs.path = "{cache-dir}/virtualenvs" # /Users/patrick/Library/Caches/py
|
|||||||
return primaryKey;
|
return primaryKey;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
whichSpy = jest.spyOn(io, 'which');
|
||||||
|
whichSpy.mockImplementation(() => '/path/to/python');
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Validate provided package manager', () => {
|
describe('Validate provided package manager', () => {
|
||||||
@@ -109,11 +120,18 @@ virtualenvs.path = "{cache-dir}/virtualenvs" # /Users/patrick/Library/Caches/py
|
|||||||
pythonVersion,
|
pythonVersion,
|
||||||
dependencyFile
|
dependencyFile
|
||||||
);
|
);
|
||||||
|
|
||||||
await cacheDistributor.restoreCache();
|
await cacheDistributor.restoreCache();
|
||||||
|
|
||||||
expect(infoSpy).toHaveBeenCalledWith(
|
if (process.platform === 'linux' && packageManager === 'pip') {
|
||||||
`Cache restored from key: setup-python-${process.env['RUNNER_OS']}-python-${pythonVersion}-${packageManager}-${fileHash}`
|
expect(infoSpy).toHaveBeenCalledWith(
|
||||||
);
|
`Cache restored from key: setup-python-${process.env['RUNNER_OS']}-20.04-Ubuntu-python-${pythonVersion}-${packageManager}-${fileHash}`
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
expect(infoSpy).toHaveBeenCalledWith(
|
||||||
|
`Cache restored from key: setup-python-${process.env['RUNNER_OS']}-python-${pythonVersion}-${packageManager}-${fileHash}`
|
||||||
|
);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
30000
|
30000
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
[tool.poetry]
|
||||||
|
name = "testactiontasks"
|
||||||
|
version = "0.1.0"
|
||||||
|
description = ""
|
||||||
|
authors = ["Your Name <[email protected]>"]
|
||||||
|
|
||||||
|
[tool.poetry.dependencies]
|
||||||
|
python = "^3.8"
|
||||||
|
flake8 = "^4.0.1"
|
||||||
|
|
||||||
|
[tool.poetry.dev-dependencies]
|
||||||
|
|
||||||
|
[build-system]
|
||||||
|
requires = ["poetry-core>=1.0.0"]
|
||||||
|
build-backend = "poetry.core.masonry.api"
|
||||||
+110
-7
@@ -14,7 +14,6 @@ import * as finder from '../src/find-pypy';
|
|||||||
import {
|
import {
|
||||||
IPyPyManifestRelease,
|
IPyPyManifestRelease,
|
||||||
IS_WINDOWS,
|
IS_WINDOWS,
|
||||||
validateVersion,
|
|
||||||
getPyPyVersionFromPath
|
getPyPyVersionFromPath
|
||||||
} from '../src/utils';
|
} from '../src/utils';
|
||||||
|
|
||||||
@@ -82,6 +81,12 @@ describe('findPyPyToolCache', () => {
|
|||||||
const pypyPath = path.join('PyPy', actualPythonVersion, architecture);
|
const pypyPath = path.join('PyPy', actualPythonVersion, architecture);
|
||||||
let tcFind: jest.SpyInstance;
|
let tcFind: jest.SpyInstance;
|
||||||
let spyReadExactPyPyVersion: jest.SpyInstance;
|
let spyReadExactPyPyVersion: jest.SpyInstance;
|
||||||
|
let infoSpy: jest.SpyInstance;
|
||||||
|
let warningSpy: jest.SpyInstance;
|
||||||
|
let debugSpy: jest.SpyInstance;
|
||||||
|
let addPathSpy: jest.SpyInstance;
|
||||||
|
let exportVariableSpy: jest.SpyInstance;
|
||||||
|
let setOutputSpy: jest.SpyInstance;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
tcFind = jest.spyOn(tc, 'find');
|
tcFind = jest.spyOn(tc, 'find');
|
||||||
@@ -94,6 +99,24 @@ describe('findPyPyToolCache', () => {
|
|||||||
|
|
||||||
spyReadExactPyPyVersion = jest.spyOn(utils, 'readExactPyPyVersionFile');
|
spyReadExactPyPyVersion = jest.spyOn(utils, 'readExactPyPyVersionFile');
|
||||||
spyReadExactPyPyVersion.mockImplementation(() => actualPyPyVersion);
|
spyReadExactPyPyVersion.mockImplementation(() => actualPyPyVersion);
|
||||||
|
|
||||||
|
infoSpy = jest.spyOn(core, 'info');
|
||||||
|
infoSpy.mockImplementation(() => null);
|
||||||
|
|
||||||
|
warningSpy = jest.spyOn(core, 'warning');
|
||||||
|
warningSpy.mockImplementation(() => null);
|
||||||
|
|
||||||
|
debugSpy = jest.spyOn(core, 'debug');
|
||||||
|
debugSpy.mockImplementation(() => null);
|
||||||
|
|
||||||
|
addPathSpy = jest.spyOn(core, 'addPath');
|
||||||
|
addPathSpy.mockImplementation(() => null);
|
||||||
|
|
||||||
|
exportVariableSpy = jest.spyOn(core, 'exportVariable');
|
||||||
|
exportVariableSpy.mockImplementation(() => null);
|
||||||
|
|
||||||
|
setOutputSpy = jest.spyOn(core, 'setOutput');
|
||||||
|
setOutputSpy.mockImplementation(() => null);
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
@@ -136,6 +159,13 @@ describe('findPyPyToolCache', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('findPyPyVersion', () => {
|
describe('findPyPyVersion', () => {
|
||||||
|
let getBooleanInputSpy: jest.SpyInstance;
|
||||||
|
let warningSpy: jest.SpyInstance;
|
||||||
|
let debugSpy: jest.SpyInstance;
|
||||||
|
let infoSpy: jest.SpyInstance;
|
||||||
|
let addPathSpy: jest.SpyInstance;
|
||||||
|
let exportVariableSpy: jest.SpyInstance;
|
||||||
|
let setOutputSpy: jest.SpyInstance;
|
||||||
let tcFind: jest.SpyInstance;
|
let tcFind: jest.SpyInstance;
|
||||||
let spyExtractZip: jest.SpyInstance;
|
let spyExtractZip: jest.SpyInstance;
|
||||||
let spyExtractTar: jest.SpyInstance;
|
let spyExtractTar: jest.SpyInstance;
|
||||||
@@ -154,6 +184,27 @@ describe('findPyPyVersion', () => {
|
|||||||
const env = process.env;
|
const env = process.env;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
|
getBooleanInputSpy = jest.spyOn(core, 'getBooleanInput');
|
||||||
|
getBooleanInputSpy.mockImplementation(() => false);
|
||||||
|
|
||||||
|
infoSpy = jest.spyOn(core, 'info');
|
||||||
|
infoSpy.mockImplementation(() => {});
|
||||||
|
|
||||||
|
warningSpy = jest.spyOn(core, 'warning');
|
||||||
|
warningSpy.mockImplementation(() => null);
|
||||||
|
|
||||||
|
debugSpy = jest.spyOn(core, 'debug');
|
||||||
|
debugSpy.mockImplementation(() => null);
|
||||||
|
|
||||||
|
addPathSpy = jest.spyOn(core, 'addPath');
|
||||||
|
addPathSpy.mockImplementation(() => null);
|
||||||
|
|
||||||
|
exportVariableSpy = jest.spyOn(core, 'exportVariable');
|
||||||
|
exportVariableSpy.mockImplementation(() => null);
|
||||||
|
|
||||||
|
setOutputSpy = jest.spyOn(core, 'setOutput');
|
||||||
|
setOutputSpy.mockImplementation(() => null);
|
||||||
|
|
||||||
jest.resetModules();
|
jest.resetModules();
|
||||||
process.env = {...env};
|
process.env = {...env};
|
||||||
tcFind = jest.spyOn(tc, 'find');
|
tcFind = jest.spyOn(tc, 'find');
|
||||||
@@ -222,7 +273,7 @@ describe('findPyPyVersion', () => {
|
|||||||
|
|
||||||
it('found PyPy in toolcache', async () => {
|
it('found PyPy in toolcache', async () => {
|
||||||
await expect(
|
await expect(
|
||||||
finder.findPyPyVersion('pypy-3.6-v7.3.x', architecture, true)
|
finder.findPyPyVersion('pypy-3.6-v7.3.x', architecture, true, false)
|
||||||
).resolves.toEqual({
|
).resolves.toEqual({
|
||||||
resolvedPythonVersion: '3.6.12',
|
resolvedPythonVersion: '3.6.12',
|
||||||
resolvedPyPyVersion: '7.3.3'
|
resolvedPyPyVersion: '7.3.3'
|
||||||
@@ -240,13 +291,13 @@ describe('findPyPyVersion', () => {
|
|||||||
|
|
||||||
it('throw on invalid input format', async () => {
|
it('throw on invalid input format', async () => {
|
||||||
await expect(
|
await expect(
|
||||||
finder.findPyPyVersion('pypy3.7-v7.3.x', architecture, true)
|
finder.findPyPyVersion('pypy3.7-v7.3.x', architecture, true, false)
|
||||||
).rejects.toThrow();
|
).rejects.toThrow();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('throw on invalid input format pypy3.7-7.3.x', async () => {
|
it('throw on invalid input format pypy3.7-7.3.x', async () => {
|
||||||
await expect(
|
await expect(
|
||||||
finder.findPyPyVersion('pypy3.7-v7.3.x', architecture, true)
|
finder.findPyPyVersion('pypy3.7-v7.3.x', architecture, true, false)
|
||||||
).rejects.toThrow();
|
).rejects.toThrow();
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -258,7 +309,7 @@ describe('findPyPyVersion', () => {
|
|||||||
spyChmodSync = jest.spyOn(fs, 'chmodSync');
|
spyChmodSync = jest.spyOn(fs, 'chmodSync');
|
||||||
spyChmodSync.mockImplementation(() => undefined);
|
spyChmodSync.mockImplementation(() => undefined);
|
||||||
await expect(
|
await expect(
|
||||||
finder.findPyPyVersion('pypy-3.7-v7.3.x', architecture, true)
|
finder.findPyPyVersion('pypy-3.7-v7.3.x', architecture, true, false)
|
||||||
).resolves.toEqual({
|
).resolves.toEqual({
|
||||||
resolvedPythonVersion: '3.7.9',
|
resolvedPythonVersion: '3.7.9',
|
||||||
resolvedPyPyVersion: '7.3.3'
|
resolvedPyPyVersion: '7.3.3'
|
||||||
@@ -282,7 +333,7 @@ describe('findPyPyVersion', () => {
|
|||||||
spyChmodSync = jest.spyOn(fs, 'chmodSync');
|
spyChmodSync = jest.spyOn(fs, 'chmodSync');
|
||||||
spyChmodSync.mockImplementation(() => undefined);
|
spyChmodSync.mockImplementation(() => undefined);
|
||||||
await expect(
|
await expect(
|
||||||
finder.findPyPyVersion('pypy-3.7-v7.3.x', architecture, false)
|
finder.findPyPyVersion('pypy-3.7-v7.3.x', architecture, false, false)
|
||||||
).resolves.toEqual({
|
).resolves.toEqual({
|
||||||
resolvedPythonVersion: '3.7.9',
|
resolvedPythonVersion: '3.7.9',
|
||||||
resolvedPyPyVersion: '7.3.3'
|
resolvedPyPyVersion: '7.3.3'
|
||||||
@@ -293,9 +344,61 @@ describe('findPyPyVersion', () => {
|
|||||||
|
|
||||||
it('throw if release is not found', async () => {
|
it('throw if release is not found', async () => {
|
||||||
await expect(
|
await expect(
|
||||||
finder.findPyPyVersion('pypy-3.7-v7.5.x', architecture, true)
|
finder.findPyPyVersion('pypy-3.7-v7.5.x', architecture, true, false)
|
||||||
).rejects.toThrowError(
|
).rejects.toThrowError(
|
||||||
`PyPy version 3.7 (v7.5.x) with arch ${architecture} not found`
|
`PyPy version 3.7 (v7.5.x) with arch ${architecture} not found`
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('check-latest enabled version found and used from toolcache', async () => {
|
||||||
|
await expect(
|
||||||
|
finder.findPyPyVersion('pypy-3.6-v7.3.x', architecture, false, true)
|
||||||
|
).resolves.toEqual({
|
||||||
|
resolvedPythonVersion: '3.6.12',
|
||||||
|
resolvedPyPyVersion: '7.3.3'
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(infoSpy).toHaveBeenCalledWith(
|
||||||
|
'Resolved as PyPy 7.3.3 with Python (3.6.12)'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('check-latest enabled version found and install successfully', async () => {
|
||||||
|
spyCacheDir = jest.spyOn(tc, 'cacheDir');
|
||||||
|
spyCacheDir.mockImplementation(() =>
|
||||||
|
path.join(toolDir, 'PyPy', '3.7.7', architecture)
|
||||||
|
);
|
||||||
|
spyChmodSync = jest.spyOn(fs, 'chmodSync');
|
||||||
|
spyChmodSync.mockImplementation(() => undefined);
|
||||||
|
await expect(
|
||||||
|
finder.findPyPyVersion('pypy-3.7-v7.3.x', architecture, false, true)
|
||||||
|
).resolves.toEqual({
|
||||||
|
resolvedPythonVersion: '3.7.9',
|
||||||
|
resolvedPyPyVersion: '7.3.3'
|
||||||
|
});
|
||||||
|
expect(infoSpy).toHaveBeenCalledWith(
|
||||||
|
'Resolved as PyPy 7.3.3 with Python (3.7.9)'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('check-latest enabled version is not found and used from toolcache', async () => {
|
||||||
|
tcFind.mockImplementationOnce((tool: string, version: string) => {
|
||||||
|
const semverRange = new semver.Range(version);
|
||||||
|
let pypyPath = '';
|
||||||
|
if (semver.satisfies('3.8.8', semverRange)) {
|
||||||
|
pypyPath = path.join(toolDir, 'PyPy', '3.8.8', architecture);
|
||||||
|
}
|
||||||
|
return pypyPath;
|
||||||
|
});
|
||||||
|
await expect(
|
||||||
|
finder.findPyPyVersion('pypy-3.8-v7.3.x', architecture, false, true)
|
||||||
|
).resolves.toEqual({
|
||||||
|
resolvedPythonVersion: '3.8.8',
|
||||||
|
resolvedPyPyVersion: '7.3.3'
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(infoSpy).toHaveBeenCalledWith(
|
||||||
|
'Failed to resolve PyPy v7.3.x with Python (3.8) from manifest'
|
||||||
|
);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import io = require('@actions/io');
|
import * as io from '@actions/io';
|
||||||
import fs = require('fs');
|
import os from 'os';
|
||||||
import path = require('path');
|
import fs from 'fs';
|
||||||
|
import path from 'path';
|
||||||
|
|
||||||
const toolDir = path.join(
|
const toolDir = path.join(
|
||||||
__dirname,
|
__dirname,
|
||||||
@@ -26,11 +27,14 @@ import * as installer from '../src/install-python';
|
|||||||
const manifestData = require('./data/versions-manifest.json');
|
const manifestData = require('./data/versions-manifest.json');
|
||||||
|
|
||||||
describe('Finder tests', () => {
|
describe('Finder tests', () => {
|
||||||
|
let writeSpy: jest.SpyInstance;
|
||||||
let spyCoreAddPath: jest.SpyInstance;
|
let spyCoreAddPath: jest.SpyInstance;
|
||||||
let spyCoreExportVariable: jest.SpyInstance;
|
let spyCoreExportVariable: jest.SpyInstance;
|
||||||
const env = process.env;
|
const env = process.env;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
|
writeSpy = jest.spyOn(process.stdout, 'write');
|
||||||
|
writeSpy.mockImplementation(() => {});
|
||||||
jest.resetModules();
|
jest.resetModules();
|
||||||
process.env = {...env};
|
process.env = {...env};
|
||||||
spyCoreAddPath = jest.spyOn(core, 'addPath');
|
spyCoreAddPath = jest.spyOn(core, 'addPath');
|
||||||
@@ -45,11 +49,14 @@ describe('Finder tests', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('Finds Python if it is installed', async () => {
|
it('Finds Python if it is installed', async () => {
|
||||||
|
const getBooleanInputSpy = jest.spyOn(core, 'getBooleanInput');
|
||||||
|
getBooleanInputSpy.mockImplementation(input => false);
|
||||||
|
|
||||||
const pythonDir: string = path.join(toolDir, 'Python', '3.0.0', 'x64');
|
const pythonDir: string = path.join(toolDir, 'Python', '3.0.0', 'x64');
|
||||||
await io.mkdirP(pythonDir);
|
await io.mkdirP(pythonDir);
|
||||||
fs.writeFileSync(`${pythonDir}.complete`, 'hello');
|
fs.writeFileSync(`${pythonDir}.complete`, 'hello');
|
||||||
// This will throw if it doesn't find it in the cache and in the manifest (because no such version exists)
|
// This will throw if it doesn't find it in the cache and in the manifest (because no such version exists)
|
||||||
await finder.useCpythonVersion('3.x', 'x64', true);
|
await finder.useCpythonVersion('3.x', 'x64', true, false);
|
||||||
expect(spyCoreAddPath).toHaveBeenCalled();
|
expect(spyCoreAddPath).toHaveBeenCalled();
|
||||||
expect(spyCoreExportVariable).toHaveBeenCalledWith(
|
expect(spyCoreExportVariable).toHaveBeenCalledWith(
|
||||||
'pythonLocation',
|
'pythonLocation',
|
||||||
@@ -66,7 +73,7 @@ describe('Finder tests', () => {
|
|||||||
await io.mkdirP(pythonDir);
|
await io.mkdirP(pythonDir);
|
||||||
fs.writeFileSync(`${pythonDir}.complete`, 'hello');
|
fs.writeFileSync(`${pythonDir}.complete`, 'hello');
|
||||||
// This will throw if it doesn't find it in the cache and in the manifest (because no such version exists)
|
// This will throw if it doesn't find it in the cache and in the manifest (because no such version exists)
|
||||||
await finder.useCpythonVersion('3.x', 'x64', false);
|
await finder.useCpythonVersion('3.x', 'x64', false, false);
|
||||||
expect(spyCoreAddPath).not.toHaveBeenCalled();
|
expect(spyCoreAddPath).not.toHaveBeenCalled();
|
||||||
expect(spyCoreExportVariable).not.toHaveBeenCalled();
|
expect(spyCoreExportVariable).not.toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
@@ -75,6 +82,9 @@ describe('Finder tests', () => {
|
|||||||
const findSpy: jest.SpyInstance = jest.spyOn(tc, 'getManifestFromRepo');
|
const findSpy: jest.SpyInstance = jest.spyOn(tc, 'getManifestFromRepo');
|
||||||
findSpy.mockImplementation(() => <tc.IToolRelease[]>manifestData);
|
findSpy.mockImplementation(() => <tc.IToolRelease[]>manifestData);
|
||||||
|
|
||||||
|
const getBooleanInputSpy = jest.spyOn(core, 'getBooleanInput');
|
||||||
|
getBooleanInputSpy.mockImplementation(input => false);
|
||||||
|
|
||||||
const installSpy: jest.SpyInstance = jest.spyOn(
|
const installSpy: jest.SpyInstance = jest.spyOn(
|
||||||
installer,
|
installer,
|
||||||
'installCpythonFromRelease'
|
'installCpythonFromRelease'
|
||||||
@@ -85,7 +95,7 @@ describe('Finder tests', () => {
|
|||||||
fs.writeFileSync(`${pythonDir}.complete`, 'hello');
|
fs.writeFileSync(`${pythonDir}.complete`, 'hello');
|
||||||
});
|
});
|
||||||
// This will throw if it doesn't find it in the cache and in the manifest (because no such version exists)
|
// This will throw if it doesn't find it in the cache and in the manifest (because no such version exists)
|
||||||
await finder.useCpythonVersion('1.2.3', 'x64', true);
|
await finder.useCpythonVersion('1.2.3', 'x64', true, false);
|
||||||
expect(spyCoreAddPath).toHaveBeenCalled();
|
expect(spyCoreAddPath).toHaveBeenCalled();
|
||||||
expect(spyCoreExportVariable).toHaveBeenCalledWith(
|
expect(spyCoreExportVariable).toHaveBeenCalledWith(
|
||||||
'pythonLocation',
|
'pythonLocation',
|
||||||
@@ -101,6 +111,9 @@ describe('Finder tests', () => {
|
|||||||
const findSpy: jest.SpyInstance = jest.spyOn(tc, 'getManifestFromRepo');
|
const findSpy: jest.SpyInstance = jest.spyOn(tc, 'getManifestFromRepo');
|
||||||
findSpy.mockImplementation(() => <tc.IToolRelease[]>manifestData);
|
findSpy.mockImplementation(() => <tc.IToolRelease[]>manifestData);
|
||||||
|
|
||||||
|
const getBooleanInputSpy = jest.spyOn(core, 'getBooleanInput');
|
||||||
|
getBooleanInputSpy.mockImplementation(input => false);
|
||||||
|
|
||||||
const installSpy: jest.SpyInstance = jest.spyOn(
|
const installSpy: jest.SpyInstance = jest.spyOn(
|
||||||
installer,
|
installer,
|
||||||
'installCpythonFromRelease'
|
'installCpythonFromRelease'
|
||||||
@@ -116,7 +129,65 @@ describe('Finder tests', () => {
|
|||||||
fs.writeFileSync(`${pythonDir}.complete`, 'hello');
|
fs.writeFileSync(`${pythonDir}.complete`, 'hello');
|
||||||
});
|
});
|
||||||
// This will throw if it doesn't find it in the manifest (because no such version exists)
|
// This will throw if it doesn't find it in the manifest (because no such version exists)
|
||||||
await finder.useCpythonVersion('1.2.3-beta.2', 'x64', true);
|
await finder.useCpythonVersion('1.2.3-beta.2', 'x64', false, false);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Check-latest true, finds the latest version in the manifest', async () => {
|
||||||
|
const findSpy: jest.SpyInstance = jest.spyOn(tc, 'getManifestFromRepo');
|
||||||
|
findSpy.mockImplementation(() => <tc.IToolRelease[]>manifestData);
|
||||||
|
|
||||||
|
const getBooleanInputSpy = jest.spyOn(core, 'getBooleanInput');
|
||||||
|
getBooleanInputSpy.mockImplementation(input => true);
|
||||||
|
|
||||||
|
const cnSpy: jest.SpyInstance = jest.spyOn(process.stdout, 'write');
|
||||||
|
cnSpy.mockImplementation(line => {
|
||||||
|
// uncomment to debug
|
||||||
|
// process.stderr.write('write:' + line + '\n');
|
||||||
|
});
|
||||||
|
|
||||||
|
const addPathSpy: jest.SpyInstance = jest.spyOn(core, 'addPath');
|
||||||
|
addPathSpy.mockImplementation(() => null);
|
||||||
|
|
||||||
|
const infoSpy: jest.SpyInstance = jest.spyOn(core, 'info');
|
||||||
|
infoSpy.mockImplementation(() => {});
|
||||||
|
|
||||||
|
const debugSpy: jest.SpyInstance = jest.spyOn(core, 'debug');
|
||||||
|
debugSpy.mockImplementation(() => {});
|
||||||
|
|
||||||
|
const pythonDir: string = path.join(toolDir, 'Python', '1.2.2', 'x64');
|
||||||
|
const expPath: string = path.join(toolDir, 'Python', '1.2.3', 'x64');
|
||||||
|
|
||||||
|
const installSpy: jest.SpyInstance = jest.spyOn(
|
||||||
|
installer,
|
||||||
|
'installCpythonFromRelease'
|
||||||
|
);
|
||||||
|
installSpy.mockImplementation(async () => {
|
||||||
|
await io.mkdirP(expPath);
|
||||||
|
fs.writeFileSync(`${expPath}.complete`, 'hello');
|
||||||
|
});
|
||||||
|
|
||||||
|
const tcFindSpy: jest.SpyInstance = jest.spyOn(tc, 'find');
|
||||||
|
tcFindSpy
|
||||||
|
.mockImplementationOnce(() => '')
|
||||||
|
.mockImplementationOnce(() => expPath);
|
||||||
|
|
||||||
|
await io.mkdirP(pythonDir);
|
||||||
|
await io.rmRF(path.join(toolDir, 'Python', '1.2.3'));
|
||||||
|
|
||||||
|
fs.writeFileSync(`${pythonDir}.complete`, 'hello');
|
||||||
|
// This will throw if it doesn't find it in the cache and in the manifest (because no such version exists)
|
||||||
|
await finder.useCpythonVersion('1.2', 'x64', true, true);
|
||||||
|
|
||||||
|
expect(infoSpy).toHaveBeenCalledWith("Resolved as '1.2.3'");
|
||||||
|
expect(infoSpy).toHaveBeenCalledWith(
|
||||||
|
'Version 1.2.3 was not found in the local cache'
|
||||||
|
);
|
||||||
|
expect(infoSpy).toBeCalledWith(
|
||||||
|
'Version 1.2.3 is available for downloading'
|
||||||
|
);
|
||||||
|
expect(installSpy).toHaveBeenCalled();
|
||||||
|
expect(addPathSpy).toHaveBeenCalledWith(expPath);
|
||||||
|
await finder.useCpythonVersion('1.2.3-beta.2', 'x64', false, true);
|
||||||
expect(spyCoreAddPath).toHaveBeenCalled();
|
expect(spyCoreAddPath).toHaveBeenCalled();
|
||||||
expect(spyCoreExportVariable).toHaveBeenCalledWith(
|
expect(spyCoreExportVariable).toHaveBeenCalledWith(
|
||||||
'pythonLocation',
|
'pythonLocation',
|
||||||
@@ -132,7 +203,7 @@ describe('Finder tests', () => {
|
|||||||
// This will throw if it doesn't find it in the cache and in the manifest (because no such version exists)
|
// This will throw if it doesn't find it in the cache and in the manifest (because no such version exists)
|
||||||
let thrown = false;
|
let thrown = false;
|
||||||
try {
|
try {
|
||||||
await finder.useCpythonVersion('3.300000', 'x64', true);
|
await finder.useCpythonVersion('3.300000', 'x64', true, false);
|
||||||
} catch {
|
} catch {
|
||||||
thrown = true;
|
thrown = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import {HttpClient} from '@actions/http-client';
|
|||||||
import * as ifm from '@actions/http-client/interfaces';
|
import * as ifm from '@actions/http-client/interfaces';
|
||||||
import * as tc from '@actions/tool-cache';
|
import * as tc from '@actions/tool-cache';
|
||||||
import * as exec from '@actions/exec';
|
import * as exec from '@actions/exec';
|
||||||
|
import * as core from '@actions/core';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
|
|
||||||
import * as installer from '../src/install-pypy';
|
import * as installer from '../src/install-pypy';
|
||||||
@@ -51,6 +52,22 @@ describe('findRelease', () => {
|
|||||||
download_url: `https://test.download.python.org/pypy/pypy3.6-v7.3.3-${extensionName}`
|
download_url: `https://test.download.python.org/pypy/pypy3.6-v7.3.3-${extensionName}`
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let getBooleanInputSpy: jest.SpyInstance;
|
||||||
|
let warningSpy: jest.SpyInstance;
|
||||||
|
let debugSpy: jest.SpyInstance;
|
||||||
|
let infoSpy: jest.SpyInstance;
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
infoSpy = jest.spyOn(core, 'info');
|
||||||
|
infoSpy.mockImplementation(() => {});
|
||||||
|
|
||||||
|
warningSpy = jest.spyOn(core, 'warning');
|
||||||
|
warningSpy.mockImplementation(() => null);
|
||||||
|
|
||||||
|
debugSpy = jest.spyOn(core, 'debug');
|
||||||
|
debugSpy.mockImplementation(() => null);
|
||||||
|
});
|
||||||
|
|
||||||
it("Python version is found, but PyPy version doesn't match", () => {
|
it("Python version is found, but PyPy version doesn't match", () => {
|
||||||
const pythonVersion = '3.6';
|
const pythonVersion = '3.6';
|
||||||
const pypyVersion = '7.3.7';
|
const pypyVersion = '7.3.7';
|
||||||
@@ -133,6 +150,10 @@ describe('findRelease', () => {
|
|||||||
|
|
||||||
describe('installPyPy', () => {
|
describe('installPyPy', () => {
|
||||||
let tcFind: jest.SpyInstance;
|
let tcFind: jest.SpyInstance;
|
||||||
|
let getBooleanInputSpy: jest.SpyInstance;
|
||||||
|
let warningSpy: jest.SpyInstance;
|
||||||
|
let debugSpy: jest.SpyInstance;
|
||||||
|
let infoSpy: jest.SpyInstance;
|
||||||
let spyExtractZip: jest.SpyInstance;
|
let spyExtractZip: jest.SpyInstance;
|
||||||
let spyExtractTar: jest.SpyInstance;
|
let spyExtractTar: jest.SpyInstance;
|
||||||
let spyFsReadDir: jest.SpyInstance;
|
let spyFsReadDir: jest.SpyInstance;
|
||||||
@@ -158,6 +179,15 @@ describe('installPyPy', () => {
|
|||||||
spyExtractTar = jest.spyOn(tc, 'extractTar');
|
spyExtractTar = jest.spyOn(tc, 'extractTar');
|
||||||
spyExtractTar.mockImplementation(() => tempDir);
|
spyExtractTar.mockImplementation(() => tempDir);
|
||||||
|
|
||||||
|
infoSpy = jest.spyOn(core, 'info');
|
||||||
|
infoSpy.mockImplementation(() => {});
|
||||||
|
|
||||||
|
warningSpy = jest.spyOn(core, 'warning');
|
||||||
|
warningSpy.mockImplementation(() => null);
|
||||||
|
|
||||||
|
debugSpy = jest.spyOn(core, 'debug');
|
||||||
|
debugSpy.mockImplementation(() => null);
|
||||||
|
|
||||||
spyFsReadDir = jest.spyOn(fs, 'readdirSync');
|
spyFsReadDir = jest.spyOn(fs, 'readdirSync');
|
||||||
spyFsReadDir.mockImplementation(() => ['PyPyTest']);
|
spyFsReadDir.mockImplementation(() => ['PyPyTest']);
|
||||||
|
|
||||||
@@ -194,7 +224,7 @@ describe('installPyPy', () => {
|
|||||||
|
|
||||||
it('throw if release is not found', async () => {
|
it('throw if release is not found', async () => {
|
||||||
await expect(
|
await expect(
|
||||||
installer.installPyPy('7.3.3', '3.6.17', architecture)
|
installer.installPyPy('7.3.3', '3.6.17', architecture, undefined)
|
||||||
).rejects.toThrowError(
|
).rejects.toThrowError(
|
||||||
`PyPy version 3.6.17 (7.3.3) with arch ${architecture} not found`
|
`PyPy version 3.6.17 (7.3.3) with arch ${architecture} not found`
|
||||||
);
|
);
|
||||||
@@ -214,7 +244,7 @@ describe('installPyPy', () => {
|
|||||||
spyChmodSync.mockImplementation(() => undefined);
|
spyChmodSync.mockImplementation(() => undefined);
|
||||||
|
|
||||||
await expect(
|
await expect(
|
||||||
installer.installPyPy('7.3.x', '3.6.12', architecture)
|
installer.installPyPy('7.3.x', '3.6.12', architecture, undefined)
|
||||||
).resolves.toEqual({
|
).resolves.toEqual({
|
||||||
installDir: path.join(toolDir, 'PyPy', '3.6.12', architecture),
|
installDir: path.join(toolDir, 'PyPy', '3.6.12', architecture),
|
||||||
resolvedPythonVersion: '3.6.12',
|
resolvedPythonVersion: '3.6.12',
|
||||||
|
|||||||
@@ -42,14 +42,13 @@ describe('validateVersion', () => {
|
|||||||
describe('isCacheFeatureAvailable', () => {
|
describe('isCacheFeatureAvailable', () => {
|
||||||
it('isCacheFeatureAvailable disabled on GHES', () => {
|
it('isCacheFeatureAvailable disabled on GHES', () => {
|
||||||
jest.spyOn(cache, 'isFeatureAvailable').mockImplementation(() => false);
|
jest.spyOn(cache, 'isFeatureAvailable').mockImplementation(() => false);
|
||||||
|
const infoMock = jest.spyOn(core, 'warning');
|
||||||
|
const message =
|
||||||
|
'Caching is only supported on GHES version >= 3.5. If you are on a version >= 3.5, please check with your GHES admin if the Actions cache service is enabled or not.';
|
||||||
try {
|
try {
|
||||||
process.env['GITHUB_SERVER_URL'] = 'http://example.com';
|
process.env['GITHUB_SERVER_URL'] = 'http://example.com';
|
||||||
isCacheFeatureAvailable();
|
expect(isCacheFeatureAvailable()).toBeFalsy();
|
||||||
} catch (error) {
|
expect(infoMock).toHaveBeenCalledWith(message);
|
||||||
expect(error).toHaveProperty(
|
|
||||||
'message',
|
|
||||||
'Caching is only supported on GHES version >= 3.5. If you are on a version >= 3.5, please check with your GHES admin if the Actions cache service is enabled or not.'
|
|
||||||
);
|
|
||||||
} finally {
|
} finally {
|
||||||
delete process.env['GITHUB_SERVER_URL'];
|
delete process.env['GITHUB_SERVER_URL'];
|
||||||
}
|
}
|
||||||
|
|||||||
+16
-13
@@ -1,32 +1,35 @@
|
|||||||
---
|
---
|
||||||
name: 'Setup Python'
|
name: "Setup Python"
|
||||||
description: 'Set up a specific version of Python and add the command-line tools to the PATH.'
|
description: "Set up a specific version of Python and add the command-line tools to the PATH."
|
||||||
author: 'GitHub'
|
author: "GitHub"
|
||||||
inputs:
|
inputs:
|
||||||
python-version:
|
python-version:
|
||||||
description: "Version range or exact version of Python to use, using SemVer's version range syntax. Reads from .python-version if unset."
|
description: "Version range or exact version of Python or PyPy to use, using SemVer's version range syntax. Reads from .python-version if unset."
|
||||||
python-version-file:
|
python-version-file:
|
||||||
description: "File containing the Python version to use. Example: .python-version"
|
description: "File containing the Python version to use. Example: .python-version"
|
||||||
cache:
|
cache:
|
||||||
description: 'Used to specify a package manager for caching in the default directory. Supported values: pip, pipenv, poetry.'
|
description: "Used to specify a package manager for caching in the default directory. Supported values: pip, pipenv, poetry."
|
||||||
required: false
|
required: false
|
||||||
architecture:
|
architecture:
|
||||||
description: 'The target architecture (x86, x64) of the Python interpreter.'
|
description: "The target architecture (x86, x64) of the Python or PyPy interpreter."
|
||||||
|
check-latest:
|
||||||
|
description: "Set this option if you want the action to check for the latest available version that satisfies the version spec."
|
||||||
|
default: false
|
||||||
token:
|
token:
|
||||||
description: Used to pull python distributions from actions/python-versions. Since there's a default, this is typically not supplied by the user.
|
description: "The token used to authenticate when fetching Python distributions from https://github.com/actions/python-versions. When running this action on github.com, the default value is sufficient. When running on GHES, you can pass a personal access token for github.com if you are experiencing rate limiting."
|
||||||
default: ${{ github.token }}
|
default: ${{ github.server_url == 'https://github.com' && github.token || '' }}
|
||||||
cache-dependency-path:
|
cache-dependency-path:
|
||||||
description: 'Used to specify the path to dependency files. Supports wildcards or a list of file names for caching multiple dependencies.'
|
description: "Used to specify the path to dependency files. Supports wildcards or a list of file names for caching multiple dependencies."
|
||||||
update-environment:
|
update-environment:
|
||||||
description: 'Set this option if you want the action to update environment variables.'
|
description: "Set this option if you want the action to update environment variables."
|
||||||
default: true
|
default: true
|
||||||
outputs:
|
outputs:
|
||||||
python-version:
|
python-version:
|
||||||
description: "The installed python version. Useful when given a version range as input."
|
description: "The installed Python or PyPy version. Useful when given a version range as input."
|
||||||
cache-hit:
|
cache-hit:
|
||||||
description: 'A boolean value to indicate a cache entry was found'
|
description: "A boolean value to indicate a cache entry was found"
|
||||||
python-path:
|
python-path:
|
||||||
description: "The absolute path to the Python executable."
|
description: "The absolute path to the Python or PyPy executable."
|
||||||
runs:
|
runs:
|
||||||
using: 'node16'
|
using: 'node16'
|
||||||
main: 'dist/setup/index.js'
|
main: 'dist/setup/index.js'
|
||||||
|
|||||||
Vendored
+1994
-1094
File diff suppressed because it is too large
Load Diff
Vendored
+2272
-589
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
+97
-21
File diff suppressed because one or more lines are too long
Generated
+55
-22
@@ -9,8 +9,8 @@
|
|||||||
"version": "4.0.0",
|
"version": "4.0.0",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/cache": "^3.0.0",
|
"@actions/cache": "^3.0.4",
|
||||||
"@actions/core": "^1.7.0",
|
"@actions/core": "^1.10.0",
|
||||||
"@actions/exec": "^1.1.0",
|
"@actions/exec": "^1.1.0",
|
||||||
"@actions/glob": "^0.2.0",
|
"@actions/glob": "^0.2.0",
|
||||||
"@actions/io": "^1.0.2",
|
"@actions/io": "^1.0.2",
|
||||||
@@ -31,9 +31,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@actions/cache": {
|
"node_modules/@actions/cache": {
|
||||||
"version": "3.0.0",
|
"version": "3.0.4",
|
||||||
"resolved": "https://registry.npmjs.org/@actions/cache/-/cache-3.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/@actions/cache/-/cache-3.0.4.tgz",
|
||||||
"integrity": "sha512-GL9CT1Fnu+pqs8TTB621q8Xa8Cilw2n9MwvbgMedetH7L1q2n6jY61gzbwGbKgtVbp3gVJ12aNMi4osSGXx3KQ==",
|
"integrity": "sha512-9RwVL8/ISJoYWFNH1wR/C26E+M3HDkGPWmbFJMMCKwTkjbNZJreMT4XaR/EB1bheIvN4PREQxEQQVJ18IPnf/Q==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^1.2.6",
|
"@actions/core": "^1.2.6",
|
||||||
"@actions/exec": "^1.0.1",
|
"@actions/exec": "^1.0.1",
|
||||||
@@ -72,11 +72,28 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@actions/core": {
|
"node_modules/@actions/core": {
|
||||||
"version": "1.7.0",
|
"version": "1.10.0",
|
||||||
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.7.0.tgz",
|
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.10.0.tgz",
|
||||||
"integrity": "sha512-7fPSS7yKOhTpgLMbw7lBLc1QJWvJBBAgyTX2PEhagWcKK8t0H8AKCoPMfnrHqIm5cRYH4QFPqD1/ruhuUE7YcQ==",
|
"integrity": "sha512-2aZDDa3zrrZbP5ZYg159sNoLRb61nQ7awl5pSvIq5Qpj81vwDzdMRKzkWJGJuwVvWpvZKx7vspJALyvaaIQyug==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/http-client": "^1.0.11"
|
"@actions/http-client": "^2.0.1",
|
||||||
|
"uuid": "^8.3.2"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@actions/core/node_modules/@actions/http-client": {
|
||||||
|
"version": "2.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-2.0.1.tgz",
|
||||||
|
"integrity": "sha512-PIXiMVtz6VvyaRsGY268qvj57hXQEpsYogYOu2nrQhlf+XCGmZstmuZBbAybUl1nQGnvS1k1eEsQ69ZoD7xlSw==",
|
||||||
|
"dependencies": {
|
||||||
|
"tunnel": "^0.0.6"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@actions/core/node_modules/uuid": {
|
||||||
|
"version": "8.3.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz",
|
||||||
|
"integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==",
|
||||||
|
"bin": {
|
||||||
|
"uuid": "dist/bin/uuid"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@actions/exec": {
|
"node_modules/@actions/exec": {
|
||||||
@@ -10160,9 +10177,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/minimatch": {
|
"node_modules/minimatch": {
|
||||||
"version": "3.0.4",
|
"version": "3.1.2",
|
||||||
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
|
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
|
||||||
"integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
|
"integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"brace-expansion": "^1.1.7"
|
"brace-expansion": "^1.1.7"
|
||||||
},
|
},
|
||||||
@@ -11340,9 +11357,9 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/cache": {
|
"@actions/cache": {
|
||||||
"version": "3.0.0",
|
"version": "3.0.4",
|
||||||
"resolved": "https://registry.npmjs.org/@actions/cache/-/cache-3.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/@actions/cache/-/cache-3.0.4.tgz",
|
||||||
"integrity": "sha512-GL9CT1Fnu+pqs8TTB621q8Xa8Cilw2n9MwvbgMedetH7L1q2n6jY61gzbwGbKgtVbp3gVJ12aNMi4osSGXx3KQ==",
|
"integrity": "sha512-9RwVL8/ISJoYWFNH1wR/C26E+M3HDkGPWmbFJMMCKwTkjbNZJreMT4XaR/EB1bheIvN4PREQxEQQVJ18IPnf/Q==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@actions/core": "^1.2.6",
|
"@actions/core": "^1.2.6",
|
||||||
"@actions/exec": "^1.0.1",
|
"@actions/exec": "^1.0.1",
|
||||||
@@ -11380,11 +11397,27 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@actions/core": {
|
"@actions/core": {
|
||||||
"version": "1.7.0",
|
"version": "1.10.0",
|
||||||
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.7.0.tgz",
|
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.10.0.tgz",
|
||||||
"integrity": "sha512-7fPSS7yKOhTpgLMbw7lBLc1QJWvJBBAgyTX2PEhagWcKK8t0H8AKCoPMfnrHqIm5cRYH4QFPqD1/ruhuUE7YcQ==",
|
"integrity": "sha512-2aZDDa3zrrZbP5ZYg159sNoLRb61nQ7awl5pSvIq5Qpj81vwDzdMRKzkWJGJuwVvWpvZKx7vspJALyvaaIQyug==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@actions/http-client": "^1.0.11"
|
"@actions/http-client": "^2.0.1",
|
||||||
|
"uuid": "^8.3.2"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@actions/http-client": {
|
||||||
|
"version": "2.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-2.0.1.tgz",
|
||||||
|
"integrity": "sha512-PIXiMVtz6VvyaRsGY268qvj57hXQEpsYogYOu2nrQhlf+XCGmZstmuZBbAybUl1nQGnvS1k1eEsQ69ZoD7xlSw==",
|
||||||
|
"requires": {
|
||||||
|
"tunnel": "^0.0.6"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"uuid": {
|
||||||
|
"version": "8.3.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz",
|
||||||
|
"integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg=="
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@actions/exec": {
|
"@actions/exec": {
|
||||||
@@ -19457,9 +19490,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"minimatch": {
|
"minimatch": {
|
||||||
"version": "3.0.4",
|
"version": "3.1.2",
|
||||||
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
|
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
|
||||||
"integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
|
"integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"brace-expansion": "^1.1.7"
|
"brace-expansion": "^1.1.7"
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-2
@@ -8,6 +8,7 @@
|
|||||||
"build": "ncc build -o dist/setup src/setup-python.ts && ncc build -o dist/cache-save src/cache-save.ts",
|
"build": "ncc build -o dist/setup src/setup-python.ts && ncc build -o dist/cache-save src/cache-save.ts",
|
||||||
"format": "prettier --write \"{,!(node_modules)/**/}*.ts\"",
|
"format": "prettier --write \"{,!(node_modules)/**/}*.ts\"",
|
||||||
"format-check": "prettier --check \"{,!(node_modules)/**/}*.ts\"",
|
"format-check": "prettier --check \"{,!(node_modules)/**/}*.ts\"",
|
||||||
|
"lint": "echo \"Fake command that does nothing. It is used in reusable workflows\"",
|
||||||
"release": "ncc build -o dist/setup src/setup-python.ts && ncc build -o dist/cache-save src/cache-save.ts && git add -f dist/",
|
"release": "ncc build -o dist/setup src/setup-python.ts && ncc build -o dist/cache-save src/cache-save.ts && git add -f dist/",
|
||||||
"test": "jest --coverage"
|
"test": "jest --coverage"
|
||||||
},
|
},
|
||||||
@@ -23,8 +24,8 @@
|
|||||||
"author": "GitHub",
|
"author": "GitHub",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/cache": "^3.0.0",
|
"@actions/cache": "^3.0.4",
|
||||||
"@actions/core": "^1.7.0",
|
"@actions/core": "^1.10.0",
|
||||||
"@actions/exec": "^1.1.0",
|
"@actions/exec": "^1.1.0",
|
||||||
"@actions/glob": "^0.2.0",
|
"@actions/glob": "^0.2.0",
|
||||||
"@actions/io": "^1.0.2",
|
"@actions/io": "^1.0.2",
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import * as path from 'path';
|
|||||||
import os from 'os';
|
import os from 'os';
|
||||||
|
|
||||||
import CacheDistributor from './cache-distributor';
|
import CacheDistributor from './cache-distributor';
|
||||||
import {IS_WINDOWS} from '../utils';
|
import {getLinuxInfo, IS_LINUX, IS_WINDOWS} from '../utils';
|
||||||
|
|
||||||
class PipCache extends CacheDistributor {
|
class PipCache extends CacheDistributor {
|
||||||
constructor(
|
constructor(
|
||||||
@@ -57,8 +57,17 @@ class PipCache extends CacheDistributor {
|
|||||||
|
|
||||||
protected async computeKeys() {
|
protected async computeKeys() {
|
||||||
const hash = await glob.hashFiles(this.cacheDependencyPath);
|
const hash = await glob.hashFiles(this.cacheDependencyPath);
|
||||||
const primaryKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-python-${this.pythonVersion}-${this.packageManager}-${hash}`;
|
let primaryKey = '';
|
||||||
const restoreKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-python-${this.pythonVersion}-${this.packageManager}`;
|
let restoreKey = '';
|
||||||
|
|
||||||
|
if (IS_LINUX) {
|
||||||
|
const osInfo = await getLinuxInfo();
|
||||||
|
primaryKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-${osInfo.osVersion}-${osInfo.osName}-python-${this.pythonVersion}-${this.packageManager}-${hash}`;
|
||||||
|
restoreKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-${osInfo.osVersion}-${osInfo.osName}-python-${this.pythonVersion}-${this.packageManager}`;
|
||||||
|
} else {
|
||||||
|
primaryKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-python-${this.pythonVersion}-${this.packageManager}-${hash}`;
|
||||||
|
restoreKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-python-${this.pythonVersion}-${this.packageManager}`;
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
primaryKey,
|
primaryKey,
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
import * as glob from '@actions/glob';
|
import * as glob from '@actions/glob';
|
||||||
import * as os from 'os';
|
import * as io from '@actions/io';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
import * as exec from '@actions/exec';
|
import * as exec from '@actions/exec';
|
||||||
|
import * as core from '@actions/core';
|
||||||
|
|
||||||
import CacheDistributor from './cache-distributor';
|
import CacheDistributor from './cache-distributor';
|
||||||
|
import {logWarning} from '../utils';
|
||||||
|
|
||||||
class PoetryCache extends CacheDistributor {
|
class PoetryCache extends CacheDistributor {
|
||||||
constructor(
|
constructor(
|
||||||
@@ -28,6 +30,26 @@ class PoetryCache extends CacheDistributor {
|
|||||||
paths.push(path.join(process.cwd(), '.venv'));
|
paths.push(path.join(process.cwd(), '.venv'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const pythonLocation = await io.which('python');
|
||||||
|
|
||||||
|
if (pythonLocation) {
|
||||||
|
core.debug(`pythonLocation is ${pythonLocation}`);
|
||||||
|
const {
|
||||||
|
exitCode,
|
||||||
|
stderr
|
||||||
|
} = await exec.getExecOutput(
|
||||||
|
`poetry env use ${pythonLocation}`,
|
||||||
|
undefined,
|
||||||
|
{ignoreReturnCode: true}
|
||||||
|
);
|
||||||
|
|
||||||
|
if (exitCode) {
|
||||||
|
logWarning(stderr);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
logWarning('python binaries were not found in PATH');
|
||||||
|
}
|
||||||
|
|
||||||
return paths;
|
return paths;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user