mirror of
https://github.com/actions/setup-python.git
synced 2026-09-17 10:01:28 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0066b88440 | ||
|
|
280924fbef | ||
|
|
52636cf49a | ||
|
|
ca5c59064f | ||
|
|
feeaa3ba49 | ||
|
|
002b1e4044 | ||
|
|
d12543aa2a | ||
|
|
4aa563ba8c | ||
|
|
70e2063f71 | ||
|
|
2d803e7fea | ||
|
|
43c2dc443f | ||
|
|
dc73133d4d | ||
|
|
a1121449a2 | ||
|
|
66319ca9fa | ||
|
|
3105fb18c0 | ||
|
|
8c5ea631b2 | ||
|
|
2831efe49a | ||
|
|
3b3f2de1b1 | ||
|
|
723e46dad7 | ||
|
|
195f5c388b | ||
|
|
41b7212b16 | ||
|
|
878156f1de | ||
|
|
c181ffa198 | ||
|
|
1ce870e10f | ||
|
|
b9436a7e86 | ||
|
|
51d2bf1911 | ||
|
|
24156c231c | ||
|
|
212e83ff58 | ||
|
|
0c28554988 | ||
|
|
7010ec794f | ||
|
|
306c473438 | ||
|
|
7a69c2bc7d | ||
|
|
654aa00a6e | ||
|
|
6f45e887f6 | ||
|
|
2989dc4a1a | ||
|
|
a0a76c4ddb | ||
|
|
2241d846ba | ||
|
|
807b74f98c | ||
|
|
5230712b36 | ||
|
|
4dda7a3aa1 | ||
|
|
9f521e1bf4 | ||
|
|
ee653cd47f | ||
|
|
c23f4218be | ||
|
|
f129643215 | ||
|
|
6cbb9cfdfd | ||
|
|
6c4e46d258 | ||
|
|
824e8a7e12 | ||
|
|
8910d815ad | ||
|
|
e5af64b2df | ||
|
|
985150d1f6 | ||
|
|
c881de7f35 | ||
|
|
b7d744ca11 |
@@ -1 +1,2 @@
|
|||||||
* text=auto eol=lf
|
* text=auto eol=lf
|
||||||
|
.licenses/** -diff linguist-generated=true
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
* @actions/actions-service
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
---
|
||||||
|
name: Bug report
|
||||||
|
about: Create a bug report
|
||||||
|
title: ''
|
||||||
|
labels: bug, needs triage
|
||||||
|
assignees: ''
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
<!--- Please direct any generic questions related to actions to our support community forum at https://github.community/c/code-to-cloud/github-actions/41 --->
|
||||||
|
<!--- Before opening up a new bug report, please make sure to check for similar existing issues -->
|
||||||
|
|
||||||
|
**Description:**
|
||||||
|
A clear and concise description of what the bug is.
|
||||||
|
|
||||||
|
**Action version:**
|
||||||
|
Specify the action version
|
||||||
|
|
||||||
|
**Platform:**
|
||||||
|
- [ ] Ubuntu
|
||||||
|
- [ ] macOS
|
||||||
|
- [ ] Windows
|
||||||
|
|
||||||
|
**Runner type:**
|
||||||
|
- [ ] Hosted
|
||||||
|
- [ ] Self-hosted
|
||||||
|
|
||||||
|
**Tools version:**
|
||||||
|
<!--- Please list all of the affected Python versions (`3.8.2`, etc.)-->
|
||||||
|
|
||||||
|
**Repro steps:**
|
||||||
|
A description with steps to reproduce the issue. If your have a public example or repo to share, please provide the link.
|
||||||
|
|
||||||
|
**Expected behavior:**
|
||||||
|
A description of what you expected to happen.
|
||||||
|
|
||||||
|
**Actual behavior:**
|
||||||
|
A description of what is actually happening.
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
blank_issues_enabled: false
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
---
|
||||||
|
name: Feature request
|
||||||
|
about: Suggest an idea for this project
|
||||||
|
title: ''
|
||||||
|
labels: feature request, needs triage
|
||||||
|
assignees: ''
|
||||||
|
---
|
||||||
|
<!--- Please direct any generic questions related to actions to our support community forum at https://github.community/c/code-to-cloud/github-actions/41 --->
|
||||||
|
<!--- Before opening up a new feature request, please make sure to check for similar existing issues and pull requests -->
|
||||||
|
|
||||||
|
**Description:**
|
||||||
|
Describe your proposal.
|
||||||
|
|
||||||
|
**Justification:**
|
||||||
|
Justification or a use case for your proposal.
|
||||||
|
|
||||||
|
**Are you willing to submit a PR?**
|
||||||
|
<!--- We accept contributions! -->
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
**Description:**
|
||||||
|
Describe your changes.
|
||||||
|
|
||||||
|
**Related issue:**
|
||||||
|
Add link to the related issue.
|
||||||
|
|
||||||
|
**Check list:**
|
||||||
|
- [ ] Mark if documentation changes are required.
|
||||||
|
- [ ] Mark if tests were added or updated to cover the changes.
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
# `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/
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
paths-ignore:
|
||||||
|
- '**.md'
|
||||||
|
pull_request:
|
||||||
|
paths-ignore:
|
||||||
|
- '**.md'
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
check-dist:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Set Node.js 12.x
|
||||||
|
uses: actions/setup-node@v1
|
||||||
|
with:
|
||||||
|
node-version: 12.x
|
||||||
|
|
||||||
|
- 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/
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
name: "Code scanning - action"
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
pull_request:
|
||||||
|
schedule:
|
||||||
|
- cron: '25 3 * * 5'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
CodeQL-Build:
|
||||||
|
|
||||||
|
strategy:
|
||||||
|
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
|
||||||
@@ -0,0 +1,93 @@
|
|||||||
|
name: e2e-cache
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
paths-ignore:
|
||||||
|
- '**.md'
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
- releases/*
|
||||||
|
paths-ignore:
|
||||||
|
- '**.md'
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
jobs:
|
||||||
|
python-pip-dependencies-caching:
|
||||||
|
name: Test pip (Python ${{ matrix.python-version}}, ${{ matrix.os }})
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||||
|
python-version: ['3.7', '3.8', '3.9', 'pypy-3.7-v7.3.5', 'pypy-3.7-v7.x']
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Setup Python
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
python-version: ${{ matrix.python-version }}
|
||||||
|
cache: 'pip'
|
||||||
|
- name: Install dependencies
|
||||||
|
run: pip install numpy pandas requests
|
||||||
|
|
||||||
|
python-pipenv-dependencies-caching:
|
||||||
|
name: Test pipenv (Python ${{ matrix.python-version}}, ${{ matrix.os }})
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||||
|
python-version: ['3.7', '3.8', '3.9', 'pypy-3.7-v7.3.5', 'pypy-3.7-v7.x']
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Install pipenv
|
||||||
|
run: pipx install pipenv
|
||||||
|
- name: Setup Python
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
python-version: ${{ matrix.python-version }}
|
||||||
|
cache: 'pipenv'
|
||||||
|
- name: Install dependencies
|
||||||
|
run: pipenv install flake8
|
||||||
|
|
||||||
|
python-pip-dependencies-caching-path:
|
||||||
|
name: Test pip (Python ${{ matrix.python-version}}, ${{ matrix.os }})
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||||
|
python-version: ['3.7', '3.8', '3.9', 'pypy-3.7-v7.3.5', 'pypy-3.7-v7.x']
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Setup Python
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
python-version: ${{ matrix.python-version }}
|
||||||
|
cache: 'pip'
|
||||||
|
cache-dependency-path: __tests__/data/requirements.txt
|
||||||
|
- name: Install dependencies
|
||||||
|
run: pip install numpy pandas requests
|
||||||
|
|
||||||
|
python-pipenv-dependencies-caching-path:
|
||||||
|
name: Test pipenv (Python ${{ matrix.python-version}}, ${{ matrix.os }})
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||||
|
python-version: ['3.7', '3.8', '3.9', 'pypy-3.7-v7.3.5', 'pypy-3.7-v7.x']
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Install pipenv
|
||||||
|
run: pipx install pipenv
|
||||||
|
- name: Setup Python
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
python-version: ${{ matrix.python-version }}
|
||||||
|
cache: 'pipenv'
|
||||||
|
cache-dependency-path: '**/requirements-linux.txt'
|
||||||
|
- name: Install dependencies
|
||||||
|
run: pipenv install flake8
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
name: Licensed
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
name: Check licenses
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- run: npm ci
|
||||||
|
- name: Install licensed
|
||||||
|
run: |
|
||||||
|
cd $RUNNER_TEMP
|
||||||
|
curl -Lfs -o licensed.tar.gz https://github.com/github/licensed/releases/download/2.12.2/licensed-2.12.2-linux-x64.tar.gz
|
||||||
|
sudo tar -xzf licensed.tar.gz
|
||||||
|
sudo mv licensed /usr/local/bin/licensed
|
||||||
|
- run: licensed status
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
name: Lint YAML
|
|
||||||
on: [pull_request]
|
|
||||||
jobs:
|
|
||||||
lint:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@master
|
|
||||||
- name: Lint action.yml
|
|
||||||
uses: ibiqlik/action-yamllint@master
|
|
||||||
with:
|
|
||||||
file_or_dir: action.yml
|
|
||||||
config_file: yaml-lint-config.yml
|
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
name: Release new action version
|
||||||
|
on:
|
||||||
|
release:
|
||||||
|
types: [released]
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
TAG_NAME:
|
||||||
|
description: 'Tag name that the major tag will point to'
|
||||||
|
required: true
|
||||||
|
|
||||||
|
env:
|
||||||
|
TAG_NAME: ${{ github.event.inputs.TAG_NAME || github.event.release.tag_name }}
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
update_tag:
|
||||||
|
name: Update the major tag to include the ${{ github.event.inputs.TAG_NAME || github.event.release.tag_name }} changes
|
||||||
|
environment:
|
||||||
|
name: releaseNewActionVersion
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Update the ${{ env.TAG_NAME }} tag
|
||||||
|
uses: actions/publish-action@v0.1.0
|
||||||
|
with:
|
||||||
|
source-tag: ${{ env.TAG_NAME }}
|
||||||
|
slack-webhook: ${{ secrets.SLACK_WEBHOOK }}
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
name: Validate PyPy e2e
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
paths-ignore:
|
||||||
|
- '**.md'
|
||||||
|
pull_request:
|
||||||
|
paths-ignore:
|
||||||
|
- '**.md'
|
||||||
|
schedule:
|
||||||
|
- cron: 30 3 * * *
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
setup-pypy:
|
||||||
|
name: Setup PyPy ${{ matrix.pypy }} ${{ matrix.os }}
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os: [macos-latest, windows-latest, ubuntu-18.04, ubuntu-latest]
|
||||||
|
pypy:
|
||||||
|
- 'pypy-2.7'
|
||||||
|
- 'pypy-3.7'
|
||||||
|
- 'pypy-2.7-v7.3.4'
|
||||||
|
- 'pypy-3.7-v7.3.5'
|
||||||
|
- 'pypy-3.7-v7.3.4'
|
||||||
|
- 'pypy-3.7-v7.3.x'
|
||||||
|
- 'pypy-3.7-v7.x'
|
||||||
|
- 'pypy-2.7-v7.3.4rc1'
|
||||||
|
- 'pypy-3.7-nightly'
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: setup-python ${{ matrix.pypy }}
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
python-version: ${{ matrix.pypy }}
|
||||||
|
|
||||||
|
- name: PyPy and Python version
|
||||||
|
run: python --version
|
||||||
|
|
||||||
|
- name: Run simple code
|
||||||
|
run: python -c 'import math; print(math.factorial(5))'
|
||||||
@@ -0,0 +1,113 @@
|
|||||||
|
name: Validate Python e2e
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
paths-ignore:
|
||||||
|
- '**.md'
|
||||||
|
pull_request:
|
||||||
|
paths-ignore:
|
||||||
|
- '**.md'
|
||||||
|
schedule:
|
||||||
|
- cron: 30 3 * * *
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
default-version:
|
||||||
|
name: Setup default version
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os: [macos-latest, windows-latest, ubuntu-18.04, ubuntu-20.04]
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: setup default python
|
||||||
|
uses: ./
|
||||||
|
|
||||||
|
- name: Validate version
|
||||||
|
run: python --version
|
||||||
|
|
||||||
|
- name: Run simple python code
|
||||||
|
run: python -c 'import math; print(math.factorial(5))'
|
||||||
|
|
||||||
|
setup-versions-from-manifest:
|
||||||
|
name: Setup ${{ matrix.python }} ${{ matrix.os }}
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os: [macos-latest, windows-latest, ubuntu-18.04, ubuntu-20.04]
|
||||||
|
python: [3.5.4, 3.6.7, 3.7.5, 3.8.1]
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: setup-python ${{ matrix.python }}
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
python-version: ${{ matrix.python }}
|
||||||
|
|
||||||
|
- name: Validate version
|
||||||
|
run: |
|
||||||
|
$pythonVersion = (python --version)
|
||||||
|
if ("Python ${{ matrix.python }}" -ne "$pythonVersion"){
|
||||||
|
Write-Host "The current version is $pythonVersion; expected version is ${{ matrix.python }}"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
$pythonVersion
|
||||||
|
shell: pwsh
|
||||||
|
|
||||||
|
- name: Run simple code
|
||||||
|
run: python -c 'import math; print(math.factorial(5))'
|
||||||
|
|
||||||
|
setup-pre-release-version-from-manifest:
|
||||||
|
name: Setup 3.9.0-beta.4 ${{ matrix.os }}
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os: [macos-latest, windows-latest, ubuntu-18.04, ubuntu-20.04]
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: setup-python 3.9.0-beta.4
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
python-version: '3.9.0-beta.4'
|
||||||
|
|
||||||
|
- name: Validate version
|
||||||
|
run: |
|
||||||
|
$pythonVersion = (python --version)
|
||||||
|
if ("Python 3.9.0b4" -ne "$pythonVersion"){
|
||||||
|
Write-Host "The current version is $pythonVersion; expected version is 3.9.0b4"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
$pythonVersion
|
||||||
|
shell: pwsh
|
||||||
|
|
||||||
|
- name: Run simple code
|
||||||
|
run: python -c 'import math; print(math.factorial(5))'
|
||||||
|
|
||||||
|
setup-pypy-legacy:
|
||||||
|
name: Setup PyPy ${{ matrix.os }}
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os: [macos-10.15, windows-latest, ubuntu-18.04, ubuntu-20.04]
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: setup-python pypy3
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
python-version: 'pypy3'
|
||||||
|
|
||||||
|
- name: setup-python pypy2
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
python-version: 'pypy2'
|
||||||
@@ -1,5 +1,13 @@
|
|||||||
name: Main workflow
|
name: Main workflow
|
||||||
on: [push, pull_request]
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
paths-ignore:
|
||||||
|
- '**.md'
|
||||||
|
pull_request:
|
||||||
|
paths-ignore:
|
||||||
|
- '**.md'
|
||||||
jobs:
|
jobs:
|
||||||
run:
|
run:
|
||||||
name: Run
|
name: Run
|
||||||
@@ -24,3 +32,59 @@ jobs:
|
|||||||
|
|
||||||
- name: npm test
|
- name: npm test
|
||||||
run: npm test
|
run: npm test
|
||||||
|
|
||||||
|
- name: Run with setup-python 2.7
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
python-version: 2.7
|
||||||
|
- name: Verify 2.7
|
||||||
|
run: python __tests__/verify-python.py 2.7
|
||||||
|
|
||||||
|
- name: Run with setup-python 3.5
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
python-version: 3.5
|
||||||
|
- name: Verify 3.5
|
||||||
|
run: python __tests__/verify-python.py 3.5
|
||||||
|
|
||||||
|
- name: Run with setup-python 3.6
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
python-version: 3.6
|
||||||
|
- name: Verify 3.6
|
||||||
|
run: python __tests__/verify-python.py 3.6
|
||||||
|
|
||||||
|
- name: Run with setup-python 3.7
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
python-version: 3.7
|
||||||
|
- name: Verify 3.7
|
||||||
|
run: python __tests__/verify-python.py 3.7
|
||||||
|
|
||||||
|
- name: Run with setup-python 3.8
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
python-version: 3.8
|
||||||
|
- name: Verify 3.8
|
||||||
|
run: python __tests__/verify-python.py 3.8
|
||||||
|
|
||||||
|
- name: Run with setup-python 3.7.5
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
python-version: 3.7.5
|
||||||
|
- name: Verify 3.7.5
|
||||||
|
run: python __tests__/verify-python.py 3.7.5
|
||||||
|
|
||||||
|
- name: Run with setup-python 3.6.7
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
python-version: 3.6.7
|
||||||
|
- name: Verify 3.6.7
|
||||||
|
run: python __tests__/verify-python.py 3.6.7
|
||||||
|
|
||||||
|
- name: Run with setup-python 3.8.1
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
python-version: 3.8.1
|
||||||
|
- name: Verify 3.8.1
|
||||||
|
run: python __tests__/verify-python.py 3.8.1
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
sources:
|
||||||
|
npm: true
|
||||||
|
|
||||||
|
allowed:
|
||||||
|
- apache-2.0
|
||||||
|
- bsd-2-clause
|
||||||
|
- bsd-3-clause
|
||||||
|
- isc
|
||||||
|
- mit
|
||||||
|
- cc0-1.0
|
||||||
|
- unlicense
|
||||||
|
- 0bsd
|
||||||
|
|
||||||
|
reviewed:
|
||||||
|
npm:
|
||||||
Generated
BIN
Binary file not shown.
Generated
BIN
Binary file not shown.
Generated
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Generated
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Generated
BIN
Binary file not shown.
Generated
BIN
Binary file not shown.
Generated
BIN
Binary file not shown.
Generated
BIN
Binary file not shown.
BIN
Binary file not shown.
Generated
BIN
Binary file not shown.
Generated
BIN
Binary file not shown.
BIN
Binary file not shown.
Generated
BIN
Binary file not shown.
Generated
BIN
Binary file not shown.
Generated
BIN
Binary file not shown.
Generated
BIN
Binary file not shown.
Generated
BIN
Binary file not shown.
Generated
BIN
Binary file not shown.
Generated
BIN
Binary file not shown.
Generated
BIN
Binary file not shown.
Generated
BIN
Binary file not shown.
Generated
BIN
Binary file not shown.
Generated
BIN
Binary file not shown.
Generated
BIN
Binary file not shown.
Generated
BIN
Binary file not shown.
Generated
BIN
Binary file not shown.
Generated
BIN
Binary file not shown.
Generated
BIN
Binary file not shown.
Generated
BIN
Binary file not shown.
Generated
BIN
Binary file not shown.
Generated
BIN
Binary file not shown.
Generated
BIN
Binary file not shown.
Generated
BIN
Binary file not shown.
Generated
BIN
Binary file not shown.
Generated
BIN
Binary file not shown.
Generated
BIN
Binary file not shown.
Generated
BIN
Binary file not shown.
Generated
BIN
Binary file not shown.
Generated
BIN
Binary file not shown.
Generated
BIN
Binary file not shown.
Generated
BIN
Binary file not shown.
Generated
BIN
Binary file not shown.
Generated
BIN
Binary file not shown.
Generated
BIN
Binary file not shown.
Generated
BIN
Binary file not shown.
Generated
BIN
Binary file not shown.
Generated
BIN
Binary file not shown.
Generated
BIN
Binary file not shown.
Generated
BIN
Binary file not shown.
Generated
BIN
Binary file not shown.
Generated
BIN
Binary file not shown.
Generated
BIN
Binary file not shown.
@@ -1,4 +1,4 @@
|
|||||||
# setup-python
|
# setup-python V2
|
||||||
|
|
||||||
<p align="left">
|
<p align="left">
|
||||||
<a href="https://github.com/actions/setup-python"><img alt="GitHub Actions status" src="https://github.com/actions/setup-python/workflows/Main%20workflow/badge.svg"></a>
|
<a href="https://github.com/actions/setup-python"><img alt="GitHub Actions status" src="https://github.com/actions/setup-python/workflows/Main%20workflow/badge.svg"></a>
|
||||||
@@ -6,8 +6,20 @@
|
|||||||
|
|
||||||
This action sets up a Python environment for use in actions by:
|
This action sets up a Python environment for use in actions by:
|
||||||
|
|
||||||
- optionally installing a version of Python and adding to PATH. Note that this action only uses versions of Python already installed in the cache. The action will fail if no matching versions are found.
|
- optionally installing and adding to PATH a version of Python that is already installed in the tools cache.
|
||||||
- registering problem matchers for error output
|
- downloading, installing and adding to PATH an available version of Python from GitHub Releases ([actions/python-versions](https://github.com/actions/python-versions/releases)) if a specific version is not available in the tools cache.
|
||||||
|
- failing if a specific version of Python is not preinstalled or available for download.
|
||||||
|
- optionally caching dependencies for pip and pipenv.
|
||||||
|
- registering problem matchers for error output.
|
||||||
|
|
||||||
|
# What's new
|
||||||
|
|
||||||
|
- Ability to download, install and set up Python packages from `actions/python-versions` that do not come preinstalled on runners.
|
||||||
|
- Allows for pinning to a specific patch version of Python without the worry of it ever being removed or changed.
|
||||||
|
- Automatic setup and download of Python packages if using a self-hosted runner.
|
||||||
|
- Support for pre-release versions of Python.
|
||||||
|
- Support for installing any version of PyPy on-flight
|
||||||
|
- Support for built-in caching of pip and pipenv dependencies
|
||||||
|
|
||||||
# Usage
|
# Usage
|
||||||
|
|
||||||
@@ -17,7 +29,7 @@ Basic:
|
|||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- uses: actions/setup-python@v1
|
- uses: actions/setup-python@v2
|
||||||
with:
|
with:
|
||||||
python-version: '3.x' # Version range or exact version of a Python version to use, using SemVer's version range syntax
|
python-version: '3.x' # Version range or exact version of a Python version to use, using SemVer's version range syntax
|
||||||
architecture: 'x64' # optional x64 or x86. Defaults to x64 if not specified
|
architecture: 'x64' # optional x64 or x86. Defaults to x64 if not specified
|
||||||
@@ -31,12 +43,12 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
python-version: [ '2.x', '3.x', 'pypy2', 'pypy3' ]
|
python-version: [ '2.x', '3.x', 'pypy-2.7', 'pypy-3.6', 'pypy-3.7' ]
|
||||||
name: Python ${{ matrix.python-version }} sample
|
name: Python ${{ matrix.python-version }} sample
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- name: Setup python
|
- name: Set up Python
|
||||||
uses: actions/setup-python@v1
|
uses: actions/setup-python@v2
|
||||||
with:
|
with:
|
||||||
python-version: ${{ matrix.python-version }}
|
python-version: ${{ matrix.python-version }}
|
||||||
architecture: x64
|
architecture: x64
|
||||||
@@ -51,29 +63,114 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, macos-latest, windows-latest]
|
os: [ubuntu-latest, macos-latest, windows-latest]
|
||||||
python-version: [2.7, 3.6, 3.7, 3.8, pypy2, pypy3]
|
python-version: ['2.7', '3.6', '3.7', '3.8', 'pypy-2.7', 'pypy-3.6']
|
||||||
exclude:
|
exclude:
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
python-version: 3.8
|
python-version: '3.8'
|
||||||
- os: windows-latest
|
- os: windows-latest
|
||||||
python-version: 3.6
|
python-version: '3.6'
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- name: Set up Python
|
- name: Set up Python
|
||||||
uses: actions/setup-python@v1
|
uses: actions/setup-python@v2
|
||||||
with:
|
with:
|
||||||
python-version: ${{ matrix.python-version }}
|
python-version: ${{ matrix.python-version }}
|
||||||
- name: Display Python version
|
- name: Display Python version
|
||||||
run: python -c "import sys; print(sys.version)"
|
run: python -c "import sys; print(sys.version)"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Download and set up a version of Python that does not come preinstalled on an image:
|
||||||
|
```yaml
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
# in this example, there is a newer version already installed, 3.7.7, so the older version will be downloaded
|
||||||
|
python-version: ['3.5', '3.6', '3.7.4', '3.8']
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- uses: actions/setup-python@v2
|
||||||
|
with:
|
||||||
|
python-version: ${{ matrix.python-version }}
|
||||||
|
- run: python my_script.py
|
||||||
|
```
|
||||||
|
|
||||||
|
Download and set up an accurate pre-release version of Python:
|
||||||
|
```yaml
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- uses: actions/setup-python@v2
|
||||||
|
with:
|
||||||
|
python-version: '3.9.0-beta.4'
|
||||||
|
- run: python my_script.py
|
||||||
|
```
|
||||||
|
|
||||||
|
Download and set up the latest available version of Python (includes both pre-release and stable versions):
|
||||||
|
```yaml
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- uses: actions/setup-python@v2
|
||||||
|
with:
|
||||||
|
python-version: '3.9.0-alpha - 3.9.0' # SemVer's version range syntax
|
||||||
|
- run: python my_script.py
|
||||||
|
```
|
||||||
|
|
||||||
|
Download and set up PyPy:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
python-version:
|
||||||
|
- 'pypy-3.6' # the latest available version of PyPy that supports Python 3.6
|
||||||
|
- 'pypy-3.7' # the latest available version of PyPy that supports Python 3.7
|
||||||
|
- 'pypy-3.7-v7.3.3' # Python 3.7 and PyPy 7.3.3
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- uses: actions/setup-python@v2
|
||||||
|
with:
|
||||||
|
python-version: ${{ matrix.python-version }}
|
||||||
|
- run: python my_script.py
|
||||||
|
```
|
||||||
|
More details on PyPy syntax and examples of using preview / nightly versions of PyPy can be found in the [Available versions of PyPy](#available-versions-of-pypy) section.
|
||||||
|
|
||||||
# Getting started with Python + Actions
|
# Getting started with Python + Actions
|
||||||
|
|
||||||
Check out our detailed guide on using [Python with GitHub Actions](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/using-python-with-github-actions).
|
Check out our detailed guide on using [Python with GitHub Actions](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/using-python-with-github-actions).
|
||||||
|
|
||||||
|
# Available versions of Python
|
||||||
|
|
||||||
|
`setup-python` is able to configure Python from two sources:
|
||||||
|
|
||||||
|
- Preinstalled versions of Python in the tools cache on GitHub-hosted runners.
|
||||||
|
- For detailed information regarding the available versions of Python that are installed see [Supported software](https://docs.github.com/en/actions/reference/specifications-for-github-hosted-runners#supported-software).
|
||||||
|
- For every minor version of Python, expect only the latest patch to be preinstalled.
|
||||||
|
- If `3.8.1` is installed for example, and `3.8.2` is released, expect `3.8.1` to be removed and replaced by `3.8.2` in the tools cache.
|
||||||
|
- If the exact patch version doesn't matter to you, specifying just the major and minor version will get you the latest preinstalled patch version. In the previous example, the version spec `3.8` will use the `3.8.2` Python version found in the cache.
|
||||||
|
- Downloadable Python versions from GitHub Releases ([actions/python-versions](https://github.com/actions/python-versions/releases)).
|
||||||
|
- All available versions are listed in the [version-manifest.json](https://github.com/actions/python-versions/blob/main/versions-manifest.json) file.
|
||||||
|
- If there is a specific version of Python that is not available, you can open an issue here
|
||||||
|
|
||||||
|
# Available versions of PyPy
|
||||||
|
|
||||||
|
`setup-python` is able to configure PyPy from two sources:
|
||||||
|
|
||||||
|
- Preinstalled versions of PyPy in the tools cache on GitHub-hosted runners
|
||||||
|
- For detailed information regarding the available versions of PyPy that are installed see [Supported software](https://docs.github.com/en/actions/reference/specifications-for-github-hosted-runners#supported-software).
|
||||||
|
- For the latest PyPy release, all versions of Python are cached.
|
||||||
|
- Cache is updated with a 1-2 week delay. If you specify the PyPy version as `pypy-3.6`, the cached version will be used although a newer version is available. If you need to start using the recently released version right after release, you should specify the exact PyPy version using `pypy-3.6-v7.3.3`.
|
||||||
|
|
||||||
|
- Downloadable PyPy versions from the [official PyPy site](https://downloads.python.org/pypy/).
|
||||||
|
- All available versions that we can download are listed in [versions.json](https://downloads.python.org/pypy/versions.json) file.
|
||||||
|
- PyPy < 7.3.3 are not available to install on-flight.
|
||||||
|
- If some versions are not available, you can open an issue in https://foss.heptapod.net/pypy/pypy/
|
||||||
|
|
||||||
# Hosted Tool Cache
|
# Hosted Tool Cache
|
||||||
|
|
||||||
GitHub hosted runners have a tools cache that comes with Python + PyPy already installed. This tools cache helps speed up runs and tool setup by not requiring any new downloads. There is an environment variable called `RUNNER_TOOL_CACHE` on each runner that describes the location of this tools cache and there is where you will find Python and PyPy installed. `setup-python` works by taking a specific version of Python or PyPy in this tools cache and adding it to PATH.
|
GitHub hosted runners have a tools cache that comes with a few versions of Python + PyPy already installed. This tools cache helps speed up runs and tool setup by not requiring any new downloads. There is an environment variable called `RUNNER_TOOL_CACHE` on each runner that describes the location of this tools cache and there is where you will find Python and PyPy installed. `setup-python` works by taking a specific version of Python or PyPy in this tools cache and adding it to PATH.
|
||||||
|
|
||||||
|| Location |
|
|| Location |
|
||||||
|------|-------|
|
|------|-------|
|
||||||
@@ -82,38 +179,156 @@ GitHub hosted runners have a tools cache that comes with Python + PyPy already i
|
|||||||
|**PyPy Tool Cache**|`RUNNER_TOOL_CACHE/PyPy/*`|
|
|**PyPy Tool Cache**|`RUNNER_TOOL_CACHE/PyPy/*`|
|
||||||
|
|
||||||
GitHub virtual environments are setup in [actions/virtual-environments](https://github.com/actions/virtual-environments). During the setup, the available versions of Python and PyPy are automatically downloaded, setup and documented.
|
GitHub virtual environments are setup in [actions/virtual-environments](https://github.com/actions/virtual-environments). During the setup, the available versions of Python and PyPy are automatically downloaded, setup and documented.
|
||||||
- [Tools cache setup for Ubuntu](https://github.com/actions/virtual-environments/blob/master/images/linux/scripts/installers/hosted-tool-cache.sh)
|
- [Tools cache setup for Ubuntu](https://github.com/actions/virtual-environments/blob/main/images/linux/scripts/installers/hosted-tool-cache.sh)
|
||||||
- [Tools cache setup for Windows](https://github.com/actions/virtual-environments/blob/master/images/win/scripts/Installers/Download-ToolCache.ps1)
|
- [Tools cache setup for Windows](https://github.com/actions/virtual-environments/blob/main/images/win/scripts/Installers/Download-ToolCache.ps1)
|
||||||
|
|
||||||
|
# Specifying a Python version
|
||||||
|
|
||||||
|
If there is a specific version of Python that you need and you don't want to worry about any potential breaking changes due to patch updates (going from `3.7.5` to `3.7.6` for example), you should specify the exact major, minor, and patch version (such as `3.7.5`)
|
||||||
|
- The only downside to this is that set up will take a little longer since the exact version will have to be downloaded if the exact version is not already installed on the runner due to more recent versions.
|
||||||
|
- MSI installers are used on Windows for this, so runs will take a little longer to set up vs Mac and Linux.
|
||||||
|
|
||||||
|
You should specify only a major and minor version if you are okay with the most recent patch version being used.
|
||||||
|
- There will be a single patch version already installed on each runner for every minor version of Python that is supported.
|
||||||
|
- The patch version that will be preinstalled, will generally be the latest and every time there is a new patch released, the older version that is preinstalled will be replaced.
|
||||||
|
- Using the most recent patch version will result in a very quick setup since no downloads will be required since a locally installed version Python on the runner will be used.
|
||||||
|
|
||||||
|
# Specifying a PyPy version
|
||||||
|
The version of PyPy should be specified in the format `pypy-<python_version>[-v<pypy_version>]`.
|
||||||
|
The `<pypy_version>` parameter is optional and can be skipped. The latest version will be used in this case.
|
||||||
|
|
||||||
|
```
|
||||||
|
pypy-3.6 # the latest available version of PyPy that supports Python 3.6
|
||||||
|
pypy-3.7 # the latest available version of PyPy that supports Python 3.7
|
||||||
|
pypy-2.7 # the latest available version of PyPy that supports Python 2.7
|
||||||
|
pypy-3.7-v7.3.3 # Python 3.7 and PyPy 7.3.3
|
||||||
|
pypy-3.7-v7.x # Python 3.7 and the latest available PyPy 7.x
|
||||||
|
pypy-3.7-v7.3.3rc1 # Python 3.7 and preview version of PyPy
|
||||||
|
pypy-3.7-nightly # Python 3.7 and nightly PyPy
|
||||||
|
```
|
||||||
|
|
||||||
|
# Caching packages dependencies
|
||||||
|
|
||||||
|
The action has built-in functionality for caching and restoring dependencies. It uses [actions/cache](https://github.com/actions/toolkit/tree/main/packages/cache) under the hood for caching dependencies but requires less configuration settings. Supported package managers are `pip` and `pipenv`. The `cache` input is optional, and caching is turned off by default.
|
||||||
|
|
||||||
|
The action defaults to searching for a dependency file (`requirements.txt` for pip or `Pipfile.lock` for pipenv) in the repository, and uses its hash as a part of the cache key. Use `cache-dependency-path` for cases where multiple dependency files are used, they are located in different subdirectories or different files for the hash want to be used.
|
||||||
|
|
||||||
|
- For pip, the action will cache global cache directory
|
||||||
|
- For pipenv, the action will cache virtualenv directory
|
||||||
|
|
||||||
|
**Please Note:** Restored cache will not be used if the requirements.txt file is not updated for a long time and a newer version of the dependency is available that can lead to an increase in total build time.
|
||||||
|
|
||||||
|
The requirements file format allows to specify dependency versions using logical operators (for example chardet>=3.0.4) or specify dependencies without any versions. In this case the pip install -r requirements.txt command will always try to install the latest available package version. To be sure that the cache will be used, please stick to a specific dependency version and update it manually if necessary.
|
||||||
|
|
||||||
|
**Caching pip dependencies:**
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- uses: actions/setup-python@v2
|
||||||
|
with:
|
||||||
|
python-version: '3.9'
|
||||||
|
cache: 'pip'
|
||||||
|
- run: pip install -r requirements.txt
|
||||||
|
- run: pip test
|
||||||
|
```
|
||||||
|
|
||||||
|
**Caching pipenv dependencies:**
|
||||||
|
```yaml
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Install pipenv
|
||||||
|
run: pipx install pipenv
|
||||||
|
- uses: actions/setup-python@v2
|
||||||
|
with:
|
||||||
|
python-version: '3.9'
|
||||||
|
cache: 'pipenv'
|
||||||
|
- run: pipenv install
|
||||||
|
- run: pipenv test
|
||||||
|
```
|
||||||
|
|
||||||
|
**Using wildcard patterns to cache dependencies**
|
||||||
|
```yaml
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- uses: actions/setup-python@v2
|
||||||
|
with:
|
||||||
|
python-version: '3.9'
|
||||||
|
cache: 'pip'
|
||||||
|
cache-dependency-path: '**/requirements-dev.txt'
|
||||||
|
- run: pip install -r subdirectory/requirements-dev.txt
|
||||||
|
- run: pip test
|
||||||
|
```
|
||||||
|
|
||||||
|
**Using a list of file paths to cache dependencies**
|
||||||
|
```yaml
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Install pipenv
|
||||||
|
run: pipx install pipenv
|
||||||
|
- uses: actions/setup-python@v2
|
||||||
|
with:
|
||||||
|
python-version: '3.9'
|
||||||
|
cache: 'pipenv'
|
||||||
|
cache-dependency-path: |
|
||||||
|
server/app/Pipfile.lock
|
||||||
|
__test__/app/Pipfile.lock
|
||||||
|
- run: pipenv install
|
||||||
|
- run: pipenv test
|
||||||
|
```
|
||||||
|
|
||||||
# Using `setup-python` with a self hosted runner
|
# Using `setup-python` with a self hosted runner
|
||||||
|
|
||||||
If you would like to use `setup-python` on a self-hosted runner, you will need to download all versions of Python & PyPy that you would like and setup a similar tools cache locally for your runner.
|
Python distributions are only available for the same [environments](https://github.com/actions/virtual-environments#available-environments) that GitHub Actions hosted environments are available for. If you are using an unsupported version of Ubuntu such as `19.04` or another Linux distribution such as Fedora, `setup-python` will not work. If you have a supported self-hosted runner and you would like to use `setup-python`, there are a few extra things you need to make sure are set up so that new versions of Python can be downloaded and configured on your runner.
|
||||||
|
|
||||||
|
If you are experiencing problems while configuring Python on your self-hosted runner, turn on [step debugging](https://github.com/actions/toolkit/blob/main/docs/action-debugging.md#step-debug-logs) to see addition logs.
|
||||||
|
|
||||||
|
### Windows
|
||||||
|
|
||||||
|
- Your runner needs to be running with administrator privileges so that the appropriate directories and files can be set up when downloading and installing a new version of Python for the first time.
|
||||||
|
- If your runner is configured as a service, make sure the account that is running the service has the appropriate write permissions so that Python can get installed. The default `NT AUTHORITY\NETWORK SERVICE` should be sufficient.
|
||||||
|
- You need `7zip` installed and added to your `PATH` so that the downloaded versions of Python files can be extracted properly during first-time setup.
|
||||||
|
- MSI installers are used when setting up Python on Windows. A word of caution as MSI installers update registry settings.
|
||||||
|
- The 3.8 MSI installer for Windows will not let you install another 3.8 version of Python. If `setup-python` fails for a 3.8 version of Python, make sure any previously installed versions are removed by going to "Apps & Features" in the Settings app.
|
||||||
|
|
||||||
|
### Linux
|
||||||
|
|
||||||
|
- The Python packages that are downloaded from `actions/python-versions` are originally compiled from source in `/opt/hostedtoolcache/` with the [--enable-shared](https://github.com/actions/python-versions/blob/94f04ae6806c6633c82db94c6406a16e17decd5c/builders/ubuntu-python-builder.psm1#L35) flag, which makes them non-relocatable.
|
||||||
|
- Create an environment variable called `AGENT_TOOLSDIRECTORY` and set it to `/opt/hostedtoolcache`. This controls where the runner downloads and installs tools.
|
||||||
|
- In the same shell that your runner is using, type `export AGENT_TOOLSDIRECTORY=/opt/hostedtoolcache`.
|
||||||
|
- A more permanent way of setting the environment variable is to create a `.env` file in the same directory as your runner and to add `AGENT_TOOLSDIRECTORY=/opt/hostedtoolcache`. This ensures the variable is always set if your runner is configured as a service.
|
||||||
|
- Create a directory called `hostedtoolcache` inside `/opt`.
|
||||||
|
- The user starting the runner must have write permission to the `/opt/hostedtoolcache` directory. It is not possible to start the Linux runner with `sudo` and the `/opt` directory usually requires root privileges to write to. Check the current user and group that the runner belongs to by typing `ls -l` inside the runners root directory.
|
||||||
|
- The runner can be granted write access to the `/opt/hostedtoolcache` directory using a few techniques:
|
||||||
|
- The user starting the runner is the owner, and the owner has write permission.
|
||||||
|
- The user starting the runner is in the owning group, and the owning group has write permission.
|
||||||
|
- All users have write permission.
|
||||||
|
- One quick way to grant access is to change the user and group of `/opt/hostedtoolcache` to be the same as the runners using `chown`.
|
||||||
|
- `sudo chown runner-user:runner-group opt/hostedtoolcache/`.
|
||||||
|
- If your runner is configured as a service and you run into problems, make sure the user that the service is running as is correct. For more information, you can [check the status of your self-hosted runner](https://help.github.com/en/actions/hosting-your-own-runners/configuring-the-self-hosted-runner-application-as-a-service#checking-the-status-of-the-service).
|
||||||
|
|
||||||
|
### Mac
|
||||||
|
|
||||||
|
- The same setup that applies to `Linux` also applies to `Mac`, just with a different tools cache directory.
|
||||||
|
- Create a directory called `/Users/runner/hostedtoolcache`.
|
||||||
|
- Set the `AGENT_TOOLSDIRECTORY` environment variable to `/Users/runner/hostedtoolcache`.
|
||||||
|
- Change the permissions of `/Users/runner/hostedtoolcache` so that the runner has write access.
|
||||||
|
|
||||||
- Create an global environment variable called `AGENT_TOOLSDIRECTORY` that will point to the root directory of where you want the tools installed. The env variable is preferrably global as it must be set in the shell that will install the tools cache, along with the shell that the runner will be using.
|
|
||||||
- This env variable is used internally by the runner to set the `RUNNER_TOOL_CACHE` env variable
|
|
||||||
- Example for Administrator Powershell: `[System.Environment]::SetEnvironmentVariable("AGENT_TOOLSDIRECTORY", "C:\hostedtoolcache\windows", [System.EnvironmentVariableTarget]::Machine)` (restart the shell afterwards)
|
|
||||||
- Download the appropriate NPM packages from the [GitHub Actions NPM registry](https://github.com/orgs/actions/packages)
|
|
||||||
- Make sure to have `npm` installed, and then [configure npm for use with GitHub packages](https://help.github.com/en/packages/using-github-packages-with-your-projects-ecosystem/configuring-npm-for-use-with-github-packages#authenticating-to-github-package-registry)
|
|
||||||
- Create an empty npm project for easier installation (`npm init`) in the tools cache directory. You can delete `package.json`, `package.lock.json` and `node_modules` after all tools get installed
|
|
||||||
- Before downloading a specific package, create an empty folder for the version of Python/PyPY that is being installed. If downloading Python 3.6.8 for example, create `C:\hostedtoolcache\windows\Python\3.6.8`
|
|
||||||
- Once configured, download a specific package by calling `npm install`. Note (if downloading a PyPy package on Windows, you will need 7zip installed along with `7z.exe` added to your PATH)
|
|
||||||
- Each NPM package has multiple versions that determine the version of Python or PyPy that should be installed.
|
|
||||||
- `npm install @actions/toolcache-python-windows-x64@3.7.61579791175` for example installs Python 3.7.6 while `npm install @actions/toolcache-python-windows-x64@3.6.81579791177` installs Python 3.6.8
|
|
||||||
- You can browse and find all available versions of a package by searching the GitHub Actions NPM registry
|
|
||||||

|
|
||||||
|
|
||||||
# Using Python without `setup-python`
|
# Using Python without `setup-python`
|
||||||
|
|
||||||
`setup-python` helps keep your dependencies explicit and ensures consistent behavior between different runners. If you use `python` in a shell on a GitHub hosted runner without `setup-python` it will default to whatever is in PATH. The default version of Python in PATH vary between runners and can change unexpectedly so we recommend you always use `setup-python`.
|
`setup-python` helps keep your dependencies explicit and ensures consistent behavior between different runners. If you use `python` in a shell on a GitHub hosted runner without `setup-python` it will default to whatever is in PATH. The default version of Python in PATH vary between runners and can change unexpectedly so we recommend you always use `setup-python`.
|
||||||
|
|
||||||
# Available versions of Python
|
# Using `setup-python` on GHES
|
||||||
|
|
||||||
For detailed information regarding the available versions of Python that are installed see [Software installed on GitHub-hosted runners](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/software-installed-on-github-hosted-runners)
|
`setup-python` comes pre-installed on the appliance with GHES if Actions is enabled. When dynamically downloading Python distributions, `setup-python` downloads distributions from [`actions/python-versions`](https://github.com/actions/python-versions) on github.com (outside of the appliance). These calls to `actions/python-versions` are made via unauthenticated requests, which are limited to [60 requests per hour per IP](https://docs.github.com/en/rest/overview/resources-in-the-rest-api#rate-limiting). If more requests are made within the time frame, then you will start to see rate-limit errors during download that read `##[error]API rate limit exceeded for...`.
|
||||||
|
|
||||||
|
To avoid hitting rate-limit problems, we recommend [setting up your own runner tool cache](https://docs.github.com/en/enterprise-server@2.22/admin/github-actions/managing-access-to-actions-from-githubcom/setting-up-the-tool-cache-on-self-hosted-runners-without-internet-access#about-the-included-setup-actions-and-the-runner-tool-cache).
|
||||||
|
|
||||||
# License
|
# License
|
||||||
|
|
||||||
The scripts and documentation in this project are released under the [MIT License](LICENSE)
|
The scripts and documentation in this project are released under the [MIT License](LICENSE).
|
||||||
|
|
||||||
# Contributions
|
# Contributions
|
||||||
|
|
||||||
Contributions are welcome! See [Contributor's Guide](docs/contributors.md)
|
Contributions are welcome! See our [Contributor's Guide](docs/contributors.md).
|
||||||
|
|||||||
@@ -0,0 +1,175 @@
|
|||||||
|
import * as core from '@actions/core';
|
||||||
|
import * as cache from '@actions/cache';
|
||||||
|
import * as exec from '@actions/exec';
|
||||||
|
import {getCacheDistributor} from '../src/cache-distributions/cache-factory';
|
||||||
|
|
||||||
|
describe('restore-cache', () => {
|
||||||
|
const pipFileLockHash =
|
||||||
|
'67d817abcde9c72da0ed5b8f235647cb14638b9ff9d742b42e4406d2eb16fe3c';
|
||||||
|
const requirementsHash =
|
||||||
|
'd8110e0006d7fb5ee76365d565eef9d37df1d11598b912d3eb66d398d57a1121';
|
||||||
|
const requirementsLinuxHash =
|
||||||
|
'2d0ff7f46b0e120e3d3294db65768b474934242637b9899b873e6283dfd16d7c';
|
||||||
|
|
||||||
|
// core spy
|
||||||
|
let infoSpy: jest.SpyInstance;
|
||||||
|
let warningSpy: jest.SpyInstance;
|
||||||
|
let debugSpy: jest.SpyInstance;
|
||||||
|
let saveSatetSpy: jest.SpyInstance;
|
||||||
|
let getStateSpy: jest.SpyInstance;
|
||||||
|
|
||||||
|
// cache spy
|
||||||
|
let restoreCacheSpy: jest.SpyInstance;
|
||||||
|
|
||||||
|
// exec spy
|
||||||
|
let getExecOutputSpy: jest.SpyInstance;
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
process.env['RUNNER_OS'] = process.env['RUNNER_OS'] ?? 'linux';
|
||||||
|
|
||||||
|
infoSpy = jest.spyOn(core, 'info');
|
||||||
|
infoSpy.mockImplementation(input => undefined);
|
||||||
|
|
||||||
|
warningSpy = jest.spyOn(core, 'warning');
|
||||||
|
warningSpy.mockImplementation(input => undefined);
|
||||||
|
|
||||||
|
debugSpy = jest.spyOn(core, 'debug');
|
||||||
|
debugSpy.mockImplementation(input => undefined);
|
||||||
|
|
||||||
|
saveSatetSpy = jest.spyOn(core, 'saveState');
|
||||||
|
saveSatetSpy.mockImplementation(input => undefined);
|
||||||
|
|
||||||
|
getStateSpy = jest.spyOn(core, 'getState');
|
||||||
|
getStateSpy.mockImplementation(input => undefined);
|
||||||
|
|
||||||
|
getExecOutputSpy = jest.spyOn(exec, 'getExecOutput');
|
||||||
|
getExecOutputSpy.mockImplementation((input: string) => {
|
||||||
|
if (input.includes('pip')) {
|
||||||
|
return {stdout: 'pip', stderr: '', exitCode: 0};
|
||||||
|
}
|
||||||
|
|
||||||
|
return {stdout: '', stderr: 'Error occured', exitCode: 2};
|
||||||
|
});
|
||||||
|
|
||||||
|
restoreCacheSpy = jest.spyOn(cache, 'restoreCache');
|
||||||
|
restoreCacheSpy.mockImplementation(
|
||||||
|
(cachePaths: string[], primaryKey: string, restoreKey?: string) => {
|
||||||
|
return primaryKey;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('Validate provided package manager', () => {
|
||||||
|
it.each(['npm', 'pip2', 'pip21', 'pip21.3', 'pipenv32'])(
|
||||||
|
'Throw an error because %s is not supported',
|
||||||
|
async packageManager => {
|
||||||
|
expect(() =>
|
||||||
|
getCacheDistributor(packageManager, '3.8.12', undefined)
|
||||||
|
).toThrowError(`Caching for '${packageManager}' is not supported`);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('Restore dependencies', () => {
|
||||||
|
it.each([
|
||||||
|
['pip', '3.8.12', undefined, requirementsHash],
|
||||||
|
['pip', '3.8.12', '**/requirements-linux.txt', requirementsLinuxHash],
|
||||||
|
[
|
||||||
|
'pip',
|
||||||
|
'3.8.12',
|
||||||
|
'__tests__/data/requirements-linux.txt',
|
||||||
|
requirementsLinuxHash
|
||||||
|
],
|
||||||
|
['pip', '3.8.12', '__tests__/data/requirements.txt', requirementsHash],
|
||||||
|
['pipenv', '3.9.1', undefined, pipFileLockHash],
|
||||||
|
['pipenv', '3.9.12', '__tests__/data/requirements.txt', requirementsHash]
|
||||||
|
])(
|
||||||
|
'restored dependencies for %s by primaryKey',
|
||||||
|
async (packageManager, pythonVersion, dependencyFile, fileHash) => {
|
||||||
|
const cacheDistributor = await getCacheDistributor(
|
||||||
|
packageManager,
|
||||||
|
pythonVersion,
|
||||||
|
dependencyFile
|
||||||
|
);
|
||||||
|
await cacheDistributor.restoreCache();
|
||||||
|
let pythonKey = '';
|
||||||
|
if (packageManager === 'pipenv') {
|
||||||
|
pythonKey = `python-${pythonVersion}-`;
|
||||||
|
}
|
||||||
|
|
||||||
|
expect(infoSpy).toHaveBeenCalledWith(
|
||||||
|
`Cache restored from key: setup-python-${process.env['RUNNER_OS']}-${pythonKey}${packageManager}-${fileHash}`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
it.each([
|
||||||
|
['pip', '3.8.12', 'requirements-linux.txt', 'requirements-linux.txt'],
|
||||||
|
['pip', '3.8.12', 'requirements.txt', 'requirements.txt'],
|
||||||
|
['pipenv', '3.9.12', 'requirements.txt', 'requirements.txt']
|
||||||
|
])(
|
||||||
|
'Should throw an error because dependency file is not found',
|
||||||
|
async (
|
||||||
|
packageManager,
|
||||||
|
pythonVersion,
|
||||||
|
dependencyFile,
|
||||||
|
cacheDependencyPath
|
||||||
|
) => {
|
||||||
|
const cacheDistributor = await getCacheDistributor(
|
||||||
|
packageManager,
|
||||||
|
pythonVersion,
|
||||||
|
dependencyFile
|
||||||
|
);
|
||||||
|
await expect(cacheDistributor.restoreCache()).rejects.toThrowError(
|
||||||
|
`No file in ${process.cwd()} matched to [${cacheDependencyPath
|
||||||
|
.split('\n')
|
||||||
|
.join(',')}], make sure you have checked out the target repository`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('Dependencies changed', () => {
|
||||||
|
it.each([
|
||||||
|
['pip', '3.8.12', undefined, pipFileLockHash],
|
||||||
|
['pip', '3.8.12', '**/requirements-linux.txt', pipFileLockHash],
|
||||||
|
[
|
||||||
|
'pip',
|
||||||
|
'3.8.12',
|
||||||
|
'__tests__/data/requirements-linux.txt',
|
||||||
|
pipFileLockHash
|
||||||
|
],
|
||||||
|
['pip', '3.8.12', '__tests__/data/requirements.txt', pipFileLockHash],
|
||||||
|
['pipenv', '3.9.1', undefined, requirementsHash],
|
||||||
|
['pipenv', '3.9.12', '__tests__/data/requirements.txt', requirementsHash]
|
||||||
|
])(
|
||||||
|
'restored dependencies for %s by primaryKey',
|
||||||
|
async (packageManager, pythonVersion, dependencyFile, fileHash) => {
|
||||||
|
restoreCacheSpy.mockImplementation(
|
||||||
|
(cachePaths: string[], primaryKey: string, restoreKey?: string) => {
|
||||||
|
return primaryKey !== fileHash && restoreKey ? pipFileLockHash : '';
|
||||||
|
}
|
||||||
|
);
|
||||||
|
const cacheDistributor = await getCacheDistributor(
|
||||||
|
packageManager,
|
||||||
|
pythonVersion,
|
||||||
|
dependencyFile
|
||||||
|
);
|
||||||
|
await cacheDistributor.restoreCache();
|
||||||
|
let result = '';
|
||||||
|
if (packageManager !== 'pipenv') {
|
||||||
|
result = `Cache restored from key: ${fileHash}`;
|
||||||
|
} else {
|
||||||
|
result = 'pipenv cache is not found';
|
||||||
|
}
|
||||||
|
|
||||||
|
expect(infoSpy).toHaveBeenCalledWith(result);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
afterEach(() => {
|
||||||
|
jest.resetAllMocks();
|
||||||
|
jest.clearAllMocks();
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -0,0 +1,178 @@
|
|||||||
|
import * as core from '@actions/core';
|
||||||
|
import * as cache from '@actions/cache';
|
||||||
|
import * as exec from '@actions/exec';
|
||||||
|
import {run} from '../src/cache-save';
|
||||||
|
import {State} from '../src/cache-distributions/cache-distributor';
|
||||||
|
|
||||||
|
describe('run', () => {
|
||||||
|
const pipFileLockHash =
|
||||||
|
'67d817abcde9c72da0ed5b8f235647cb14638b9ff9d742b42e4406d2eb16fe3c';
|
||||||
|
const requirementsHash =
|
||||||
|
'd8110e0006d7fb5ee76365d565eef9d37df1d11598b912d3eb66d398d57a1121';
|
||||||
|
const requirementsLinuxHash =
|
||||||
|
'2d0ff7f46b0e120e3d3294db65768b474934242637b9899b873e6283dfd16d7c';
|
||||||
|
|
||||||
|
// core spy
|
||||||
|
let infoSpy: jest.SpyInstance;
|
||||||
|
let warningSpy: jest.SpyInstance;
|
||||||
|
let debugSpy: jest.SpyInstance;
|
||||||
|
let saveSatetSpy: jest.SpyInstance;
|
||||||
|
let getStateSpy: jest.SpyInstance;
|
||||||
|
let getInputSpy: jest.SpyInstance;
|
||||||
|
let setFailedSpy: jest.SpyInstance;
|
||||||
|
|
||||||
|
// cache spy
|
||||||
|
let saveCacheSpy: jest.SpyInstance;
|
||||||
|
|
||||||
|
// exec spy
|
||||||
|
let getExecOutputSpy: jest.SpyInstance;
|
||||||
|
|
||||||
|
let inputs = {} as any;
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
process.env['RUNNER_OS'] = process.env['RUNNER_OS'] ?? 'linux';
|
||||||
|
|
||||||
|
infoSpy = jest.spyOn(core, 'info');
|
||||||
|
infoSpy.mockImplementation(input => undefined);
|
||||||
|
|
||||||
|
warningSpy = jest.spyOn(core, 'warning');
|
||||||
|
warningSpy.mockImplementation(input => undefined);
|
||||||
|
|
||||||
|
debugSpy = jest.spyOn(core, 'debug');
|
||||||
|
debugSpy.mockImplementation(input => undefined);
|
||||||
|
|
||||||
|
saveSatetSpy = jest.spyOn(core, 'saveState');
|
||||||
|
saveSatetSpy.mockImplementation(input => undefined);
|
||||||
|
|
||||||
|
getStateSpy = jest.spyOn(core, 'getState');
|
||||||
|
getStateSpy.mockImplementation(input => {
|
||||||
|
if (input === State.CACHE_PATHS) {
|
||||||
|
return JSON.stringify([__dirname]);
|
||||||
|
}
|
||||||
|
return requirementsHash;
|
||||||
|
});
|
||||||
|
|
||||||
|
setFailedSpy = jest.spyOn(core, 'setFailed');
|
||||||
|
|
||||||
|
getInputSpy = jest.spyOn(core, 'getInput');
|
||||||
|
getInputSpy.mockImplementation(input => inputs[input]);
|
||||||
|
|
||||||
|
getExecOutputSpy = jest.spyOn(exec, 'getExecOutput');
|
||||||
|
getExecOutputSpy.mockImplementation((input: string) => {
|
||||||
|
if (input.includes('pip')) {
|
||||||
|
return {stdout: 'pip', stderr: '', exitCode: 0};
|
||||||
|
}
|
||||||
|
|
||||||
|
return {stdout: '', stderr: 'Error occured', exitCode: 2};
|
||||||
|
});
|
||||||
|
|
||||||
|
saveCacheSpy = jest.spyOn(cache, 'saveCache');
|
||||||
|
saveCacheSpy.mockImplementation(() => undefined);
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('Package manager validation', () => {
|
||||||
|
it('Package manager is not provided, skip caching', async () => {
|
||||||
|
inputs['cache'] = '';
|
||||||
|
await run();
|
||||||
|
|
||||||
|
expect(getInputSpy).toHaveBeenCalled();
|
||||||
|
expect(infoSpy).not.toHaveBeenCalled();
|
||||||
|
expect(saveCacheSpy).not.toHaveBeenCalled();
|
||||||
|
expect(setFailedSpy).not.toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('Validate unchanged cache is not saved', () => {
|
||||||
|
it('should not save cache for pip', async () => {
|
||||||
|
inputs['cache'] = 'pip';
|
||||||
|
|
||||||
|
await run();
|
||||||
|
|
||||||
|
expect(getInputSpy).toHaveBeenCalled();
|
||||||
|
expect(debugSpy).toHaveBeenCalledWith(
|
||||||
|
`paths for caching are ${__dirname}`
|
||||||
|
);
|
||||||
|
expect(getStateSpy).toHaveBeenCalledTimes(3);
|
||||||
|
expect(infoSpy).toHaveBeenCalledWith(
|
||||||
|
`Cache hit occurred on the primary key ${requirementsHash}, not saving cache.`
|
||||||
|
);
|
||||||
|
expect(setFailedSpy).not.toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should not save cache for pipenv', async () => {
|
||||||
|
inputs['cache'] = 'pipenv';
|
||||||
|
|
||||||
|
await run();
|
||||||
|
|
||||||
|
expect(getInputSpy).toHaveBeenCalled();
|
||||||
|
expect(debugSpy).toHaveBeenCalledWith(
|
||||||
|
`paths for caching are ${__dirname}`
|
||||||
|
);
|
||||||
|
expect(getStateSpy).toHaveBeenCalledTimes(3);
|
||||||
|
expect(infoSpy).toHaveBeenCalledWith(
|
||||||
|
`Cache hit occurred on the primary key ${requirementsHash}, not saving cache.`
|
||||||
|
);
|
||||||
|
expect(setFailedSpy).not.toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('action saves the cache', () => {
|
||||||
|
it('saves cache from pip', async () => {
|
||||||
|
inputs['cache'] = 'pip';
|
||||||
|
getStateSpy.mockImplementation((name: string) => {
|
||||||
|
if (name === State.CACHE_MATCHED_KEY) {
|
||||||
|
return requirementsHash;
|
||||||
|
} else if (name === State.CACHE_PATHS) {
|
||||||
|
return JSON.stringify([__dirname]);
|
||||||
|
} else {
|
||||||
|
return pipFileLockHash;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
await run();
|
||||||
|
|
||||||
|
expect(getInputSpy).toHaveBeenCalled();
|
||||||
|
expect(getStateSpy).toHaveBeenCalledTimes(3);
|
||||||
|
expect(infoSpy).not.toHaveBeenCalledWith(
|
||||||
|
`Cache hit occurred on the primary key ${requirementsHash}, not saving cache.`
|
||||||
|
);
|
||||||
|
expect(saveCacheSpy).toHaveBeenCalled();
|
||||||
|
expect(infoSpy).toHaveBeenLastCalledWith(
|
||||||
|
`Cache saved with the key: ${pipFileLockHash}`
|
||||||
|
);
|
||||||
|
expect(setFailedSpy).not.toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('saves cache from pipenv', async () => {
|
||||||
|
inputs['cache'] = 'pipenv';
|
||||||
|
getStateSpy.mockImplementation((name: string) => {
|
||||||
|
if (name === State.CACHE_MATCHED_KEY) {
|
||||||
|
return pipFileLockHash;
|
||||||
|
} else if (name === State.CACHE_PATHS) {
|
||||||
|
return JSON.stringify([__dirname]);
|
||||||
|
} else {
|
||||||
|
return requirementsHash;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
await run();
|
||||||
|
|
||||||
|
expect(getInputSpy).toHaveBeenCalled();
|
||||||
|
expect(getStateSpy).toHaveBeenCalledTimes(3);
|
||||||
|
expect(infoSpy).not.toHaveBeenCalledWith(
|
||||||
|
`Cache hit occurred on the primary key ${pipFileLockHash}, not saving cache.`
|
||||||
|
);
|
||||||
|
expect(saveCacheSpy).toHaveBeenCalled();
|
||||||
|
expect(infoSpy).toHaveBeenLastCalledWith(
|
||||||
|
`Cache saved with the key: ${requirementsHash}`
|
||||||
|
);
|
||||||
|
expect(setFailedSpy).not.toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
afterEach(() => {
|
||||||
|
jest.resetAllMocks();
|
||||||
|
jest.clearAllMocks();
|
||||||
|
inputs = {};
|
||||||
|
});
|
||||||
|
});
|
||||||
Generated
+276
@@ -0,0 +1,276 @@
|
|||||||
|
{
|
||||||
|
"_meta": {
|
||||||
|
"hash": {
|
||||||
|
"sha256": "408f110354c997d8df1e17841d5335ae690f5b25f8c78040d62257f9535c6005"
|
||||||
|
},
|
||||||
|
"pipfile-spec": 6,
|
||||||
|
"requires": {
|
||||||
|
"python_version": "3.7"
|
||||||
|
},
|
||||||
|
"sources": [
|
||||||
|
{
|
||||||
|
"name": "pypi",
|
||||||
|
"url": "https://pypi.org/simple",
|
||||||
|
"verify_ssl": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"default": {
|
||||||
|
"altgraph": {
|
||||||
|
"hashes": [
|
||||||
|
"sha256:743628f2ac6a7c26f5d9223c91ed8ecbba535f506f4b6f558885a8a56a105857",
|
||||||
|
"sha256:ebf2269361b47d97b3b88e696439f6e4cbc607c17c51feb1754f90fb79839158"
|
||||||
|
],
|
||||||
|
"version": "==0.17.2"
|
||||||
|
},
|
||||||
|
"certifi": {
|
||||||
|
"hashes": [
|
||||||
|
"sha256:5930595817496dd21bb8dc35dad090f1c2cd0adfaf21204bf6732ca5d8ee34d3",
|
||||||
|
"sha256:8fc0819f1f30ba15bdb34cceffb9ef04d99f420f68eb75d901e9560b8749fc41"
|
||||||
|
],
|
||||||
|
"index": "pypi",
|
||||||
|
"version": "==2020.6.20"
|
||||||
|
},
|
||||||
|
"chardet": {
|
||||||
|
"hashes": [
|
||||||
|
"sha256:84ab92ed1c4d4f16916e05906b6b75a6c0fb5db821cc65e70cbd64a3e2a5eaae",
|
||||||
|
"sha256:fc323ffcaeaed0e0a02bf4d117757b98aed530d9ed4531e3e15460124c106691"
|
||||||
|
],
|
||||||
|
"index": "pypi",
|
||||||
|
"version": "==3.0.4"
|
||||||
|
},
|
||||||
|
"docutils": {
|
||||||
|
"hashes": [
|
||||||
|
"sha256:0c5b78adfbf7762415433f5515cd5c9e762339e23369dbe8000d84a4bf4ab3af",
|
||||||
|
"sha256:c2de3a60e9e7d07be26b7f2b00ca0309c207e06c100f9cc2a94931fc75a478fc"
|
||||||
|
],
|
||||||
|
"index": "pypi",
|
||||||
|
"version": "==0.16"
|
||||||
|
},
|
||||||
|
"future": {
|
||||||
|
"hashes": [
|
||||||
|
"sha256:b1bead90b70cf6ec3f0710ae53a525360fa360d306a86583adc6bf83a4db537d"
|
||||||
|
],
|
||||||
|
"markers": "python_version >= '2.6' and python_version not in '3.0, 3.1, 3.2'",
|
||||||
|
"version": "==0.18.2"
|
||||||
|
},
|
||||||
|
"idna": {
|
||||||
|
"hashes": [
|
||||||
|
"sha256:7588d1c14ae4c77d74036e8c22ff447b26d0fde8f007354fd48a7814db15b7cb",
|
||||||
|
"sha256:a068a21ceac8a4d63dbfd964670474107f541babbd2250d61922f029858365fa"
|
||||||
|
],
|
||||||
|
"index": "pypi",
|
||||||
|
"version": "==2.9"
|
||||||
|
},
|
||||||
|
"itsdangerous": {
|
||||||
|
"hashes": [
|
||||||
|
"sha256:321b033d07f2a4136d3ec762eac9f16a10ccd60f53c0c91af90217ace7ba1f19",
|
||||||
|
"sha256:b12271b2047cb23eeb98c8b5622e2e5c5e9abd9784a153e9d8ef9cb4dd09d749"
|
||||||
|
],
|
||||||
|
"index": "pypi",
|
||||||
|
"version": "==1.1.0"
|
||||||
|
},
|
||||||
|
"kivy": {
|
||||||
|
"hashes": [
|
||||||
|
"sha256:090d3ded9835a17477cd93fbdaf0a7c42ff2218981cf198ded5ad8795bc74391",
|
||||||
|
"sha256:11e85eaf6efbfa2362a3334ffdad179a1b0ca8d255cca79eaa6a2765560d4982",
|
||||||
|
"sha256:1a1ff32f8a95f1e175198cbab81fcd2596783b180d4eafe63e87d171aa7fdb5e",
|
||||||
|
"sha256:1d28b198a64c30db8d94a0488e85f3037af60d514ab0d7ad5ab45add3ab77090",
|
||||||
|
"sha256:4a5480cbf837d3780c77a4f61b32b56d22ae9f03845e7a89dd3eaef1ae5fd037",
|
||||||
|
"sha256:4d0e596f74271e901b551f77661dde238df4765484fce9f5d1c72e8022984e84",
|
||||||
|
"sha256:5c3d0f2749522d62e9cce09cd54b2d823bf1b6b644ff1f627be49de6f3e3cba0",
|
||||||
|
"sha256:815a5c0b3b72fcd81ca7b2aa0744087163ed03e4cf9ab4e7c9733cea99fc1571",
|
||||||
|
"sha256:8819a27a09871af451760cb69486ced52e830c8a0a37480f22ef5e692f12c05b",
|
||||||
|
"sha256:a687602d90c4629dd036f577ca39acb76ba581370f9d915f3cab99be818ba8ad",
|
||||||
|
"sha256:b7ef6aad43a86d8df3fb865db864e354f2155a748019f8517f69f65c1a29cb64",
|
||||||
|
"sha256:b85ccf165050cbf2ee8447671eebbc222b369b40f0e0038dd9547d49a5e37373",
|
||||||
|
"sha256:c36652caa7f6c327dee834cfc699d5962d346b7a53e54bd81abc17c314226d89",
|
||||||
|
"sha256:ece170514db3f49844a41e4c910ad9ce9bc46da6f47a49158e11266bdcc6e479",
|
||||||
|
"sha256:f3bea6e4a21991827885d04127fc6d09a0e974ecfa12da7bf5faae93562ea102",
|
||||||
|
"sha256:f835462dd9aa491272552ef079b948a088598e2e95d68bb1d885d2c3f3d4e2c3"
|
||||||
|
],
|
||||||
|
"index": "pypi",
|
||||||
|
"version": "==1.11.1"
|
||||||
|
},
|
||||||
|
"kivy-deps-angle": {
|
||||||
|
"hashes": [
|
||||||
|
"sha256:50605fdd4c9fdbe9f717069734a598a9aba0afe5d3f0412afbe2ecff0326e92d",
|
||||||
|
"sha256:64ac7f33c000585dc30194e604aed925972c6b7c3848b5c3b073ae916fb0b55c",
|
||||||
|
"sha256:99c40d53582a958748e251dfbd61aa67fb85963e27529ca08a21f2f5eeed04e1",
|
||||||
|
"sha256:a2cea09e8a5e899629466403fbd540459f1cdef8d08c6c479b6607b95309be02",
|
||||||
|
"sha256:b167e19b3eea55a9a8c606a607bb909ec1bedda88deee40347c780b310155a79",
|
||||||
|
"sha256:b9d07976b0bf6bac724a42aa8ed5a8c7caa95609046db30c8f15bb731f8e4d36",
|
||||||
|
"sha256:bb4d53f15a093214adbbe205c108ede5cc0f6af6eff104c1b8c468ddaaf6400a",
|
||||||
|
"sha256:d0e7b7b9eb9669837a5d70808a7ea45f2b61961b56f9f69a233bad6bd36ce260"
|
||||||
|
],
|
||||||
|
"index": "pypi",
|
||||||
|
"version": "==0.3.0"
|
||||||
|
},
|
||||||
|
"kivy-deps.glew": {
|
||||||
|
"hashes": [
|
||||||
|
"sha256:09f72ee5ef33ff273332e2a229dc97d650d29818a0189339421949e4e0f63d93",
|
||||||
|
"sha256:1e28e40017af9d081fc0fc95b4fadaf31d15e9f63478dcee1c4257d67079894e",
|
||||||
|
"sha256:45aa7f0e8d9bcf5fc1810c9c38bc20edf7dee61df81ecf62102e0f84153f924a",
|
||||||
|
"sha256:6bb435620c3187d2c61054adb9ec277ed487256b457a0a7b1491bc0cb7247e18",
|
||||||
|
"sha256:92e72fa2c425887987d1aa861c99537033dc20d68ae1c54864871f0401682586",
|
||||||
|
"sha256:ab81783a82bef88a8d2bcf8a93bc21df6b8b0db6ee551eb802727d18f9074b17",
|
||||||
|
"sha256:c843104690c0c8f3a58105c53c57f31506f6f90562c18de00bd19317cc1045a7",
|
||||||
|
"sha256:cf351aad171796f8051af8e49ec430a9aa128d8557d8643e73f2bb1e5f9c2dab",
|
||||||
|
"sha256:ee8ab67abb2c98d84feede657cae472e7723e529af07394244bdd33caafb1a38",
|
||||||
|
"sha256:ef1116d99bd9cc737cb8c0e13e676955c17d6e4d6d1af5cfccef089a430071bb"
|
||||||
|
],
|
||||||
|
"index": "pypi",
|
||||||
|
"version": "==0.1.12"
|
||||||
|
},
|
||||||
|
"kivy-deps.gstreamer": {
|
||||||
|
"hashes": [
|
||||||
|
"sha256:0d9598d2d31c0e780adf4b767fa3a691123621fd0ffef94b83cf82c2da84341b",
|
||||||
|
"sha256:309eca64dee5939f16f8465e5cbb08bdde7c90ded1af6a00690c7e928326af79",
|
||||||
|
"sha256:3d53d2c84c0a997c4cac6c239b1e0a6486e533836321003dc365ec42b97a664b",
|
||||||
|
"sha256:4d996377111e854b3dea90846f9b2f98766a44529fd8b72125e18c552381d928",
|
||||||
|
"sha256:4f2ddd61d185310258d338ae80a646df7822efdd7d67e57f49dc7b87555c5d7e",
|
||||||
|
"sha256:6fa9f76afe600baa221abee31ce7dc63e653d0affe0f6c558bfc4f35af96396f",
|
||||||
|
"sha256:739cd331b9f33a822d700273674a79a3157054e9358a01a0d553f094a5f4a8c9",
|
||||||
|
"sha256:c29cfc63fe70a58dad889e631f1ba4711c9ea80103f2b2b8d670a97f093076c8",
|
||||||
|
"sha256:c4709765e2b17c6c96b46a92207b0457def147544d825654077603eaf0d424de"
|
||||||
|
],
|
||||||
|
"index": "pypi",
|
||||||
|
"version": "==0.1.17"
|
||||||
|
},
|
||||||
|
"kivy-deps.sdl2": {
|
||||||
|
"hashes": [
|
||||||
|
"sha256:053f26e8c05d5545bdbc7eeb8c450b8e4410ee355792e9345af536110fe247e2",
|
||||||
|
"sha256:1b987bdd4fbbcb31baf0d7fc9584ad99912179b8968311bb7e30fbeb14e98e0d",
|
||||||
|
"sha256:228128cdd8112dc7505ac43027a770476e9ef282e0b84ca68037133cd025960b",
|
||||||
|
"sha256:2c2fd5a12a7a9afe3bb962b273561099a180edae91bb9c8f8386b72253fcae4a",
|
||||||
|
"sha256:5ce23f1a3286d6288751a12b0eaefd02f947ea101bb807e9781b964e496fc3f3",
|
||||||
|
"sha256:7928746eaed51944c10d1bb36fcefebe3d1aff1b97ba32359c2c97ba74707e1b",
|
||||||
|
"sha256:9270fa8ed5130074b167a7a3a9c85efc3cfe3c04584ab084cb6ae9e4edfa8168",
|
||||||
|
"sha256:92ed97d3247bc8ce98f336cbc940bb889310199326e9ccf251c49ae7e4b80de8",
|
||||||
|
"sha256:96e1fa89fd8b5351f2d3c26bbffd50df8d554b03fba4025ecc941d773d241698",
|
||||||
|
"sha256:c3ace0ddde0e59cdcaf260eda1daa0c05ca9bf8cd0c4ea404539de25a5dcaec7"
|
||||||
|
],
|
||||||
|
"index": "pypi",
|
||||||
|
"version": "==0.1.22"
|
||||||
|
},
|
||||||
|
"kivy-garden": {
|
||||||
|
"hashes": [
|
||||||
|
"sha256:9b7d9de5efacbcd0c4b3dd873b30622a86093c9965aa47b523c7a32f3eb34610",
|
||||||
|
"sha256:c256f42788421273a08fbb0a228f0fb0e80dd86b629fb8c0920507f645be6c72"
|
||||||
|
],
|
||||||
|
"index": "pypi",
|
||||||
|
"version": "==0.1.4"
|
||||||
|
},
|
||||||
|
"packaging": {
|
||||||
|
"hashes": [
|
||||||
|
"sha256:7dc96269f53a4ccec5c0670940a4281106dd0bb343f47b7471f779df49c2fbe7",
|
||||||
|
"sha256:c86254f9220d55e31cc94d69bade760f0847da8000def4dfe1c6b872fd14ff14"
|
||||||
|
],
|
||||||
|
"index": "pypi",
|
||||||
|
"version": "==21.0"
|
||||||
|
},
|
||||||
|
"pdf2image": {
|
||||||
|
"hashes": [
|
||||||
|
"sha256:a0d9906f5507192210a8d5d7ead63145e9dec4bccc4564b1fb644e923913c31c"
|
||||||
|
],
|
||||||
|
"index": "pypi",
|
||||||
|
"version": "==1.12.1"
|
||||||
|
},
|
||||||
|
"pefile": {
|
||||||
|
"hashes": [
|
||||||
|
"sha256:344a49e40a94e10849f0fe34dddc80f773a12b40675bf2f7be4b8be578bdd94a"
|
||||||
|
],
|
||||||
|
"markers": "python_full_version >= '3.6.0'",
|
||||||
|
"version": "==2021.9.3"
|
||||||
|
},
|
||||||
|
"pillow": {
|
||||||
|
"hashes": [
|
||||||
|
"sha256:0295442429645fa16d05bd567ef5cff178482439c9aad0411d3f0ce9b88b3a6f",
|
||||||
|
"sha256:06aba4169e78c439d528fdeb34762c3b61a70813527a2c57f0540541e9f433a8",
|
||||||
|
"sha256:09d7f9e64289cb40c2c8d7ad674b2ed6105f55dc3b09aa8e4918e20a0311e7ad",
|
||||||
|
"sha256:0a80dd307a5d8440b0a08bd7b81617e04d870e40a3e46a32d9c246e54705e86f",
|
||||||
|
"sha256:1ca594126d3c4def54babee699c055a913efb01e106c309fa6b04405d474d5ae",
|
||||||
|
"sha256:25930fadde8019f374400f7986e8404c8b781ce519da27792cbe46eabec00c4d",
|
||||||
|
"sha256:431b15cffbf949e89df2f7b48528be18b78bfa5177cb3036284a5508159492b5",
|
||||||
|
"sha256:52125833b070791fcb5710fabc640fc1df07d087fc0c0f02d3661f76c23c5b8b",
|
||||||
|
"sha256:5e51ee2b8114def244384eda1c82b10e307ad9778dac5c83fb0943775a653cd8",
|
||||||
|
"sha256:612cfda94e9c8346f239bf1a4b082fdd5c8143cf82d685ba2dba76e7adeeb233",
|
||||||
|
"sha256:6d7741e65835716ceea0fd13a7d0192961212fd59e741a46bbed7a473c634ed6",
|
||||||
|
"sha256:6edb5446f44d901e8683ffb25ebdfc26988ee813da3bf91e12252b57ac163727",
|
||||||
|
"sha256:725aa6cfc66ce2857d585f06e9519a1cc0ef6d13f186ff3447ab6dff0a09bc7f",
|
||||||
|
"sha256:8dad18b69f710bf3a001d2bf3afab7c432785d94fcf819c16b5207b1cfd17d38",
|
||||||
|
"sha256:94cf49723928eb6070a892cb39d6c156f7b5a2db4e8971cb958f7b6b104fb4c4",
|
||||||
|
"sha256:97f9e7953a77d5a70f49b9a48da7776dc51e9b738151b22dacf101641594a626",
|
||||||
|
"sha256:9ad7f865eebde135d526bb3163d0b23ffff365cf87e767c649550964ad72785d",
|
||||||
|
"sha256:9c87ef410a58dd54b92424ffd7e28fd2ec65d2f7fc02b76f5e9b2067e355ebf6",
|
||||||
|
"sha256:a060cf8aa332052df2158e5a119303965be92c3da6f2d93b6878f0ebca80b2f6",
|
||||||
|
"sha256:c79f9c5fb846285f943aafeafda3358992d64f0ef58566e23484132ecd8d7d63",
|
||||||
|
"sha256:c92302a33138409e8f1ad16731568c55c9053eee71bb05b6b744067e1b62380f",
|
||||||
|
"sha256:d08b23fdb388c0715990cbc06866db554e1822c4bdcf6d4166cf30ac82df8c41",
|
||||||
|
"sha256:d350f0f2c2421e65fbc62690f26b59b0bcda1b614beb318c81e38647e0f673a1",
|
||||||
|
"sha256:e901964262a56d9ea3c2693df68bc9860b8bdda2b04768821e4c44ae797de117",
|
||||||
|
"sha256:ec29604081f10f16a7aea809ad42e27764188fc258b02259a03a8ff7ded3808d",
|
||||||
|
"sha256:edf31f1150778abd4322444c393ab9c7bd2af271dd4dafb4208fb613b1f3cdc9",
|
||||||
|
"sha256:f7e30c27477dffc3e85c2463b3e649f751789e0f6c8456099eea7ddd53be4a8a",
|
||||||
|
"sha256:ffe538682dc19cc542ae7c3e504fdf54ca7f86fb8a135e59dd6bc8627eae6cce"
|
||||||
|
],
|
||||||
|
"index": "pypi",
|
||||||
|
"version": "==7.2"
|
||||||
|
},
|
||||||
|
"pygments": {
|
||||||
|
"hashes": [
|
||||||
|
"sha256:647344a061c249a3b74e230c739f434d7ea4d8b1d5f3721bc0f3558049b38f44",
|
||||||
|
"sha256:ff7a40b4860b727ab48fad6360eb351cc1b33cbf9b15a0f689ca5353e9463324"
|
||||||
|
],
|
||||||
|
"index": "pypi",
|
||||||
|
"version": "==2.6.1"
|
||||||
|
},
|
||||||
|
"pyinstaller": {
|
||||||
|
"hashes": [
|
||||||
|
"sha256:3730fa80d088f8bb7084d32480eb87cbb4ddb64123363763cf8f2a1378c1c4b7"
|
||||||
|
],
|
||||||
|
"index": "pypi",
|
||||||
|
"version": "==3.6"
|
||||||
|
},
|
||||||
|
"pyparsing": {
|
||||||
|
"hashes": [
|
||||||
|
"sha256:c203ec8783bf771a155b207279b9bccb8dea02d8f0c9e5f8ead507bc3246ecc1",
|
||||||
|
"sha256:ef9d7589ef3c200abe66653d3f1ab1033c3c419ae9b9bdb1240a85b024efc88b"
|
||||||
|
],
|
||||||
|
"markers": "python_version >= '2.6' and python_version not in '3.0, 3.1, 3.2'",
|
||||||
|
"version": "==2.4.7"
|
||||||
|
},
|
||||||
|
"pywin32-ctypes": {
|
||||||
|
"hashes": [
|
||||||
|
"sha256:24ffc3b341d457d48e8922352130cf2644024a4ff09762a2261fd34c36ee5942",
|
||||||
|
"sha256:9dc2d991b3479cc2df15930958b674a48a227d5361d413827a4cfd0b5876fc98"
|
||||||
|
],
|
||||||
|
"version": "==0.2.0"
|
||||||
|
},
|
||||||
|
"requests": {
|
||||||
|
"hashes": [
|
||||||
|
"sha256:b3559a131db72c33ee969480840fff4bb6dd111de7dd27c8ee1f820f4f00231b",
|
||||||
|
"sha256:fe75cc94a9443b9246fc7049224f75604b113c36acb93f87b80ed42c44cbb898"
|
||||||
|
],
|
||||||
|
"index": "pypi",
|
||||||
|
"version": "==2.24.0"
|
||||||
|
},
|
||||||
|
"urllib3": {
|
||||||
|
"hashes": [
|
||||||
|
"sha256:3018294ebefce6572a474f0604c2021e33b3fd8006ecd11d62107a5d2a963527",
|
||||||
|
"sha256:88206b0eb87e6d677d424843ac5209e3fb9d0190d0ee169599165ec25e9d9115"
|
||||||
|
],
|
||||||
|
"index": "pypi",
|
||||||
|
"version": "==1.25.9"
|
||||||
|
},
|
||||||
|
"xlrd": {
|
||||||
|
"hashes": [
|
||||||
|
"sha256:546eb36cee8db40c3eaa46c351e67ffee6eeb5fa2650b71bc4c758a29a1b29b2",
|
||||||
|
"sha256:e551fb498759fa3a5384a94ccd4c3c02eb7c00ea424426e212ac0c57be9dfbde"
|
||||||
|
],
|
||||||
|
"index": "pypi",
|
||||||
|
"version": "==1.2.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"develop": {}
|
||||||
|
}
|
||||||
@@ -0,0 +1,533 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"pypy_version": "7.3.3",
|
||||||
|
"python_version": "3.6.12",
|
||||||
|
"stable": true,
|
||||||
|
"latest_pypy": true,
|
||||||
|
"date": "2020-11-21",
|
||||||
|
"files": [
|
||||||
|
{
|
||||||
|
"filename": "pypy3.6-v7.3.3-aarch64.tar.bz2",
|
||||||
|
"arch": "aarch64",
|
||||||
|
"platform": "linux",
|
||||||
|
"download_url": "https://test.download.python.org/pypy/pypy3.6-v7.3.3-aarch64.tar.bz2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "pypy3.6-v7.3.3-linux32.tar.bz2",
|
||||||
|
"arch": "i686",
|
||||||
|
"platform": "linux",
|
||||||
|
"download_url": "https://test.download.python.org/pypy/pypy3.6-v7.3.3-linux32.tar.bz2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "pypy3.6-v7.3.3-linux64.tar.bz2",
|
||||||
|
"arch": "x64",
|
||||||
|
"platform": "linux",
|
||||||
|
"download_url": "https://test.download.python.org/pypy/pypy3.6-v7.3.3-linux64.tar.bz2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "pypy3.6-v7.3.3-darwin64.tar.bz2",
|
||||||
|
"arch": "x64",
|
||||||
|
"platform": "darwin",
|
||||||
|
"download_url": "https://test.download.python.org/pypy/pypy3.6-v7.3.3-darwin64.tar.bz2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "pypy3.6-v7.3.3-win32.zip",
|
||||||
|
"arch": "x86",
|
||||||
|
"platform": "win32",
|
||||||
|
"download_url": "https://test.download.python.org/pypy/pypy3.6-v7.3.3-win32.zip"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "pypy3.6-v7.3.3-s390x.tar.bz2",
|
||||||
|
"arch": "s390x",
|
||||||
|
"platform": "linux",
|
||||||
|
"download_url": "https://test.download.python.org/pypy/pypy3.6-v7.3.3-s390x.tar.bz2"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"pypy_version": "7.3.3rc1",
|
||||||
|
"python_version": "3.6.12",
|
||||||
|
"stable": false,
|
||||||
|
"latest_pypy": false,
|
||||||
|
"date": "2020-11-11",
|
||||||
|
"files": [
|
||||||
|
{
|
||||||
|
"filename": "pypy3.6-v7.3.3rc1-aarch64.tar.bz2",
|
||||||
|
"arch": "aarch64",
|
||||||
|
"platform": "linux",
|
||||||
|
"download_url": "https://test.download.python.org/pypy/pypy3.6-v7.3.3rc1-aarch64.tar.bz2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "pypy3.6-v7.3.3-linux32rc1.tar.bz2",
|
||||||
|
"arch": "i686",
|
||||||
|
"platform": "linux",
|
||||||
|
"download_url": "https://test.download.python.org/pypy/pypy3.6-v7.3.3rc1-linux32.tar.bz2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "pypy3.6-v7.3.3rc1-linux64.tar.bz2",
|
||||||
|
"arch": "x64",
|
||||||
|
"platform": "linux",
|
||||||
|
"download_url": "https://test.download.python.org/pypy/pypy3.6-v7.3.3rc1-linux64.tar.bz2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "pypy3.6-v7.3.3rc1-osx64.tar.bz2",
|
||||||
|
"arch": "x64",
|
||||||
|
"platform": "darwin",
|
||||||
|
"download_url": "https://test.download.python.org/pypy/pypy3.6-v7.3.3rc1-osx64.tar.bz2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "pypy3.6-v7.3.3-win32rc1.zip",
|
||||||
|
"arch": "x86",
|
||||||
|
"platform": "win32",
|
||||||
|
"download_url": "https://test.download.python.org/pypy/pypy3.6-v7.3.3rc1-win32.zip"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "pypy3.6-v7.3.3rc1-s390x.tar.bz2",
|
||||||
|
"arch": "s390x",
|
||||||
|
"platform": "linux",
|
||||||
|
"download_url": "https://test.download.python.org/pypy/pypy3.6-v7.3.3rc1-s390x.tar.bz2"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"pypy_version": "7.3.4rc1",
|
||||||
|
"python_version": "2.7.18",
|
||||||
|
"stable": false,
|
||||||
|
"latest_pypy": false,
|
||||||
|
"date": "2021-03-19",
|
||||||
|
"files": [
|
||||||
|
{
|
||||||
|
"filename": "pypy2.7-v7.3.4rc1-aarch64.tar.bz2",
|
||||||
|
"arch": "aarch64",
|
||||||
|
"platform": "linux",
|
||||||
|
"download_url": "https://test.downloads.python.org/pypy/pypy2.7-v7.3.4rc1-aarch64.tar.bz2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "pypy2.7-v7.3.4rc1-linux32.tar.bz2",
|
||||||
|
"arch": "i686",
|
||||||
|
"platform": "linux",
|
||||||
|
"download_url": "https://test.downloads.python.org/pypy/pypy2.7-v7.3.4rc1-linux32.tar.bz2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "pypy2.7-v7.3.4rc1-linux64.tar.bz2",
|
||||||
|
"arch": "x64",
|
||||||
|
"platform": "linux",
|
||||||
|
"download_url": "https://test.downloads.python.org/pypy/pypy2.7-v7.3.4rc1-linux64.tar.bz2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "pypy2.7-v7.3.4rc1-osx64.tar.bz2",
|
||||||
|
"arch": "x64",
|
||||||
|
"platform": "darwin",
|
||||||
|
"download_url": "https://test.downloads.python.org/pypy/pypy2.7-v7.3.4rc1-osx64.tar.bz2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "pypy2.7-v7.3.4rc1-win64.zip",
|
||||||
|
"arch": "x64",
|
||||||
|
"platform": "win64",
|
||||||
|
"download_url": "https://test.downloads.python.org/pypy/pypy2.7-v7.3.4rc1-win64.zip"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"pypy_version": "7.3.3rc2",
|
||||||
|
"python_version": "3.7.7",
|
||||||
|
"stable": false,
|
||||||
|
"latest_pypy": false,
|
||||||
|
"date": "2020-11-11",
|
||||||
|
"files": [
|
||||||
|
{
|
||||||
|
"filename": "test.tar.bz2",
|
||||||
|
"arch": "aarch64",
|
||||||
|
"platform": "linux",
|
||||||
|
"download_url": "test.tar.bz2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "test.tar.bz2",
|
||||||
|
"arch": "i686",
|
||||||
|
"platform": "linux",
|
||||||
|
"download_url": "test.tar.bz2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "test.tar.bz2",
|
||||||
|
"arch": "x64",
|
||||||
|
"platform": "linux",
|
||||||
|
"download_url": "test.tar.bz2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "test.tar.bz2",
|
||||||
|
"arch": "x64",
|
||||||
|
"platform": "darwin",
|
||||||
|
"download_url": "test.tar.bz2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "test.zip",
|
||||||
|
"arch": "x86",
|
||||||
|
"platform": "win32",
|
||||||
|
"download_url": "test.zip"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "test.tar.bz2",
|
||||||
|
"arch": "s390x",
|
||||||
|
"platform": "linux",
|
||||||
|
"download_url": "test.tar.bz2"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"pypy_version": "7.3.3",
|
||||||
|
"python_version": "3.7.9",
|
||||||
|
"stable": true,
|
||||||
|
"latest_pypy": true,
|
||||||
|
"date": "2020-11-21",
|
||||||
|
"files": [
|
||||||
|
{
|
||||||
|
"filename": "pypy3.7-v7.3.3-aarch64.tar.bz2",
|
||||||
|
"arch": "aarch64",
|
||||||
|
"platform": "linux",
|
||||||
|
"download_url": "https://test.download.python.org/pypy/pypy3.7-v7.3.3-aarch64.tar.bz2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "pypy3.7-v7.3.3-linux32.tar.bz2",
|
||||||
|
"arch": "i686",
|
||||||
|
"platform": "linux",
|
||||||
|
"download_url": "https://test.download.python.org/pypy/pypy3.7-v7.3.3-linux32.tar.bz2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "pypy3.7-v7.3.3-linux64.tar.bz2",
|
||||||
|
"arch": "x64",
|
||||||
|
"platform": "linux",
|
||||||
|
"download_url": "https://test.download.python.org/pypy/pypy3.7-v7.3.3-linux64.tar.bz2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "pypy3.7-v7.3.3-osx64.tar.bz2",
|
||||||
|
"arch": "x64",
|
||||||
|
"platform": "darwin",
|
||||||
|
"download_url": "https://test.download.python.org/pypy/pypy3.7-v7.3.3-osx64.tar.bz2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "pypy3.7-v7.3.3-win32.zip",
|
||||||
|
"arch": "x86",
|
||||||
|
"platform": "win32",
|
||||||
|
"download_url": "https://test.download.python.org/pypy/pypy3.7-v7.3.3-win32.zip"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "pypy3.7-v7.3.3-s390x.tar.bz2",
|
||||||
|
"arch": "s390x",
|
||||||
|
"platform": "linux",
|
||||||
|
"download_url": "https://test.download.python.org/pypy/pypy3.7-v7.3.3-s390x.tar.bz2"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"pypy_version": "7.3.3",
|
||||||
|
"python_version": "2.7.18",
|
||||||
|
"stable": true,
|
||||||
|
"latest_pypy": true,
|
||||||
|
"date": "2020-11-21",
|
||||||
|
"files": [
|
||||||
|
{
|
||||||
|
"filename": "pypy2.7-v7.3.3-aarch64.tar.bz2",
|
||||||
|
"arch": "aarch64",
|
||||||
|
"platform": "linux",
|
||||||
|
"download_url": "https://test.download.python.org/pypy/pypy2.7-v7.3.3-aarch64.tar.bz2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "pypy2.7-v7.3.3-linux32.tar.bz2",
|
||||||
|
"arch": "i686",
|
||||||
|
"platform": "linux",
|
||||||
|
"download_url": "https://test.download.python.org/pypy/pypy2.7-v7.3.3-linux32.tar.bz2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "pypy2.7-v7.3.3-linux64.tar.bz2",
|
||||||
|
"arch": "x64",
|
||||||
|
"platform": "linux",
|
||||||
|
"download_url": "https://test.download.python.org/pypy/pypy2.7-v7.3.3-linux64.tar.bz2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "pypy2.7-v7.3.3-osx64.tar.bz2",
|
||||||
|
"arch": "x64",
|
||||||
|
"platform": "darwin",
|
||||||
|
"download_url": "https://test.download.python.org/pypy/pypy2.7-v7.3.3-osx64.tar.bz2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "pypy2.7-v7.3.3-win32.zip",
|
||||||
|
"arch": "x86",
|
||||||
|
"platform": "win32",
|
||||||
|
"download_url": "https://test.download.python.org/pypy/pypy2.7-v7.3.3-win32.zip"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "pypy2.7-v7.3.3-s390x.tar.bz2",
|
||||||
|
"arch": "s390x",
|
||||||
|
"platform": "linux",
|
||||||
|
"download_url": "https://test.download.python.org/pypy/pypy2.7-v7.3.3-s390x.tar.bz2"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"pypy_version": "7.3.2",
|
||||||
|
"python_version": "3.6.9",
|
||||||
|
"stable": true,
|
||||||
|
"latest_pypy": true,
|
||||||
|
"date": "2020-09-25",
|
||||||
|
"files": [
|
||||||
|
{
|
||||||
|
"filename": "pypy3.6-v7.3.2-aarch64.tar.bz2",
|
||||||
|
"arch": "aarch64",
|
||||||
|
"platform": "linux",
|
||||||
|
"download_url": "https://test.download.python.org/pypy/pypy3.6-v7.3.2-aarch64.tar.bz2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "pypy3.6-v7.3.2-linux32.tar.bz2",
|
||||||
|
"arch": "i686",
|
||||||
|
"platform": "linux",
|
||||||
|
"download_url": "https://test.download.python.org/pypy/pypy3.6-v7.3.2-linux32.tar.bz2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "pypy3.6-v7.3.2-linux64.tar.bz2",
|
||||||
|
"arch": "x64",
|
||||||
|
"platform": "linux",
|
||||||
|
"download_url": "https://test.download.python.org/pypy/pypy3.6-v7.3.2-linux64.tar.bz2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "pypy3.6-v7.3.2-osx64.tar.bz2",
|
||||||
|
"arch": "x64",
|
||||||
|
"platform": "darwin",
|
||||||
|
"download_url": "https://test.download.python.org/pypy/pypy3.6-v7.3.2-osx64.tar.bz2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "pypy3.6-v7.3.2-win32.zip",
|
||||||
|
"arch": "x86",
|
||||||
|
"platform": "win32",
|
||||||
|
"download_url": "https://test.download.python.org/pypy/pypy3.6-v7.3.2-win32.zip"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "pypy3.6-v7.3.2-s390x.tar.bz2",
|
||||||
|
"arch": "s390x",
|
||||||
|
"platform": "linux",
|
||||||
|
"download_url": "https://test.download.python.org/pypy/pypy3.6-v7.3.2-s390x.tar.bz2"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"pypy_version": "7.3.2",
|
||||||
|
"python_version": "3.7.9",
|
||||||
|
"stable": true,
|
||||||
|
"latest_pypy": false,
|
||||||
|
"date": "2020-09-25",
|
||||||
|
"files": [
|
||||||
|
{
|
||||||
|
"filename": "pypy3.7-v7.3.2-aarch64.tar.bz2",
|
||||||
|
"arch": "aarch64",
|
||||||
|
"platform": "linux",
|
||||||
|
"download_url": "https://test.download.python.org/pypy/pypy3.7-v7.3.2-aarch64.tar.bz2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "pypy3.7-v7.3.2-linux32.tar.bz2",
|
||||||
|
"arch": "i686",
|
||||||
|
"platform": "linux",
|
||||||
|
"download_url": "https://test.download.python.org/pypy/pypy3.7-v7.3.2-linux32.tar.bz2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "pypy3.7-v7.3.2-linux64.tar.bz2",
|
||||||
|
"arch": "x64",
|
||||||
|
"platform": "linux",
|
||||||
|
"download_url": "https://test.download.python.org/pypy/pypy3.7-v7.3.2-linux64.tar.bz2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "pypy3.7-v7.3.2-osx64.tar.bz2",
|
||||||
|
"arch": "x64",
|
||||||
|
"platform": "darwin",
|
||||||
|
"download_url": "https://test.download.python.org/pypy/pypy3.7-v7.3.2-osx64.tar.bz2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "pypy3.7-v7.3.2-win32.zip",
|
||||||
|
"arch": "x86",
|
||||||
|
"platform": "win32",
|
||||||
|
"download_url": "https://test.download.python.org/pypy/pypy3.7-v7.3.2-win32.zip"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "pypy3.7-v7.3.2-s390x.tar.bz2",
|
||||||
|
"arch": "s390x",
|
||||||
|
"platform": "linux",
|
||||||
|
"download_url": "https://test.download.python.org/pypy/pypy3.7-v7.3.2-s390x.tar.bz2"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"pypy_version": "7.3.2",
|
||||||
|
"python_version": "2.7.13",
|
||||||
|
"stable": true,
|
||||||
|
"latest_pypy": true,
|
||||||
|
"date": "2020-09-25",
|
||||||
|
"files": [
|
||||||
|
{
|
||||||
|
"filename": "pypy2.7-v7.3.2-aarch64.tar.bz2",
|
||||||
|
"arch": "aarch64",
|
||||||
|
"platform": "linux",
|
||||||
|
"download_url": "https://test.download.python.org/pypy/pypy2.7-v7.3.2-aarch64.tar.bz2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "pypy2.7-v7.3.2-linux32.tar.bz2",
|
||||||
|
"arch": "i686",
|
||||||
|
"platform": "linux",
|
||||||
|
"download_url": "https://test.download.python.org/pypy/pypy2.7-v7.3.2-linux32.tar.bz2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "pypy2.7-v7.3.2-linux64.tar.bz2",
|
||||||
|
"arch": "x64",
|
||||||
|
"platform": "linux",
|
||||||
|
"download_url": "https://test.download.python.org/pypy/pypy2.7-v7.3.2-linux64.tar.bz2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "pypy2.7-v7.3.2-osx64.tar.bz2",
|
||||||
|
"arch": "x64",
|
||||||
|
"platform": "darwin",
|
||||||
|
"download_url": "https://test.download.python.org/pypy/pypy2.7-v7.3.2-osx64.tar.bz2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "pypy2.7-v7.3.2-win32.zip",
|
||||||
|
"arch": "x86",
|
||||||
|
"platform": "win32",
|
||||||
|
"download_url": "https://test.download.python.org/pypy/pypy2.7-v7.3.2-win32.zip"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "pypy2.7-v7.3.2-s390x.tar.bz2",
|
||||||
|
"arch": "s390x",
|
||||||
|
"platform": "linux",
|
||||||
|
"download_url": "https://test.download.python.org/pypy/pypy2.7-v7.3.2-s390x.tar.bz2"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"pypy_version": "nightly",
|
||||||
|
"python_version": "2.7",
|
||||||
|
"stable": false,
|
||||||
|
"latest_pypy": false,
|
||||||
|
"files": [
|
||||||
|
{
|
||||||
|
"filename": "filename.tar.bz2",
|
||||||
|
"arch": "aarch64",
|
||||||
|
"platform": "linux",
|
||||||
|
"download_url": "http://nightlyBuilds.org/filename.tar.bz2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "filename.tar.bz2",
|
||||||
|
"arch": "i686",
|
||||||
|
"platform": "linux",
|
||||||
|
"download_url": "http://nightlyBuilds.org/filename.tar.bz2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "filename.tar.bz2",
|
||||||
|
"arch": "x64",
|
||||||
|
"platform": "linux",
|
||||||
|
"download_url": "http://nightlyBuilds.org/filename.tar.bz2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "filename.tar.bz2",
|
||||||
|
"arch": "x64",
|
||||||
|
"platform": "darwin",
|
||||||
|
"download_url": "http://nightlyBuilds.org/filename.tar.bz2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "filename.zip",
|
||||||
|
"arch": "x86",
|
||||||
|
"platform": "win32",
|
||||||
|
"download_url": "http://nightlyBuilds.org/filename.zip"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "filename.tar.bz2",
|
||||||
|
"arch": "s390x",
|
||||||
|
"platform": "linux",
|
||||||
|
"download_url": "http://nightlyBuilds.org/filename.tar.bz2"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"pypy_version": "nightly",
|
||||||
|
"python_version": "3.7",
|
||||||
|
"stable": false,
|
||||||
|
"latest_pypy": false,
|
||||||
|
"files": [
|
||||||
|
{
|
||||||
|
"filename": "filename.tar.bz2",
|
||||||
|
"arch": "aarch64",
|
||||||
|
"platform": "linux",
|
||||||
|
"download_url": "http://nightlyBuilds.org/filename.tar.bz2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "filename.tar.bz2",
|
||||||
|
"arch": "i686",
|
||||||
|
"platform": "linux",
|
||||||
|
"download_url": "http://nightlyBuilds.org/filename.tar.bz2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "filename.tar.bz2",
|
||||||
|
"arch": "x64",
|
||||||
|
"platform": "linux",
|
||||||
|
"download_url": "http://nightlyBuilds.org/filename.tar.bz2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "filename.tar.bz2",
|
||||||
|
"arch": "x64",
|
||||||
|
"platform": "darwin",
|
||||||
|
"download_url": "http://nightlyBuilds.org/filename.tar.bz2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "filename.zip",
|
||||||
|
"arch": "x86",
|
||||||
|
"platform": "win32",
|
||||||
|
"download_url": "http://nightlyBuilds.org/filename.zip"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "filename.tar.bz2",
|
||||||
|
"arch": "s390x",
|
||||||
|
"platform": "linux",
|
||||||
|
"download_url": "http://nightlyBuilds.org/filename.tar.bz2"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"pypy_version": "nightly",
|
||||||
|
"python_version": "3.6",
|
||||||
|
"stable": false,
|
||||||
|
"latest_pypy": false,
|
||||||
|
"files": [
|
||||||
|
{
|
||||||
|
"filename": "filename.tar.bz2",
|
||||||
|
"arch": "aarch64",
|
||||||
|
"platform": "linux",
|
||||||
|
"download_url": "http://nightlyBuilds.org/filename.tar.bz2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "filename.tar.bz2",
|
||||||
|
"arch": "i686",
|
||||||
|
"platform": "linux",
|
||||||
|
"download_url": "http://nightlyBuilds.org/filename.tar.bz2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "filename.tar.bz2",
|
||||||
|
"arch": "x64",
|
||||||
|
"platform": "linux",
|
||||||
|
"download_url": "http://nightlyBuilds.org/filename.tar.bz2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "filename.tar.bz2",
|
||||||
|
"arch": "x64",
|
||||||
|
"platform": "darwin",
|
||||||
|
"download_url": "http://nightlyBuilds.org/filename.tar.bz2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "filename.zip",
|
||||||
|
"arch": "x86",
|
||||||
|
"platform": "win32",
|
||||||
|
"download_url": "http://nightlyBuilds.org/filename.zip"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "filename.tar.bz2",
|
||||||
|
"arch": "s390x",
|
||||||
|
"platform": "linux",
|
||||||
|
"download_url": "http://nightlyBuilds.org/filename.tar.bz2"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
certifi==2020.6.20
|
||||||
|
chardet==3.0.4
|
||||||
|
docutils==0.16
|
||||||
|
idna==2.10
|
||||||
|
Kivy==2.0.0rc3
|
||||||
|
Kivy-Garden==0.1.4
|
||||||
|
packaging==20.7
|
||||||
|
pdf2image==1.12.1
|
||||||
|
Pygments==2.6.1
|
||||||
|
requests==2.24.0
|
||||||
|
urllib3==1.25.10
|
||||||
|
xlrd==1.2.0
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
altgraph==0.17.2
|
||||||
|
|
||||||
|
certifi==2020.6.20
|
||||||
|
|
||||||
|
chardet==3.0.4
|
||||||
|
|
||||||
|
docutils==0.16
|
||||||
|
|
||||||
|
future==0.18.2; python_version >= '2.6' and python_version not in '3.0, 3.1, 3.2'
|
||||||
|
|
||||||
|
idna==2.9
|
||||||
|
|
||||||
|
itsdangerous==1.1.0
|
||||||
|
|
||||||
|
kivy-deps-angle==0.3.0
|
||||||
|
|
||||||
|
kivy-deps.glew==0.1.12
|
||||||
|
|
||||||
|
kivy-deps.gstreamer==0.1.17
|
||||||
|
|
||||||
|
kivy-deps.sdl2==0.1.22
|
||||||
|
|
||||||
|
kivy-garden==0.1.4
|
||||||
|
|
||||||
|
kivy==1.11.1
|
||||||
|
|
||||||
|
packaging==21.0
|
||||||
|
|
||||||
|
pdf2image==1.12.1
|
||||||
|
|
||||||
|
pefile==2021.9.3; python_full_version >= '3.6.0'
|
||||||
|
|
||||||
|
pillow==7.2
|
||||||
|
|
||||||
|
pygments==2.6.1
|
||||||
|
|
||||||
|
pyinstaller==3.6
|
||||||
|
|
||||||
|
pyparsing==2.4.7; python_version >= '2.6' and python_version not in '3.0, 3.1, 3.2'
|
||||||
|
|
||||||
|
pywin32-ctypes==0.2.0
|
||||||
|
|
||||||
|
requests==2.24.0
|
||||||
|
|
||||||
|
urllib3==1.25.9
|
||||||
|
|
||||||
|
xlrd==1.2.0
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"version": "1.2.3",
|
||||||
|
"stable": true,
|
||||||
|
"release_url": "https://github.com/actions/sometool/releases/tag/1.2.3-20200402.6",
|
||||||
|
"files": [
|
||||||
|
{
|
||||||
|
"filename": "sometool-1.2.3-linux-x64.tar.gz",
|
||||||
|
"arch": "x64",
|
||||||
|
"platform": "linux",
|
||||||
|
"download_url": "https://github.com/actions/sometool/releases/tag/1.2.3-20200402.6/sometool-1.2.3-linux-x64.tar.gz"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "sometool-1.2.3-darwin-x64.tar.gz",
|
||||||
|
"arch": "x64",
|
||||||
|
"platform": "darwin",
|
||||||
|
"download_url": "https://github.com/actions/sometool/releases/tag/1.2.3-20200402.6/sometool-1.2.3-darwin-x64.tar.gz"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "sometool-1.2.3-win32-x64.tar.gz",
|
||||||
|
"arch": "x64",
|
||||||
|
"platform": "win32",
|
||||||
|
"download_url": "https://github.com/actions/sometool/releases/tag/1.2.3-20200402.6/sometool-1.2.3-win32-x64.tar.gz"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"version": "1.2.3-beta.2",
|
||||||
|
"stable": false,
|
||||||
|
"release_url": "https://github.com/actions/sometool/releases/tag/1.2.3-beta.2-20200402.5",
|
||||||
|
"files": [
|
||||||
|
{
|
||||||
|
"filename": "sometool-1.2.3-linux-x64.tar.gz",
|
||||||
|
"arch": "x64",
|
||||||
|
"platform": "linux",
|
||||||
|
"download_url": "https://github.com/actions/sometool/releases/tag/1.2.3-beta.2-20200402.5/sometool-1.2.3-linux-x64.tar.gz"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "sometool-1.2.3-darwin-x64.tar.gz",
|
||||||
|
"arch": "x64",
|
||||||
|
"platform": "darwin",
|
||||||
|
"download_url": "https://github.com/actions/sometool/releases/tag/1.2.3-20200402.5/sometool-1.2.3-darwin-x64.tar.gz"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "sometool-1.2.3-win32-x64.tar.gz",
|
||||||
|
"arch": "x64",
|
||||||
|
"platform": "win32",
|
||||||
|
"download_url": "https://github.com/actions/sometool/releases/tag/1.2.3-20200402.5/sometool-1.2.3-win32-x64.tar.gz"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
@@ -0,0 +1,237 @@
|
|||||||
|
import fs from 'fs';
|
||||||
|
|
||||||
|
import * as utils from '../src/utils';
|
||||||
|
import {HttpClient} from '@actions/http-client';
|
||||||
|
import * as ifm from '@actions/http-client/interfaces';
|
||||||
|
import * as tc from '@actions/tool-cache';
|
||||||
|
import * as exec from '@actions/exec';
|
||||||
|
|
||||||
|
import * as path from 'path';
|
||||||
|
import * as semver from 'semver';
|
||||||
|
|
||||||
|
import * as finder from '../src/find-pypy';
|
||||||
|
import {
|
||||||
|
IPyPyManifestRelease,
|
||||||
|
IS_WINDOWS,
|
||||||
|
validateVersion,
|
||||||
|
getPyPyVersionFromPath
|
||||||
|
} from '../src/utils';
|
||||||
|
|
||||||
|
const manifestData = require('./data/pypy.json');
|
||||||
|
|
||||||
|
let architecture: string;
|
||||||
|
|
||||||
|
if (IS_WINDOWS) {
|
||||||
|
architecture = 'x86';
|
||||||
|
} else {
|
||||||
|
architecture = 'x64';
|
||||||
|
}
|
||||||
|
|
||||||
|
const toolDir = path.join(__dirname, 'runner', 'tools');
|
||||||
|
const tempDir = path.join(__dirname, 'runner', 'temp');
|
||||||
|
|
||||||
|
describe('parsePyPyVersion', () => {
|
||||||
|
it.each([
|
||||||
|
['pypy-3.6-v7.3.3', {pythonVersion: '3.6', pypyVersion: 'v7.3.3'}],
|
||||||
|
['pypy-3.6-v7.3.x', {pythonVersion: '3.6', pypyVersion: 'v7.3.x'}],
|
||||||
|
['pypy-3.6-v7.x', {pythonVersion: '3.6', pypyVersion: 'v7.x'}],
|
||||||
|
['pypy-3.6', {pythonVersion: '3.6', pypyVersion: 'x'}],
|
||||||
|
['pypy-3.6-nightly', {pythonVersion: '3.6', pypyVersion: 'nightly'}],
|
||||||
|
['pypy-3.6-v7.3.3rc1', {pythonVersion: '3.6', pypyVersion: 'v7.3.3-rc.1'}]
|
||||||
|
])('%s -> %s', (input, expected) => {
|
||||||
|
expect(finder.parsePyPyVersion(input)).toEqual(expected);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('throw on invalid input', () => {
|
||||||
|
expect(() => finder.parsePyPyVersion('pypy-')).toThrowError(
|
||||||
|
"Invalid 'version' property for PyPy. PyPy version should be specified as 'pypy-<python-version>'. See README for examples and documentation."
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('getPyPyVersionFromPath', () => {
|
||||||
|
it('/fake/toolcache/PyPy/3.6.5/x64 -> 3.6.5', () => {
|
||||||
|
expect(getPyPyVersionFromPath('/fake/toolcache/PyPy/3.6.5/x64')).toEqual(
|
||||||
|
'3.6.5'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('findPyPyToolCache', () => {
|
||||||
|
const actualPythonVersion = '3.6.17';
|
||||||
|
const actualPyPyVersion = '7.5.4';
|
||||||
|
const pypyPath = path.join('PyPy', actualPythonVersion, architecture);
|
||||||
|
let tcFind: jest.SpyInstance;
|
||||||
|
let spyReadExactPyPyVersion: jest.SpyInstance;
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
tcFind = jest.spyOn(tc, 'find');
|
||||||
|
tcFind.mockImplementation((toolname: string, pythonVersion: string) => {
|
||||||
|
const semverVersion = new semver.Range(pythonVersion);
|
||||||
|
return semver.satisfies(actualPythonVersion, semverVersion)
|
||||||
|
? pypyPath
|
||||||
|
: '';
|
||||||
|
});
|
||||||
|
|
||||||
|
spyReadExactPyPyVersion = jest.spyOn(utils, 'readExactPyPyVersionFile');
|
||||||
|
spyReadExactPyPyVersion.mockImplementation(() => actualPyPyVersion);
|
||||||
|
});
|
||||||
|
|
||||||
|
afterEach(() => {
|
||||||
|
jest.resetAllMocks();
|
||||||
|
jest.clearAllMocks();
|
||||||
|
jest.restoreAllMocks();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('PyPy exists on the path and versions are satisfied', () => {
|
||||||
|
expect(finder.findPyPyToolCache('3.6.17', 'v7.5.4', architecture)).toEqual({
|
||||||
|
installDir: pypyPath,
|
||||||
|
resolvedPythonVersion: actualPythonVersion,
|
||||||
|
resolvedPyPyVersion: actualPyPyVersion
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('PyPy exists on the path and versions are satisfied with semver', () => {
|
||||||
|
expect(finder.findPyPyToolCache('3.6', 'v7.5.x', architecture)).toEqual({
|
||||||
|
installDir: pypyPath,
|
||||||
|
resolvedPythonVersion: actualPythonVersion,
|
||||||
|
resolvedPyPyVersion: actualPyPyVersion
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it("PyPy exists on the path, but Python version doesn't match", () => {
|
||||||
|
expect(finder.findPyPyToolCache('3.7', 'v7.5.4', architecture)).toEqual({
|
||||||
|
installDir: '',
|
||||||
|
resolvedPythonVersion: '',
|
||||||
|
resolvedPyPyVersion: ''
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it("PyPy exists on the path, but PyPy version doesn't match", () => {
|
||||||
|
expect(finder.findPyPyToolCache('3.6', 'v7.5.1', architecture)).toEqual({
|
||||||
|
installDir: null,
|
||||||
|
resolvedPythonVersion: '',
|
||||||
|
resolvedPyPyVersion: ''
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('findPyPyVersion', () => {
|
||||||
|
let tcFind: jest.SpyInstance;
|
||||||
|
let spyExtractZip: jest.SpyInstance;
|
||||||
|
let spyExtractTar: jest.SpyInstance;
|
||||||
|
let spyHttpClient: jest.SpyInstance;
|
||||||
|
let spyExistsSync: jest.SpyInstance;
|
||||||
|
let spyExec: jest.SpyInstance;
|
||||||
|
let spySymlinkSync: jest.SpyInstance;
|
||||||
|
let spyDownloadTool: jest.SpyInstance;
|
||||||
|
let spyReadExactPyPyVersion: jest.SpyInstance;
|
||||||
|
let spyFsReadDir: jest.SpyInstance;
|
||||||
|
let spyWriteExactPyPyVersionFile: jest.SpyInstance;
|
||||||
|
let spyCacheDir: jest.SpyInstance;
|
||||||
|
let spyChmodSync: jest.SpyInstance;
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
tcFind = jest.spyOn(tc, 'find');
|
||||||
|
tcFind.mockImplementation((tool: string, version: string) => {
|
||||||
|
const semverRange = new semver.Range(version);
|
||||||
|
let pypyPath = '';
|
||||||
|
if (semver.satisfies('3.6.12', semverRange)) {
|
||||||
|
pypyPath = path.join(toolDir, 'PyPy', '3.6.12', architecture);
|
||||||
|
}
|
||||||
|
return pypyPath;
|
||||||
|
});
|
||||||
|
|
||||||
|
spyWriteExactPyPyVersionFile = jest.spyOn(
|
||||||
|
utils,
|
||||||
|
'writeExactPyPyVersionFile'
|
||||||
|
);
|
||||||
|
spyWriteExactPyPyVersionFile.mockImplementation(() => null);
|
||||||
|
|
||||||
|
spyReadExactPyPyVersion = jest.spyOn(utils, 'readExactPyPyVersionFile');
|
||||||
|
spyReadExactPyPyVersion.mockImplementation(() => '7.3.3');
|
||||||
|
|
||||||
|
spyDownloadTool = jest.spyOn(tc, 'downloadTool');
|
||||||
|
spyDownloadTool.mockImplementation(() => path.join(tempDir, 'PyPy'));
|
||||||
|
|
||||||
|
spyExtractZip = jest.spyOn(tc, 'extractZip');
|
||||||
|
spyExtractZip.mockImplementation(() => tempDir);
|
||||||
|
|
||||||
|
spyExtractTar = jest.spyOn(tc, 'extractTar');
|
||||||
|
spyExtractTar.mockImplementation(() => tempDir);
|
||||||
|
|
||||||
|
spyFsReadDir = jest.spyOn(fs, 'readdirSync');
|
||||||
|
spyFsReadDir.mockImplementation((directory: string) => ['PyPyTest']);
|
||||||
|
|
||||||
|
spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson');
|
||||||
|
spyHttpClient.mockImplementation(
|
||||||
|
async (): Promise<ifm.ITypedResponse<IPyPyManifestRelease[]>> => {
|
||||||
|
const result = JSON.stringify(manifestData);
|
||||||
|
return {
|
||||||
|
statusCode: 200,
|
||||||
|
headers: {},
|
||||||
|
result: JSON.parse(result) as IPyPyManifestRelease[]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
spyExec = jest.spyOn(exec, 'exec');
|
||||||
|
spyExec.mockImplementation(() => undefined);
|
||||||
|
|
||||||
|
spySymlinkSync = jest.spyOn(fs, 'symlinkSync');
|
||||||
|
spySymlinkSync.mockImplementation(() => undefined);
|
||||||
|
|
||||||
|
spyExistsSync = jest.spyOn(fs, 'existsSync');
|
||||||
|
spyExistsSync.mockReturnValue(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
afterEach(() => {
|
||||||
|
jest.resetAllMocks();
|
||||||
|
jest.clearAllMocks();
|
||||||
|
jest.restoreAllMocks();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('found PyPy in toolcache', async () => {
|
||||||
|
await expect(
|
||||||
|
finder.findPyPyVersion('pypy-3.6-v7.3.x', architecture)
|
||||||
|
).resolves.toEqual({
|
||||||
|
resolvedPythonVersion: '3.6.12',
|
||||||
|
resolvedPyPyVersion: '7.3.3'
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('throw on invalid input format', async () => {
|
||||||
|
await expect(
|
||||||
|
finder.findPyPyVersion('pypy3.7-v7.3.x', architecture)
|
||||||
|
).rejects.toThrow();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('throw on invalid input format pypy3.7-7.3.x', async () => {
|
||||||
|
await expect(
|
||||||
|
finder.findPyPyVersion('pypy3.7-v7.3.x', architecture)
|
||||||
|
).rejects.toThrow();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('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)
|
||||||
|
).resolves.toEqual({
|
||||||
|
resolvedPythonVersion: '3.7.9',
|
||||||
|
resolvedPyPyVersion: '7.3.3'
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('throw if release is not found', async () => {
|
||||||
|
await expect(
|
||||||
|
finder.findPyPyVersion('pypy-3.7-v7.5.x', architecture)
|
||||||
|
).rejects.toThrowError(
|
||||||
|
`PyPy version 3.7 (v7.5.x) with arch ${architecture} not found`
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -18,19 +18,67 @@ const tempDir = path.join(
|
|||||||
process.env['RUNNER_TOOL_CACHE'] = toolDir;
|
process.env['RUNNER_TOOL_CACHE'] = toolDir;
|
||||||
process.env['RUNNER_TEMP'] = tempDir;
|
process.env['RUNNER_TEMP'] = tempDir;
|
||||||
|
|
||||||
|
import * as tc from '@actions/tool-cache';
|
||||||
import * as finder from '../src/find-python';
|
import * as finder from '../src/find-python';
|
||||||
|
import * as installer from '../src/install-python';
|
||||||
|
|
||||||
|
const manifestData = require('./data/versions-manifest.json');
|
||||||
|
|
||||||
describe('Finder tests', () => {
|
describe('Finder tests', () => {
|
||||||
|
afterEach(() => {
|
||||||
|
jest.resetAllMocks();
|
||||||
|
jest.clearAllMocks();
|
||||||
|
});
|
||||||
|
|
||||||
it('Finds Python if it is installed', async () => {
|
it('Finds Python if it is installed', async () => {
|
||||||
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 (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.findPythonVersion('3.x', 'x64');
|
await finder.findPythonVersion('3.x', 'x64');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('Finds stable Python version if it is not installed, but exists in the manifest', async () => {
|
||||||
|
const findSpy: jest.SpyInstance = jest.spyOn(tc, 'getManifestFromRepo');
|
||||||
|
findSpy.mockImplementation(() => <tc.IToolRelease[]>manifestData);
|
||||||
|
|
||||||
|
const installSpy: jest.SpyInstance = jest.spyOn(
|
||||||
|
installer,
|
||||||
|
'installCpythonFromRelease'
|
||||||
|
);
|
||||||
|
installSpy.mockImplementation(async () => {
|
||||||
|
const pythonDir: string = path.join(toolDir, 'Python', '1.2.3', 'x64');
|
||||||
|
await io.mkdirP(pythonDir);
|
||||||
|
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.findPythonVersion('1.2.3', 'x64');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Finds pre-release Python version in the manifest', async () => {
|
||||||
|
const findSpy: jest.SpyInstance = jest.spyOn(tc, 'getManifestFromRepo');
|
||||||
|
findSpy.mockImplementation(() => <tc.IToolRelease[]>manifestData);
|
||||||
|
|
||||||
|
const installSpy: jest.SpyInstance = jest.spyOn(
|
||||||
|
installer,
|
||||||
|
'installCpythonFromRelease'
|
||||||
|
);
|
||||||
|
installSpy.mockImplementation(async () => {
|
||||||
|
const pythonDir: string = path.join(
|
||||||
|
toolDir,
|
||||||
|
'Python',
|
||||||
|
'1.2.3-beta.2',
|
||||||
|
'x64'
|
||||||
|
);
|
||||||
|
await io.mkdirP(pythonDir);
|
||||||
|
fs.writeFileSync(`${pythonDir}.complete`, 'hello');
|
||||||
|
});
|
||||||
|
// This will throw if it doesn't find it in the manifest (because no such version exists)
|
||||||
|
await finder.findPythonVersion('1.2.3-beta.2', 'x64');
|
||||||
|
});
|
||||||
|
|
||||||
it('Errors if Python is not installed', async () => {
|
it('Errors if Python is not installed', async () => {
|
||||||
// This will throw if it doesn't find it in the cache (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.findPythonVersion('3.300000', 'x64');
|
await finder.findPythonVersion('3.300000', 'x64');
|
||||||
|
|||||||
@@ -0,0 +1,230 @@
|
|||||||
|
import fs from 'fs';
|
||||||
|
|
||||||
|
import {HttpClient} from '@actions/http-client';
|
||||||
|
import * as ifm from '@actions/http-client/interfaces';
|
||||||
|
import * as tc from '@actions/tool-cache';
|
||||||
|
import * as exec from '@actions/exec';
|
||||||
|
import * as path from 'path';
|
||||||
|
|
||||||
|
import * as installer from '../src/install-pypy';
|
||||||
|
import {
|
||||||
|
IPyPyManifestRelease,
|
||||||
|
IPyPyManifestAsset,
|
||||||
|
IS_WINDOWS
|
||||||
|
} from '../src/utils';
|
||||||
|
|
||||||
|
const manifestData = require('./data/pypy.json');
|
||||||
|
|
||||||
|
let architecture: string;
|
||||||
|
if (IS_WINDOWS) {
|
||||||
|
architecture = 'x86';
|
||||||
|
} else {
|
||||||
|
architecture = 'x64';
|
||||||
|
}
|
||||||
|
|
||||||
|
const toolDir = path.join(__dirname, 'runner', 'tools');
|
||||||
|
const tempDir = path.join(__dirname, 'runner', 'temp');
|
||||||
|
|
||||||
|
describe('pypyVersionToSemantic', () => {
|
||||||
|
it.each([
|
||||||
|
['7.3.3rc1', '7.3.3-rc.1'],
|
||||||
|
['7.3.3', '7.3.3'],
|
||||||
|
['7.3.x', '7.3.x'],
|
||||||
|
['7.x', '7.x'],
|
||||||
|
['nightly', 'nightly']
|
||||||
|
])('%s -> %s', (input, expected) => {
|
||||||
|
expect(installer.pypyVersionToSemantic(input)).toEqual(expected);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('findRelease', () => {
|
||||||
|
const result = JSON.stringify(manifestData);
|
||||||
|
const releases = JSON.parse(result) as IPyPyManifestRelease[];
|
||||||
|
const extension = IS_WINDOWS ? '.zip' : '.tar.bz2';
|
||||||
|
const extensionName = IS_WINDOWS
|
||||||
|
? `${process.platform}${extension}`
|
||||||
|
: `${process.platform}64${extension}`;
|
||||||
|
const files: IPyPyManifestAsset = {
|
||||||
|
filename: `pypy3.6-v7.3.3-${extensionName}`,
|
||||||
|
arch: architecture,
|
||||||
|
platform: process.platform,
|
||||||
|
download_url: `https://test.download.python.org/pypy/pypy3.6-v7.3.3-${extensionName}`
|
||||||
|
};
|
||||||
|
|
||||||
|
it("Python version is found, but PyPy version doesn't match", () => {
|
||||||
|
const pythonVersion = '3.6';
|
||||||
|
const pypyVersion = '7.3.7';
|
||||||
|
expect(
|
||||||
|
installer.findRelease(releases, pythonVersion, pypyVersion, architecture)
|
||||||
|
).toEqual(null);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Python version is found and PyPy version matches', () => {
|
||||||
|
const pythonVersion = '3.6';
|
||||||
|
const pypyVersion = '7.3.3';
|
||||||
|
expect(
|
||||||
|
installer.findRelease(releases, pythonVersion, pypyVersion, architecture)
|
||||||
|
).toEqual({
|
||||||
|
foundAsset: files,
|
||||||
|
resolvedPythonVersion: '3.6.12',
|
||||||
|
resolvedPyPyVersion: pypyVersion
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Python version is found in toolcache and PyPy version matches semver', () => {
|
||||||
|
const pythonVersion = '3.6';
|
||||||
|
const pypyVersion = '7.x';
|
||||||
|
expect(
|
||||||
|
installer.findRelease(releases, pythonVersion, pypyVersion, architecture)
|
||||||
|
).toEqual({
|
||||||
|
foundAsset: files,
|
||||||
|
resolvedPythonVersion: '3.6.12',
|
||||||
|
resolvedPyPyVersion: '7.3.3'
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Python and preview version of PyPy are found', () => {
|
||||||
|
const pythonVersion = '3.7';
|
||||||
|
const pypyVersion = installer.pypyVersionToSemantic('7.3.3rc2');
|
||||||
|
expect(
|
||||||
|
installer.findRelease(releases, pythonVersion, pypyVersion, architecture)
|
||||||
|
).toEqual({
|
||||||
|
foundAsset: {
|
||||||
|
filename: `test${extension}`,
|
||||||
|
arch: architecture,
|
||||||
|
platform: process.platform,
|
||||||
|
download_url: `test${extension}`
|
||||||
|
},
|
||||||
|
resolvedPythonVersion: '3.7.7',
|
||||||
|
resolvedPyPyVersion: '7.3.3rc2'
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Python version with latest PyPy is found', () => {
|
||||||
|
const pythonVersion = '3.6';
|
||||||
|
const pypyVersion = 'x';
|
||||||
|
expect(
|
||||||
|
installer.findRelease(releases, pythonVersion, pypyVersion, architecture)
|
||||||
|
).toEqual({
|
||||||
|
foundAsset: files,
|
||||||
|
resolvedPythonVersion: '3.6.12',
|
||||||
|
resolvedPyPyVersion: '7.3.3'
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Nightly release is found', () => {
|
||||||
|
const pythonVersion = '3.6';
|
||||||
|
const pypyVersion = 'nightly';
|
||||||
|
const filename = IS_WINDOWS ? 'filename.zip' : 'filename.tar.bz2';
|
||||||
|
expect(
|
||||||
|
installer.findRelease(releases, pythonVersion, pypyVersion, architecture)
|
||||||
|
).toEqual({
|
||||||
|
foundAsset: {
|
||||||
|
filename: filename,
|
||||||
|
arch: architecture,
|
||||||
|
platform: process.platform,
|
||||||
|
download_url: `http://nightlyBuilds.org/${filename}`
|
||||||
|
},
|
||||||
|
resolvedPythonVersion: '3.6',
|
||||||
|
resolvedPyPyVersion: pypyVersion
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('installPyPy', () => {
|
||||||
|
let tcFind: jest.SpyInstance;
|
||||||
|
let spyExtractZip: jest.SpyInstance;
|
||||||
|
let spyExtractTar: jest.SpyInstance;
|
||||||
|
let spyFsReadDir: jest.SpyInstance;
|
||||||
|
let spyFsWriteFile: jest.SpyInstance;
|
||||||
|
let spyHttpClient: jest.SpyInstance;
|
||||||
|
let spyExistsSync: jest.SpyInstance;
|
||||||
|
let spyExec: jest.SpyInstance;
|
||||||
|
let spySymlinkSync: jest.SpyInstance;
|
||||||
|
let spyDownloadTool: jest.SpyInstance;
|
||||||
|
let spyCacheDir: jest.SpyInstance;
|
||||||
|
let spyChmodSync: jest.SpyInstance;
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
tcFind = jest.spyOn(tc, 'find');
|
||||||
|
tcFind.mockImplementation(() => path.join('PyPy', '3.6.12', architecture));
|
||||||
|
|
||||||
|
spyDownloadTool = jest.spyOn(tc, 'downloadTool');
|
||||||
|
spyDownloadTool.mockImplementation(() => path.join(tempDir, 'PyPy'));
|
||||||
|
|
||||||
|
spyExtractZip = jest.spyOn(tc, 'extractZip');
|
||||||
|
spyExtractZip.mockImplementation(() => tempDir);
|
||||||
|
|
||||||
|
spyExtractTar = jest.spyOn(tc, 'extractTar');
|
||||||
|
spyExtractTar.mockImplementation(() => tempDir);
|
||||||
|
|
||||||
|
spyFsReadDir = jest.spyOn(fs, 'readdirSync');
|
||||||
|
spyFsReadDir.mockImplementation(() => ['PyPyTest']);
|
||||||
|
|
||||||
|
spyFsWriteFile = jest.spyOn(fs, 'writeFileSync');
|
||||||
|
spyFsWriteFile.mockImplementation(() => undefined);
|
||||||
|
|
||||||
|
spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson');
|
||||||
|
spyHttpClient.mockImplementation(
|
||||||
|
async (): Promise<ifm.ITypedResponse<IPyPyManifestRelease[]>> => {
|
||||||
|
const result = JSON.stringify(manifestData);
|
||||||
|
return {
|
||||||
|
statusCode: 200,
|
||||||
|
headers: {},
|
||||||
|
result: JSON.parse(result) as IPyPyManifestRelease[]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
spyExec = jest.spyOn(exec, 'exec');
|
||||||
|
spyExec.mockImplementation(() => undefined);
|
||||||
|
|
||||||
|
spySymlinkSync = jest.spyOn(fs, 'symlinkSync');
|
||||||
|
spySymlinkSync.mockImplementation(() => undefined);
|
||||||
|
|
||||||
|
spyExistsSync = jest.spyOn(fs, 'existsSync');
|
||||||
|
spyExistsSync.mockImplementation(() => false);
|
||||||
|
});
|
||||||
|
|
||||||
|
afterEach(() => {
|
||||||
|
jest.resetAllMocks();
|
||||||
|
jest.clearAllMocks();
|
||||||
|
jest.restoreAllMocks();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('throw if release is not found', async () => {
|
||||||
|
await expect(
|
||||||
|
installer.installPyPy('7.3.3', '3.6.17', architecture)
|
||||||
|
).rejects.toThrowError(
|
||||||
|
`PyPy version 3.6.17 (7.3.3) with arch ${architecture} not found`
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(spyHttpClient).toHaveBeenCalled();
|
||||||
|
expect(spyDownloadTool).not.toHaveBeenCalled();
|
||||||
|
expect(spyExec).not.toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('found and install PyPy', async () => {
|
||||||
|
spyCacheDir = jest.spyOn(tc, 'cacheDir');
|
||||||
|
spyCacheDir.mockImplementation(() =>
|
||||||
|
path.join(toolDir, 'PyPy', '3.6.12', architecture)
|
||||||
|
);
|
||||||
|
|
||||||
|
spyChmodSync = jest.spyOn(fs, 'chmodSync');
|
||||||
|
spyChmodSync.mockImplementation(() => undefined);
|
||||||
|
|
||||||
|
await expect(
|
||||||
|
installer.installPyPy('7.3.x', '3.6.12', architecture)
|
||||||
|
).resolves.toEqual({
|
||||||
|
installDir: path.join(toolDir, 'PyPy', '3.6.12', architecture),
|
||||||
|
resolvedPythonVersion: '3.6.12',
|
||||||
|
resolvedPyPyVersion: '7.3.3'
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(spyHttpClient).toHaveBeenCalled();
|
||||||
|
expect(spyDownloadTool).toHaveBeenCalled();
|
||||||
|
expect(spyExistsSync).toHaveBeenCalled();
|
||||||
|
expect(spyCacheDir).toHaveBeenCalled();
|
||||||
|
expect(spyExec).toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
import {
|
||||||
|
validateVersion,
|
||||||
|
validatePythonVersionFormatForPyPy
|
||||||
|
} from '../src/utils';
|
||||||
|
|
||||||
|
describe('validatePythonVersionFormatForPyPy', () => {
|
||||||
|
it.each([
|
||||||
|
['3.6', true],
|
||||||
|
['3.7', true],
|
||||||
|
['3.6.x', false],
|
||||||
|
['3.7.x', false],
|
||||||
|
['3.x', false],
|
||||||
|
['3', false]
|
||||||
|
])('%s -> %s', (input, expected) => {
|
||||||
|
expect(validatePythonVersionFormatForPyPy(input)).toEqual(expected);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('validateVersion', () => {
|
||||||
|
it.each([
|
||||||
|
['v7.3.3', true],
|
||||||
|
['v7.3.x', true],
|
||||||
|
['v7.x', true],
|
||||||
|
['x', true],
|
||||||
|
['v7.3.3-rc.1', true],
|
||||||
|
['nightly', true],
|
||||||
|
['v7.3.b', false],
|
||||||
|
['3.6', true],
|
||||||
|
['3.b', false],
|
||||||
|
['3', true]
|
||||||
|
])('%s -> %s', (input, expected) => {
|
||||||
|
expect(validateVersion(input)).toEqual(expected);
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
import sys
|
||||||
|
argCount = len(sys.argv) - 1
|
||||||
|
|
||||||
|
if argCount == 1:
|
||||||
|
expectedVersion = sys.argv[1]
|
||||||
|
versions = len(expectedVersion.split("."))
|
||||||
|
majorMinor = str(sys.version_info[0]) + '.' + str(sys.version_info[1])
|
||||||
|
|
||||||
|
if versions == 2:
|
||||||
|
# Test only major and minor version
|
||||||
|
if expectedVersion != majorMinor:
|
||||||
|
raise Exception("Incorrect major + minor version detected\nExpected: " + expectedVersion + "\nActual: " + majorMinor)
|
||||||
|
elif versions == 3:
|
||||||
|
# Test major, minor and micro version
|
||||||
|
majorMinorMicro = majorMinor + '.' + str(sys.version_info[2])
|
||||||
|
if expectedVersion != majorMinorMicro:
|
||||||
|
raise Exception("Incorrect major + minor + micro version detected\nExpected: " + expectedVersion + "\nActual: " + majorMinorMicro)
|
||||||
|
else:
|
||||||
|
raise Exception("Incorrect number of arguments supplied")
|
||||||
|
print("Correct version of Python " + expectedVersion + " detected")
|
||||||
|
else:
|
||||||
|
raise Exception("Incorrect number of arguments supplied")
|
||||||
+11
-2
@@ -6,15 +6,24 @@ inputs:
|
|||||||
python-version:
|
python-version:
|
||||||
description: "Version range or exact version of a Python version to use, using SemVer's version range syntax."
|
description: "Version range or exact version of a Python version to use, using SemVer's version range syntax."
|
||||||
default: '3.x'
|
default: '3.x'
|
||||||
|
cache:
|
||||||
|
description: 'Used to specify a package manager for caching in the default directory. Supported values: pip, pipenv.'
|
||||||
|
required: false
|
||||||
architecture:
|
architecture:
|
||||||
description: 'The target architecture (x86, x64) of the Python interpreter.'
|
description: 'The target architecture (x86, x64) of the Python interpreter.'
|
||||||
default: 'x64'
|
token:
|
||||||
|
description: Used to pull python distributions from actions/python-versions. Since there's a default, this is typically not supplied by the user.
|
||||||
|
default: ${{ github.token }}
|
||||||
|
cache-dependency-path:
|
||||||
|
description: 'Used to specify the path to dependency files. Supports wildcards or a list of file names for caching multiple dependencies.'
|
||||||
outputs:
|
outputs:
|
||||||
python-version:
|
python-version:
|
||||||
description: "The installed python version. Useful when given a version range as input."
|
description: "The installed python version. Useful when given a version range as input."
|
||||||
runs:
|
runs:
|
||||||
using: 'node12'
|
using: 'node12'
|
||||||
main: 'dist/index.js'
|
main: 'dist/setup/index.js'
|
||||||
|
post: 'dist/cache-save/index.js'
|
||||||
|
post-if: success()
|
||||||
branding:
|
branding:
|
||||||
icon: 'code'
|
icon: 'code'
|
||||||
color: 'yellow'
|
color: 'yellow'
|
||||||
|
|||||||
Vendored
+58329
File diff suppressed because one or more lines are too long
Vendored
-6936
File diff suppressed because it is too large
Load Diff
Vendored
+65058
File diff suppressed because one or more lines are too long
+11
-5
@@ -8,24 +8,30 @@
|
|||||||
|
|
||||||
### NCC
|
### NCC
|
||||||
|
|
||||||
In order to avoid uploading `node_modules/` to the repository, we use [zeit/ncc](https://github.com/zeit/ncc) to create a single `index.js` file that gets saved in `dist/`.
|
In order to avoid uploading `node_modules/` to the repository, we use [vercel/ncc](https://github.com/vercel/ncc) to create a single `index.js` file that gets saved in `dist/`.
|
||||||
|
|
||||||
### Developing
|
### Developing
|
||||||
|
|
||||||
If you're developing locally, you can run
|
If you're developing locally, you can run
|
||||||
```
|
|
||||||
|
```sh
|
||||||
npm install
|
npm install
|
||||||
tsc
|
tsc
|
||||||
ncc build
|
ncc build src/setup-python.ts
|
||||||
```
|
```
|
||||||
Any files generated using `tsc` will be added to `lib/`, however those files also are not uploaded to the repository and are exluded using `.gitignore`.
|
|
||||||
|
|
||||||
During the commit step, Husky will take care of formatting all files with [Prettier](https://github.com/prettier/prettier)
|
Any files generated using `tsc` will be added to `lib/`, however those files also are not uploaded to the repository and are excluded using `.gitignore`.
|
||||||
|
|
||||||
|
During the commit step, Husky will take care of formatting all files with [Prettier](https://github.com/prettier/prettier) (to run manually, use `npm run format`).
|
||||||
|
|
||||||
### Testing
|
### Testing
|
||||||
|
|
||||||
We ask that you include a link to a successful run that utilizes the changes you are working on. For example, if your changes are in the branch `newAwesomeFeature`, then show an example run that uses `setup-python@newAwesomeFeature` or `my-fork@newAwesomeFeature`. This will help speed up testing and help us confirm that there are no breaking changes or bugs.
|
We ask that you include a link to a successful run that utilizes the changes you are working on. For example, if your changes are in the branch `newAwesomeFeature`, then show an example run that uses `setup-python@newAwesomeFeature` or `my-fork@newAwesomeFeature`. This will help speed up testing and help us confirm that there are no breaking changes or bugs.
|
||||||
|
|
||||||
|
### Licensed
|
||||||
|
|
||||||
|
This repository uses a tool called [Licensed](https://github.com/github/licensed) to verify third party dependencies. You may need to locally install licensed and run `licensed cache` to update the dependency cache if you install or update a production dependency. If licensed cache is unable to determine the dependency, you may need to modify the cache file yourself to put the correct license. You should still verify the dependency, licensed is a tool to help, but is not a substitute for human review of dependencies.
|
||||||
|
|
||||||
### Releases
|
### Releases
|
||||||
|
|
||||||
There is a `master` branch where contributor changes are merged into. There are also release branches such as `releases/v1` that are used for tagging (for example the `v1` tag) and publishing new versions of the action. Changes from `master` are periodically merged into a releases branch. You do not need to create any PR that merges changes from master into a releases branch.
|
There is a `master` branch where contributor changes are merged into. There are also release branches such as `releases/v1` that are used for tagging (for example the `v1` tag) and publishing new versions of the action. Changes from `master` are periodically merged into a releases branch. You do not need to create any PR that merges changes from master into a releases branch.
|
||||||
|
|||||||
Generated
+7091
-2997
File diff suppressed because it is too large
Load Diff
+16
-13
@@ -1,14 +1,14 @@
|
|||||||
{
|
{
|
||||||
"name": "setup-python",
|
"name": "setup-python",
|
||||||
"version": "1.0.0",
|
"version": "2.2.2",
|
||||||
"private": true,
|
"private": true,
|
||||||
"description": "Setup python action",
|
"description": "Setup python action",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "tsc",
|
"build": "tsc",
|
||||||
"format": "prettier --write **/*.ts",
|
"format": "prettier --write \"{,!(node_modules)/**/}*.ts\"",
|
||||||
"format-check": "prettier --check **/*.ts",
|
"format-check": "prettier --check \"{,!(node_modules)/**/}*.ts\"",
|
||||||
"release": "ncc build src/setup-python.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"
|
"test": "jest"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
@@ -23,21 +23,24 @@
|
|||||||
"author": "GitHub",
|
"author": "GitHub",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^1.2.6",
|
"@actions/cache": "^1.0.7",
|
||||||
|
"@actions/core": "^1.2.3",
|
||||||
|
"@actions/exec": "^1.1.0",
|
||||||
|
"@actions/glob": "^0.2.0",
|
||||||
|
"@actions/io": "^1.0.2",
|
||||||
|
"@actions/tool-cache": "^1.5.5",
|
||||||
"semver": "^7.1.3"
|
"semver": "^7.1.3"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@actions/io": "^1.0.2",
|
"@types/jest": "^27.0.2",
|
||||||
"@actions/tool-cache": "^1.3.3",
|
"@types/node": "^12.20.36",
|
||||||
"@types/jest": "^25.1.4",
|
|
||||||
"@types/node": "^12.12.31",
|
|
||||||
"@types/semver": "^7.1.0",
|
"@types/semver": "^7.1.0",
|
||||||
"@zeit/ncc": "^0.22.0",
|
"@zeit/ncc": "^0.22.0",
|
||||||
"husky": "^4.2.3",
|
"husky": "^7.0.2",
|
||||||
"jest": "^25.1.0",
|
"jest": "^27.2.5",
|
||||||
"jest-circus": "^25.1.0",
|
"jest-circus": "^27.2.5",
|
||||||
"prettier": "^2.0.2",
|
"prettier": "^2.0.2",
|
||||||
"ts-jest": "^25.2.1",
|
"ts-jest": "^27.0.5",
|
||||||
"typescript": "^3.8.3"
|
"typescript": "^3.8.3"
|
||||||
},
|
},
|
||||||
"husky": {
|
"husky": {
|
||||||
|
|||||||
@@ -0,0 +1,53 @@
|
|||||||
|
import * as cache from '@actions/cache';
|
||||||
|
import * as core from '@actions/core';
|
||||||
|
|
||||||
|
export enum State {
|
||||||
|
STATE_CACHE_PRIMARY_KEY = 'cache-primary-key',
|
||||||
|
CACHE_MATCHED_KEY = 'cache-matched-key',
|
||||||
|
CACHE_PATHS = 'cache-paths'
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class CacheDistributor {
|
||||||
|
protected CACHE_KEY_PREFIX = 'setup-python';
|
||||||
|
constructor(
|
||||||
|
protected packageManager: string,
|
||||||
|
protected cacheDependencyPath: string
|
||||||
|
) {}
|
||||||
|
|
||||||
|
protected abstract getCacheGlobalDirectories(): Promise<string[]>;
|
||||||
|
protected abstract computeKeys(): Promise<{
|
||||||
|
primaryKey: string;
|
||||||
|
restoreKey: string[] | undefined;
|
||||||
|
}>;
|
||||||
|
|
||||||
|
public async restoreCache() {
|
||||||
|
const {primaryKey, restoreKey} = await this.computeKeys();
|
||||||
|
if (primaryKey.endsWith('-')) {
|
||||||
|
throw new Error(
|
||||||
|
`No file in ${process.cwd()} matched to [${this.cacheDependencyPath
|
||||||
|
.split('\n')
|
||||||
|
.join(',')}], make sure you have checked out the target repository`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const cachePath = await this.getCacheGlobalDirectories();
|
||||||
|
|
||||||
|
core.saveState(State.CACHE_PATHS, cachePath);
|
||||||
|
core.saveState(State.STATE_CACHE_PRIMARY_KEY, primaryKey);
|
||||||
|
|
||||||
|
const matchedKey = await cache.restoreCache(
|
||||||
|
cachePath,
|
||||||
|
primaryKey,
|
||||||
|
restoreKey
|
||||||
|
);
|
||||||
|
|
||||||
|
if (matchedKey) {
|
||||||
|
core.saveState(State.CACHE_MATCHED_KEY, matchedKey);
|
||||||
|
core.info(`Cache restored from key: ${matchedKey}`);
|
||||||
|
} else {
|
||||||
|
core.info(`${this.packageManager} cache is not found`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default CacheDistributor;
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
import PipCache from './pip-cache';
|
||||||
|
import PipenvCache from './pipenv-cache';
|
||||||
|
|
||||||
|
export enum PackageManagers {
|
||||||
|
Pip = 'pip',
|
||||||
|
Pipenv = 'pipenv'
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getCacheDistributor(
|
||||||
|
packageManager: string,
|
||||||
|
pythonVersion: string,
|
||||||
|
cacheDependencyPath: string | undefined
|
||||||
|
) {
|
||||||
|
switch (packageManager) {
|
||||||
|
case PackageManagers.Pip:
|
||||||
|
return new PipCache(cacheDependencyPath);
|
||||||
|
case PackageManagers.Pipenv:
|
||||||
|
return new PipenvCache(pythonVersion, cacheDependencyPath);
|
||||||
|
default:
|
||||||
|
throw new Error(`Caching for '${packageManager}' is not supported`);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
import * as glob from '@actions/glob';
|
||||||
|
import * as core from '@actions/core';
|
||||||
|
import * as exec from '@actions/exec';
|
||||||
|
|
||||||
|
import * as path from 'path';
|
||||||
|
import os from 'os';
|
||||||
|
|
||||||
|
import CacheDistributor from './cache-distributor';
|
||||||
|
|
||||||
|
class PipCache extends CacheDistributor {
|
||||||
|
constructor(cacheDependencyPath: string = '**/requirements.txt') {
|
||||||
|
super('pip', cacheDependencyPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected async getCacheGlobalDirectories() {
|
||||||
|
const {stdout, stderr, exitCode} = await exec.getExecOutput(
|
||||||
|
'pip cache dir'
|
||||||
|
);
|
||||||
|
|
||||||
|
if (exitCode && stderr) {
|
||||||
|
throw new Error(
|
||||||
|
`Could not get cache folder path for pip package manager`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
let resolvedPath = stdout.trim();
|
||||||
|
|
||||||
|
if (resolvedPath.includes('~')) {
|
||||||
|
resolvedPath = path.join(os.homedir(), resolvedPath.slice(1));
|
||||||
|
}
|
||||||
|
|
||||||
|
core.debug(`global cache directory path is ${resolvedPath}`);
|
||||||
|
|
||||||
|
return [resolvedPath];
|
||||||
|
}
|
||||||
|
|
||||||
|
protected async computeKeys() {
|
||||||
|
const hash = await glob.hashFiles(this.cacheDependencyPath);
|
||||||
|
const primaryKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-${this.packageManager}-${hash}`;
|
||||||
|
const restoreKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-${this.packageManager}`;
|
||||||
|
|
||||||
|
return {
|
||||||
|
primaryKey,
|
||||||
|
restoreKey: [restoreKey]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default PipCache;
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
import * as glob from '@actions/glob';
|
||||||
|
import * as os from 'os';
|
||||||
|
import * as path from 'path';
|
||||||
|
import * as core from '@actions/core';
|
||||||
|
|
||||||
|
import CacheDistributor from './cache-distributor';
|
||||||
|
|
||||||
|
class PipenvCache extends CacheDistributor {
|
||||||
|
constructor(
|
||||||
|
private pythonVersion: string,
|
||||||
|
protected patterns: string = '**/Pipfile.lock'
|
||||||
|
) {
|
||||||
|
super('pipenv', patterns);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected async getCacheGlobalDirectories() {
|
||||||
|
let virtualEnvRelativePath;
|
||||||
|
|
||||||
|
// Default virtualenv directories are hardcoded,
|
||||||
|
// because pipenv is not preinstalled on hosted images and virtualenv is not created:
|
||||||
|
// https://github.com/pypa/pipenv/blob/1daaa0de9a0b00d386c6baeb809d8d4ee6795cfd/pipenv/utils.py#L1990-L2002
|
||||||
|
if (process.platform === 'win32') {
|
||||||
|
virtualEnvRelativePath = '.virtualenvs';
|
||||||
|
} else {
|
||||||
|
virtualEnvRelativePath = '.local/share/virtualenvs';
|
||||||
|
}
|
||||||
|
const resolvedPath = path.join(os.homedir(), virtualEnvRelativePath);
|
||||||
|
core.debug(`global cache directory path is ${resolvedPath}`);
|
||||||
|
|
||||||
|
return [resolvedPath];
|
||||||
|
}
|
||||||
|
|
||||||
|
protected async computeKeys() {
|
||||||
|
const hash = await glob.hashFiles(this.patterns);
|
||||||
|
const primaryKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-python-${this.pythonVersion}-${this.packageManager}-${hash}`;
|
||||||
|
const restoreKey = undefined;
|
||||||
|
return {
|
||||||
|
primaryKey,
|
||||||
|
restoreKey
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default PipenvCache;
|
||||||
@@ -0,0 +1,67 @@
|
|||||||
|
import * as core from '@actions/core';
|
||||||
|
import * as cache from '@actions/cache';
|
||||||
|
|
||||||
|
import fs from 'fs';
|
||||||
|
import {State} from './cache-distributions/cache-distributor';
|
||||||
|
|
||||||
|
export async function run() {
|
||||||
|
try {
|
||||||
|
const cache = core.getInput('cache');
|
||||||
|
if (cache) {
|
||||||
|
await saveCache(cache);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
const err = error as Error;
|
||||||
|
core.setFailed(err.message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function saveCache(packageManager: string) {
|
||||||
|
const cachePaths = JSON.parse(core.getState(State.CACHE_PATHS)) as string[];
|
||||||
|
|
||||||
|
core.debug(`paths for caching are ${cachePaths.join(', ')}`);
|
||||||
|
|
||||||
|
if (!isCacheDirectoryExists(cachePaths)) {
|
||||||
|
throw new Error(
|
||||||
|
`Cache folder path is retrieved for ${packageManager} but doesn't exist on disk: ${cachePaths.join(
|
||||||
|
', '
|
||||||
|
)}`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const primaryKey = core.getState(State.STATE_CACHE_PRIMARY_KEY);
|
||||||
|
const matchedKey = core.getState(State.CACHE_MATCHED_KEY);
|
||||||
|
|
||||||
|
if (!primaryKey) {
|
||||||
|
core.warning('Error retrieving key from state.');
|
||||||
|
return;
|
||||||
|
} else if (matchedKey === primaryKey) {
|
||||||
|
// no change in target directories
|
||||||
|
core.info(
|
||||||
|
`Cache hit occurred on the primary key ${primaryKey}, not saving cache.`
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
await cache.saveCache(cachePaths, primaryKey);
|
||||||
|
core.info(`Cache saved with the key: ${primaryKey}`);
|
||||||
|
} catch (error) {
|
||||||
|
const err = error as Error;
|
||||||
|
if (err.name === cache.ReserveCacheError.name) {
|
||||||
|
core.info(err.message);
|
||||||
|
} else {
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function isCacheDirectoryExists(cacheDirectory: string[]) {
|
||||||
|
const result = cacheDirectory.reduce((previousValue, currentValue) => {
|
||||||
|
return previousValue || fs.existsSync(currentValue);
|
||||||
|
}, false);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
run();
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user