Compare commits

..

4 Commits
v1.2.1 ... v1

Author SHA1 Message Date
0f07f7f756 update actions/core (#625) 2023-03-27 13:07:33 +02:00
9f3aa2c73d Add test.yml to releases/v1 branch (#176)
* added test.yml

* replaced ubuntu-16.04 with ubuntu-20.04

Co-authored-by: Nikita Bykov <v-nibyko@microsoft.com>
2021-01-04 11:16:26 +01:00
152ba7c4dd added Scripts to PATH on Windows (#173)
Co-authored-by: Nikita Bykov <v-nibyko@microsoft.com>
2020-12-18 15:32:23 +01:00
da8703fb23 update dist file (#166) 2020-12-08 11:00:17 -05:00
5 changed files with 2405 additions and 268 deletions

77
.github/workflows/test.yml vendored Normal file
View File

@ -0,0 +1,77 @@
name: Validate 'setup-python'
on:
pull_request:
paths-ignore:
- '**.md'
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-python:
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, 3.6, 3.7, 3.8, 3.9]
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 ("$pythonVersion" -notlike "Python ${{ matrix.python }}.*"){
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-pypy:
name: Setup PyPy ${{ 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 pypy3
uses: ./
with:
python-version: 'pypy3'
- name: setup-python pypy2
uses: ./
with:
python-version: 'pypy2'

2550
dist/index.js vendored

File diff suppressed because it is too large Load Diff

28
package-lock.json generated
View File

@ -5,9 +5,28 @@
"requires": true, "requires": true,
"dependencies": { "dependencies": {
"@actions/core": { "@actions/core": {
"version": "1.2.6", "version": "1.10.0",
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.2.6.tgz", "resolved": "https://registry.npmjs.org/@actions/core/-/core-1.10.0.tgz",
"integrity": "sha512-ZQYitnqiyBc3D+k7LsgSBmMDVkOVidaagDG7j3fOym77jNunWRuYx7VSHa9GNfFZh+zh61xsCjRj4JxMZlDqTA==" "integrity": "sha512-2aZDDa3zrrZbP5ZYg159sNoLRb61nQ7awl5pSvIq5Qpj81vwDzdMRKzkWJGJuwVvWpvZKx7vspJALyvaaIQyug==",
"requires": {
"@actions/http-client": "^2.0.1",
"uuid": "^8.3.2"
},
"dependencies": {
"@actions/http-client": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-2.1.0.tgz",
"integrity": "sha512-BonhODnXr3amchh4qkmjPMUO8mFi/zLaaCeCAJZqch8iQqyDnVIkySjB38VHAC8IJ+bnlgfOqlhpyCUZHlQsqw==",
"requires": {
"tunnel": "^0.0.6"
}
},
"uuid": {
"version": "8.3.2",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz",
"integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg=="
}
}
}, },
"@actions/exec": { "@actions/exec": {
"version": "1.0.3", "version": "1.0.3",
@ -4543,8 +4562,7 @@
"tunnel": { "tunnel": {
"version": "0.0.6", "version": "0.0.6",
"resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.6.tgz", "resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.6.tgz",
"integrity": "sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==", "integrity": "sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg=="
"dev": true
}, },
"tunnel-agent": { "tunnel-agent": {
"version": "0.6.0", "version": "0.6.0",

View File

@ -23,7 +23,7 @@
"author": "GitHub", "author": "GitHub",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@actions/core": "^1.2.6", "@actions/core": "^1.10.0",
"semver": "^7.1.3" "semver": "^7.1.3"
}, },
"devDependencies": { "devDependencies": {

View File

@ -51,8 +51,11 @@ function binDir(installDir: string): string {
// A particular version of PyPy may contain one or more versions of the Python interpreter. // A particular version of PyPy may contain one or more versions of the Python interpreter.
// For example, PyPy 7.0 contains Python 2.7, 3.5, and 3.6-alpha. // For example, PyPy 7.0 contains Python 2.7, 3.5, and 3.6-alpha.
// We only care about the Python version, so we don't use the PyPy version for the tool cache. // We only care about the Python version, so we don't use the PyPy version for the tool cache.
function usePyPy(majorVersion: 2 | 3, architecture: string): InstalledVersion { function usePyPy(
const findPyPy = tc.find.bind(undefined, 'PyPy', majorVersion.toString()); majorVersion: '2' | '3.6',
architecture: string
): InstalledVersion {
const findPyPy = tc.find.bind(undefined, 'PyPy', majorVersion);
let installDir: string | null = findPyPy(architecture); let installDir: string | null = findPyPy(architecture);
if (!installDir && IS_WINDOWS) { if (!installDir && IS_WINDOWS) {
@ -77,6 +80,10 @@ function usePyPy(majorVersion: 2 | 3, architecture: string): InstalledVersion {
core.addPath(installDir); core.addPath(installDir);
core.addPath(_binDir); core.addPath(_binDir);
// Starting from PyPy 7.3.1, the folder that is used for pip and anything that pip installs should be "Scripts" on Windows.
if (IS_WINDOWS) {
core.addPath(path.join(installDir, 'Scripts'));
}
const impl = 'pypy' + majorVersion.toString(); const impl = 'pypy' + majorVersion.toString();
core.setOutput('python-version', impl); core.setOutput('python-version', impl);
@ -186,9 +193,10 @@ export async function findPythonVersion(
): Promise<InstalledVersion> { ): Promise<InstalledVersion> {
switch (version.toUpperCase()) { switch (version.toUpperCase()) {
case 'PYPY2': case 'PYPY2':
return usePyPy(2, architecture); return usePyPy('2', architecture);
case 'PYPY3': case 'PYPY3':
return usePyPy(3, architecture); // keep pypy3 pointing to 3.6 for backward compatibility
return usePyPy('3.6', architecture);
default: default:
return await useCpythonVersion(version, architecture); return await useCpythonVersion(version, architecture);
} }