Compare commits

..

9 Commits

Author SHA1 Message Date
d1ebd313e3 Bump eslint-plugin-jest from 27.9.0 to 29.0.1
Bumps [eslint-plugin-jest](https://github.com/jest-community/eslint-plugin-jest) from 27.9.0 to 29.0.1.
- [Release notes](https://github.com/jest-community/eslint-plugin-jest/releases)
- [Changelog](https://github.com/jest-community/eslint-plugin-jest/blob/main/CHANGELOG.md)
- [Commits](https://github.com/jest-community/eslint-plugin-jest/compare/v27.9.0...v29.0.1)

---
updated-dependencies:
- dependency-name: eslint-plugin-jest
  dependency-version: 29.0.1
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-06-23 04:06:36 +00:00
e9c40fbc2b Add support for pip-version (#1129)
* Add pip-version input

* Update workflow files

* Add documentation

* Update workflow files
2025-06-19 22:09:35 -05:00
5fa0ee6f38 Bump @actions/tool-cache from 2.0.1 to 2.0.2 (#1095)
* Bump @actions/tool-cache from 2.0.1 to 2.0.2

Bumps [@actions/tool-cache](https://github.com/actions/toolkit/tree/HEAD/packages/tool-cache) from 2.0.1 to 2.0.2.
- [Changelog](https://github.com/actions/toolkit/blob/main/packages/tool-cache/RELEASES.md)
- [Commits](https://github.com/actions/toolkit/commits/HEAD/packages/tool-cache)

---
updated-dependencies:
- dependency-name: "@actions/tool-cache"
  dependency-version: 2.0.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* Fix failures

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: HarithaVattikuti <73516759+HarithaVattikuti@users.noreply.github.com>
2025-06-18 17:01:16 -05:00
5db1cf9a59 Enhance reading from .python-version (#787)
* Enhance reading from .python-version

* Fix typos

* Fix lint

* Add built files

* Don't use EOL versions in `utils.test.ts`

* Fix Prettier

* Don't use unreleased versions in `utils.test.ts`

* Update versions in `utils.test.ts` again
2025-05-21 16:19:28 -05:00
a26af69be9 Bump ts-jest from 29.1.2 to 29.3.2 (#1081)
Bumps [ts-jest](https://github.com/kulshekhar/ts-jest) from 29.1.2 to 29.3.2.
- [Release notes](https://github.com/kulshekhar/ts-jest/releases)
- [Changelog](https://github.com/kulshekhar/ts-jest/blob/main/CHANGELOG.md)
- [Commits](https://github.com/kulshekhar/ts-jest/compare/v29.1.2...v29.3.2)

---
updated-dependencies:
- dependency-name: ts-jest
  dependency-version: 29.3.2
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-04-23 21:42:27 -05:00
30eafe9548 Bump prettier from 2.8.8 to 3.5.3 (#1046)
* Bump prettier from 2.8.8 to 3.5.3

Bumps [prettier](https://github.com/prettier/prettier) from 2.8.8 to 3.5.3.
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prettier/prettier/compare/2.8.8...3.5.3)

---
updated-dependencies:
- dependency-name: prettier
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* Enable cancelled checks

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Aparna Jyothi <aparnajyothi-y@github.com>
2025-04-22 11:07:10 -05:00
5d95bc16d4 Bump semver and @types/semver (#1091)
* Bump semver and @types/semver

Bumps [semver](https://github.com/npm/node-semver) and [@types/semver](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/semver). These dependencies needed to be updated together.

Updates `semver` from 7.6.0 to 7.7.1
- [Release notes](https://github.com/npm/node-semver/releases)
- [Changelog](https://github.com/npm/node-semver/blob/main/CHANGELOG.md)
- [Commits](https://github.com/npm/node-semver/compare/v7.6.0...v7.7.1)

Updates `@types/semver` from 7.5.8 to 7.7.0
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/semver)

---
updated-dependencies:
- dependency-name: semver
  dependency-version: 7.7.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
- dependency-name: "@types/semver"
  dependency-version: 7.7.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* Fixed check failures

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: HarithaVattikuti <73516759+HarithaVattikuti@users.noreply.github.com>
2025-04-22 11:04:22 -05:00
6ed2c67c8a Fix for Candidate Not Iterable Error (#1082)
* candidates not iterable

* update the error message

* update error to debug

* update debug to info

* error message updates
2025-04-17 08:55:44 -05:00
e348410e00 Remove Ubuntu 20.04 from workflows due to deprecation from 2025-04-15 (#1065)
* remove ubuntu-20.04

* check failure fix

* remove spaces

* npm run format-check
2025-04-11 13:36:23 -05:00
25 changed files with 880 additions and 1188 deletions

View File

@ -162,3 +162,60 @@ jobs:
run: curl https://raw.githubusercontent.com/pypa/pipenv/master/get-pipenv.py | python run: curl https://raw.githubusercontent.com/pypa/pipenv/master/get-pipenv.py | python
- name: Install dependencies - name: Install dependencies
run: pipenv install requests run: pipenv install requests
python-pip-dependencies-caching-with-pip-version:
name: Test pip (Python ${{ matrix.python-version}}, ${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
[
ubuntu-latest,
ubuntu-22.04,
ubuntu-24.04-arm,
ubuntu-22.04-arm,
windows-latest,
macos-latest,
macos-13
]
python-version: [3.13.0t, 3.13.1t, 3.13.2t]
steps:
- uses: actions/checkout@v4
- name: Setup Python
uses: ./
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
pip-version: '25.0.1'
- name: Install dependencies
run: pip install numpy pandas requests
python-pip-dependencies-caching-path-with-pip-version:
name: Test pip (Python ${{ matrix.python-version}}, ${{ matrix.os }}, caching path)
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
[
ubuntu-latest,
ubuntu-22.04,
ubuntu-24.04-arm,
ubuntu-22.04-arm,
windows-latest,
macos-latest,
macos-13
]
python-version: [3.13.0t, 3.13.1t, 3.13.2t]
steps:
- uses: actions/checkout@v4
- name: Setup Python
uses: ./
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache-dependency-path: __tests__/data/requirements.txt
pip-version: '25.0.1'
- name: Install dependencies
run: pip install numpy pandas requests

View File

@ -78,8 +78,12 @@ jobs:
python-version: pypy-3.11-v7.x python-version: pypy-3.11-v7.x
- os: ubuntu-22.04 - os: ubuntu-22.04
python-version: pypy-3.11-v7.x python-version: pypy-3.11-v7.x
- os: ubuntu-22.04-arm
python-version: pypy-3.10-v7.x
- os: ubuntu-22.04-arm - os: ubuntu-22.04-arm
python-version: pypy-3.11-v7.x python-version: pypy-3.11-v7.x
- os: ubuntu-22.04-arm
python-version: pypy-3.10-v7.x
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Setup Python - name: Setup Python
@ -245,3 +249,60 @@ jobs:
} }
- name: Run Python Script - name: Run Python Script
run: pipenv run python test-pipenv.py run: pipenv run python test-pipenv.py
python-pip-dependencies-caching-with-pip-version:
name: Test pip (Python ${{ matrix.python-version}}, ${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
[
ubuntu-latest,
ubuntu-24.04-arm,
ubuntu-22.04,
ubuntu-22.04-arm,
windows-latest,
macos-latest,
macos-13
]
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
steps:
- uses: actions/checkout@v4
- name: Setup Python
uses: ./
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
pip-version: '25.0.1'
- name: Install dependencies
run: pip install numpy pandas requests
python-pip-dependencies-caching-path-with-pip-version:
name: Test pip (Python ${{ matrix.python-version}}, ${{ matrix.os }}, caching path)
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
[
ubuntu-latest,
ubuntu-24.04-arm,
ubuntu-22.04,
ubuntu-22.04-arm,
windows-latest,
macos-latest,
macos-13
]
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
steps:
- uses: actions/checkout@v4
- name: Setup Python
uses: ./
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache-dependency-path: __tests__/data/requirements.txt
pip-version: '25.0.1'
- name: Install dependencies
run: pip install numpy pandas requests

View File

@ -19,7 +19,6 @@ jobs:
matrix: matrix:
operating-system: operating-system:
[ [
ubuntu-20.04,
windows-latest, windows-latest,
ubuntu-22.04, ubuntu-22.04,
ubuntu-22.04-arm, ubuntu-22.04-arm,

View File

@ -21,7 +21,6 @@ jobs:
os: os:
[ [
macos-latest, macos-latest,
ubuntu-20.04,
ubuntu-22.04, ubuntu-22.04,
ubuntu-22.04-arm, ubuntu-22.04-arm,
ubuntu-24.04-arm, ubuntu-24.04-arm,
@ -77,7 +76,6 @@ jobs:
os: os:
[ [
macos-latest, macos-latest,
ubuntu-20.04,
ubuntu-22.04, ubuntu-22.04,
ubuntu-22.04-arm, ubuntu-22.04-arm,
ubuntu-24.04-arm, ubuntu-24.04-arm,

View File

@ -24,7 +24,6 @@ jobs:
[ [
macos-latest, macos-latest,
windows-latest, windows-latest,
ubuntu-20.04,
ubuntu-22.04, ubuntu-22.04,
ubuntu-22.04-arm, ubuntu-22.04-arm,
ubuntu-24.04-arm, ubuntu-24.04-arm,
@ -142,7 +141,6 @@ jobs:
[ [
macos-latest, macos-latest,
windows-latest, windows-latest,
ubuntu-20.04,
ubuntu-22.04, ubuntu-22.04,
ubuntu-22.04-arm, ubuntu-22.04-arm,
ubuntu-24.04-arm, ubuntu-24.04-arm,
@ -177,7 +175,6 @@ jobs:
[ [
macos-latest, macos-latest,
windows-latest, windows-latest,
ubuntu-20.04,
ubuntu-22.04, ubuntu-22.04,
ubuntu-22.04-arm, ubuntu-22.04-arm,
ubuntu-24.04-arm, ubuntu-24.04-arm,
@ -220,7 +217,6 @@ jobs:
[ [
macos-latest, macos-latest,
windows-latest, windows-latest,
ubuntu-20.04,
ubuntu-22.04, ubuntu-22.04,
ubuntu-22.04-arm, ubuntu-22.04-arm,
ubuntu-24.04-arm, ubuntu-24.04-arm,

View File

@ -24,7 +24,6 @@ jobs:
[ [
macos-latest, macos-latest,
windows-latest, windows-latest,
ubuntu-20.04,
ubuntu-22.04, ubuntu-22.04,
ubuntu-22.04-arm, ubuntu-22.04-arm,
macos-13, macos-13,
@ -62,7 +61,6 @@ jobs:
[ [
macos-latest, macos-latest,
windows-latest, windows-latest,
ubuntu-20.04,
ubuntu-22.04, ubuntu-22.04,
ubuntu-22.04-arm, ubuntu-22.04-arm,
macos-13, macos-13,
@ -103,7 +101,6 @@ jobs:
[ [
macos-latest, macos-latest,
windows-latest, windows-latest,
ubuntu-20.04,
ubuntu-22.04, ubuntu-22.04,
ubuntu-22.04-arm, ubuntu-22.04-arm,
macos-13, macos-13,
@ -142,7 +139,6 @@ jobs:
[ [
macos-latest, macos-latest,
windows-latest, windows-latest,
ubuntu-20.04,
ubuntu-22.04, ubuntu-22.04,
ubuntu-22.04-arm, ubuntu-22.04-arm,
macos-13, macos-13,
@ -184,7 +180,6 @@ jobs:
[ [
macos-latest, macos-latest,
windows-latest, windows-latest,
ubuntu-20.04,
ubuntu-22.04, ubuntu-22.04,
ubuntu-22.04-arm, ubuntu-22.04-arm,
macos-13, macos-13,
@ -226,7 +221,6 @@ jobs:
[ [
macos-latest, macos-latest,
windows-latest, windows-latest,
ubuntu-20.04,
ubuntu-22.04, ubuntu-22.04,
ubuntu-22.04-arm, ubuntu-22.04-arm,
macos-13, macos-13,
@ -258,7 +252,6 @@ jobs:
[ [
macos-latest, macos-latest,
windows-latest, windows-latest,
ubuntu-20.04,
ubuntu-22.04, ubuntu-22.04,
ubuntu-22.04-arm, ubuntu-22.04-arm,
macos-13, macos-13,
@ -371,7 +364,6 @@ jobs:
[ [
macos-latest, macos-latest,
windows-latest, windows-latest,
ubuntu-20.04,
ubuntu-22.04, ubuntu-22.04,
ubuntu-22.04-arm, ubuntu-22.04-arm,
macos-13, macos-13,
@ -461,7 +453,6 @@ jobs:
[ [
macos-latest, macos-latest,
windows-latest, windows-latest,
ubuntu-20.04,
ubuntu-22.04, ubuntu-22.04,
ubuntu-22.04-arm, ubuntu-22.04-arm,
macos-13, macos-13,

View File

@ -24,7 +24,6 @@ jobs:
[ [
macos-latest, macos-latest,
windows-latest, windows-latest,
ubuntu-20.04,
ubuntu-22.04, ubuntu-22.04,
ubuntu-22.04-arm, ubuntu-22.04-arm,
macos-13, macos-13,
@ -69,7 +68,6 @@ jobs:
[ [
macos-latest, macos-latest,
windows-latest, windows-latest,
ubuntu-20.04,
ubuntu-22.04, ubuntu-22.04,
ubuntu-22.04-arm, ubuntu-22.04-arm,
macos-13, macos-13,
@ -117,7 +115,6 @@ jobs:
[ [
macos-latest, macos-latest,
windows-latest, windows-latest,
ubuntu-20.04,
ubuntu-22.04, ubuntu-22.04,
ubuntu-22.04-arm, ubuntu-22.04-arm,
macos-13, macos-13,
@ -163,7 +160,6 @@ jobs:
[ [
macos-latest, macos-latest,
windows-latest, windows-latest,
ubuntu-20.04,
ubuntu-22.04, ubuntu-22.04,
ubuntu-22.04-arm, ubuntu-22.04-arm,
macos-13, macos-13,
@ -214,7 +210,6 @@ jobs:
[ [
macos-latest, macos-latest,
windows-latest, windows-latest,
ubuntu-20.04,
ubuntu-22.04, ubuntu-22.04,
ubuntu-22.04-arm, ubuntu-22.04-arm,
macos-13, macos-13,
@ -265,7 +260,6 @@ jobs:
[ [
macos-latest, macos-latest,
windows-latest, windows-latest,
ubuntu-20.04,
ubuntu-22.04, ubuntu-22.04,
ubuntu-22.04-arm, ubuntu-22.04-arm,
macos-13, macos-13,
@ -300,7 +294,6 @@ jobs:
[ [
macos-latest, macos-latest,
windows-latest, windows-latest,
ubuntu-20.04,
ubuntu-22.04, ubuntu-22.04,
ubuntu-22.04-arm, ubuntu-22.04-arm,
macos-13, macos-13,
@ -419,7 +412,6 @@ jobs:
[ [
macos-latest, macos-latest,
windows-latest, windows-latest,
ubuntu-20.04,
ubuntu-22.04, ubuntu-22.04,
ubuntu-22.04-arm, ubuntu-22.04-arm,
macos-13, macos-13,

View File

@ -1,6 +1,6 @@
--- ---
name: "@actions/tool-cache" name: "@actions/tool-cache"
version: 2.0.1 version: 2.0.2
type: npm type: npm
summary: Actions tool-cache lib summary: Actions tool-cache lib
homepage: https://github.com/actions/toolkit/tree/main/packages/tool-cache homepage: https://github.com/actions/toolkit/tree/main/packages/tool-cache

View File

@ -1,26 +0,0 @@
---
name: lru-cache
version: 6.0.0
type: npm
summary: A cache object that deletes the least-recently-used items.
homepage:
license: isc
licenses:
- sources: LICENSE
text: |
The ISC License
Copyright (c) Isaac Z. Schlueter and Contributors
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
notices: []

View File

@ -1,6 +1,6 @@
--- ---
name: semver name: semver
version: 7.6.0 version: 7.7.1
type: npm type: npm
summary: The semantic version parser used by npm. summary: The semantic version parser used by npm.
homepage: homepage:

View File

@ -1,39 +0,0 @@
---
name: uuid
version: 3.4.0
type: npm
summary: RFC4122 (v1, v4, and v5) UUIDs
homepage: https://github.com/uuidjs/uuid#readme
license: mit
licenses:
- sources: LICENSE.md
text: |
The MIT License (MIT)
Copyright (c) 2010-2016 Robert Kieffer and other contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
notices:
- sources: AUTHORS
text: |-
Robert Kieffer <robert@broofa.com>
Christoph Tavan <dev@tavan.de>
AJ ONeal <coolaj86@gmail.com>
Vincent Voyer <vincent@zeroload.net>
Roman Shtylman <shtylman@gmail.com>

View File

@ -3,7 +3,7 @@ name: uuid
version: 8.3.2 version: 8.3.2
type: npm type: npm
summary: RFC4122 (v1, v4, and v5) UUIDs summary: RFC4122 (v1, v4, and v5) UUIDs
homepage: https://github.com/uuidjs/uuid#readme homepage:
license: mit license: mit
licenses: licenses:
- sources: LICENSE.md - sources: LICENSE.md

View File

@ -1,26 +0,0 @@
---
name: yallist
version: 4.0.0
type: npm
summary: Yet Another Linked List
homepage:
license: isc
licenses:
- sources: LICENSE
text: |
The ISC License
Copyright (c) Isaac Z. Schlueter and Contributors
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
notices: []

View File

@ -108,6 +108,7 @@ See examples of using `cache` and `cache-dependency-path` for `pipenv` and `poet
- [Using `setup-python` with a self-hosted runner](docs/advanced-usage.md#using-setup-python-with-a-self-hosted-runner) - [Using `setup-python` with a self-hosted runner](docs/advanced-usage.md#using-setup-python-with-a-self-hosted-runner)
- [Using `setup-python` on GHES](docs/advanced-usage.md#using-setup-python-on-ghes) - [Using `setup-python` on GHES](docs/advanced-usage.md#using-setup-python-on-ghes)
- [Allow pre-releases](docs/advanced-usage.md#allow-pre-releases) - [Allow pre-releases](docs/advanced-usage.md#allow-pre-releases)
- [Using the pip-version input](docs/advanced-usage.md#using-the-pip-version-input)
## Recommended permissions ## Recommended permissions

View File

@ -8,10 +8,29 @@ import * as tc from '@actions/tool-cache';
jest.mock('@actions/http-client'); jest.mock('@actions/http-client');
jest.mock('@actions/tool-cache'); jest.mock('@actions/tool-cache');
jest.mock('@actions/tool-cache', () => ({
const mockManifest = [{version: '1.0.0'}]; getManifestFromRepo: jest.fn()
}));
const mockManifest = [
{
version: '1.0.0',
stable: true,
files: [
{
filename: 'tool-v1.0.0-linux-x64.tar.gz',
platform: 'linux',
arch: 'x64',
download_url: 'https://example.com/tool-v1.0.0-linux-x64.tar.gz'
}
]
}
];
describe('getManifest', () => { describe('getManifest', () => {
beforeEach(() => {
jest.resetAllMocks();
});
it('should return manifest from repo', async () => { it('should return manifest from repo', async () => {
(tc.getManifestFromRepo as jest.Mock).mockResolvedValue(mockManifest); (tc.getManifestFromRepo as jest.Mock).mockResolvedValue(mockManifest);
const manifest = await getManifest(); const manifest = await getManifest();

View File

@ -10,7 +10,7 @@ import {
validatePythonVersionFormatForPyPy, validatePythonVersionFormatForPyPy,
isCacheFeatureAvailable, isCacheFeatureAvailable,
getVersionInputFromFile, getVersionInputFromFile,
getVersionInputFromPlainFile, getVersionsInputFromPlainFile,
getVersionInputFromTomlFile, getVersionInputFromTomlFile,
getNextPageUrl, getNextPageUrl,
isGhes, isGhes,
@ -24,10 +24,10 @@ jest.mock('@actions/core');
describe('validatePythonVersionFormatForPyPy', () => { describe('validatePythonVersionFormatForPyPy', () => {
it.each([ it.each([
['3.6', true], ['3.12', true],
['3.7', true], ['3.13', true],
['3.6.x', false], ['3.12.x', false],
['3.7.x', false], ['3.13.x', false],
['3.x', false], ['3.x', false],
['3', false] ['3', false]
])('%s -> %s', (input, expected) => { ])('%s -> %s', (input, expected) => {
@ -95,24 +95,52 @@ const tempDir = path.join(
); );
describe('Version from file test', () => { describe('Version from file test', () => {
it.each([getVersionInputFromPlainFile, getVersionInputFromFile])( it.each([getVersionsInputFromPlainFile, getVersionInputFromFile])(
'Version from plain file test', 'Version from plain file test',
async _fn => { async _fn => {
await io.mkdirP(tempDir); await io.mkdirP(tempDir);
const pythonVersionFileName = 'python-version.file'; const pythonVersionFileName = 'python-version.file';
const pythonVersionFilePath = path.join(tempDir, pythonVersionFileName); const pythonVersionFilePath = path.join(tempDir, pythonVersionFileName);
const pythonVersionFileContent = '3.7'; const pythonVersionFileContent = '3.13';
fs.writeFileSync(pythonVersionFilePath, pythonVersionFileContent); fs.writeFileSync(pythonVersionFilePath, pythonVersionFileContent);
expect(_fn(pythonVersionFilePath)).toEqual([pythonVersionFileContent]); expect(_fn(pythonVersionFilePath)).toEqual([pythonVersionFileContent]);
} }
); );
it.each([getVersionsInputFromPlainFile, getVersionInputFromFile])(
'Versions from multiline plain file test',
async _fn => {
await io.mkdirP(tempDir);
const pythonVersionFileName = 'python-version.file';
const pythonVersionFilePath = path.join(tempDir, pythonVersionFileName);
const pythonVersionFileContent = '3.13\r\n3.12';
fs.writeFileSync(pythonVersionFilePath, pythonVersionFileContent);
expect(_fn(pythonVersionFilePath)).toEqual(['3.13', '3.12']);
}
);
it.each([getVersionsInputFromPlainFile, getVersionInputFromFile])(
'Version from complex plain file test',
async _fn => {
await io.mkdirP(tempDir);
const pythonVersionFileName = 'python-version.file';
const pythonVersionFilePath = path.join(tempDir, pythonVersionFileName);
const pythonVersionFileContent =
'3.13/envs/virtualenv\r# 3.12\n3.11\r\n3.10\r\n 3.9 \r\n';
fs.writeFileSync(pythonVersionFilePath, pythonVersionFileContent);
expect(_fn(pythonVersionFilePath)).toEqual([
'3.13',
'3.11',
'3.10',
'3.9'
]);
}
);
it.each([getVersionInputFromTomlFile, getVersionInputFromFile])( it.each([getVersionInputFromTomlFile, getVersionInputFromFile])(
'Version from standard pyproject.toml test', 'Version from standard pyproject.toml test',
async _fn => { async _fn => {
await io.mkdirP(tempDir); await io.mkdirP(tempDir);
const pythonVersionFileName = 'pyproject.toml'; const pythonVersionFileName = 'pyproject.toml';
const pythonVersionFilePath = path.join(tempDir, pythonVersionFileName); const pythonVersionFilePath = path.join(tempDir, pythonVersionFileName);
const pythonVersion = '>=3.7.0'; const pythonVersion = '>=3.13.0';
const pythonVersionFileContent = `[project]\nrequires-python = "${pythonVersion}"`; const pythonVersionFileContent = `[project]\nrequires-python = "${pythonVersion}"`;
fs.writeFileSync(pythonVersionFilePath, pythonVersionFileContent); fs.writeFileSync(pythonVersionFilePath, pythonVersionFileContent);
expect(_fn(pythonVersionFilePath)).toEqual([pythonVersion]); expect(_fn(pythonVersionFilePath)).toEqual([pythonVersion]);
@ -124,7 +152,7 @@ describe('Version from file test', () => {
await io.mkdirP(tempDir); await io.mkdirP(tempDir);
const pythonVersionFileName = 'pyproject.toml'; const pythonVersionFileName = 'pyproject.toml';
const pythonVersionFilePath = path.join(tempDir, pythonVersionFileName); const pythonVersionFilePath = path.join(tempDir, pythonVersionFileName);
const pythonVersion = '>=3.7.0'; const pythonVersion = '>=3.13.0';
const pythonVersionFileContent = `[tool.poetry.dependencies]\npython = "${pythonVersion}"`; const pythonVersionFileContent = `[tool.poetry.dependencies]\npython = "${pythonVersion}"`;
fs.writeFileSync(pythonVersionFilePath, pythonVersionFileContent); fs.writeFileSync(pythonVersionFilePath, pythonVersionFileContent);
expect(_fn(pythonVersionFilePath)).toEqual([pythonVersion]); expect(_fn(pythonVersionFilePath)).toEqual([pythonVersion]);
@ -145,9 +173,9 @@ describe('Version from file test', () => {
async _fn => { async _fn => {
const toolVersionFileName = '.tool-versions'; const toolVersionFileName = '.tool-versions';
const toolVersionFilePath = path.join(tempDir, toolVersionFileName); const toolVersionFilePath = path.join(tempDir, toolVersionFileName);
const toolVersionContent = 'python 3.9.10\nnodejs 16'; const toolVersionContent = 'python 3.13.2\nnodejs 16';
fs.writeFileSync(toolVersionFilePath, toolVersionContent); fs.writeFileSync(toolVersionFilePath, toolVersionContent);
expect(_fn(toolVersionFilePath)).toEqual(['3.9.10']); expect(_fn(toolVersionFilePath)).toEqual(['3.13.2']);
} }
); );
@ -156,9 +184,9 @@ describe('Version from file test', () => {
async _fn => { async _fn => {
const toolVersionFileName = '.tool-versions'; const toolVersionFileName = '.tool-versions';
const toolVersionFilePath = path.join(tempDir, toolVersionFileName); const toolVersionFilePath = path.join(tempDir, toolVersionFileName);
const toolVersionContent = '# python 3.8\npython 3.9'; const toolVersionContent = '# python 3.13\npython 3.12';
fs.writeFileSync(toolVersionFilePath, toolVersionContent); fs.writeFileSync(toolVersionFilePath, toolVersionContent);
expect(_fn(toolVersionFilePath)).toEqual(['3.9']); expect(_fn(toolVersionFilePath)).toEqual(['3.12']);
} }
); );
@ -167,9 +195,9 @@ describe('Version from file test', () => {
async _fn => { async _fn => {
const toolVersionFileName = '.tool-versions'; const toolVersionFileName = '.tool-versions';
const toolVersionFilePath = path.join(tempDir, toolVersionFileName); const toolVersionFilePath = path.join(tempDir, toolVersionFileName);
const toolVersionContent = ' python 3.10 '; const toolVersionContent = ' python 3.13 ';
fs.writeFileSync(toolVersionFilePath, toolVersionContent); fs.writeFileSync(toolVersionFilePath, toolVersionContent);
expect(_fn(toolVersionFilePath)).toEqual(['3.10']); expect(_fn(toolVersionFilePath)).toEqual(['3.13']);
} }
); );
@ -178,9 +206,9 @@ describe('Version from file test', () => {
async _fn => { async _fn => {
const toolVersionFileName = '.tool-versions'; const toolVersionFileName = '.tool-versions';
const toolVersionFilePath = path.join(tempDir, toolVersionFileName); const toolVersionFilePath = path.join(tempDir, toolVersionFileName);
const toolVersionContent = 'python v3.9.10'; const toolVersionContent = 'python v3.13.2';
fs.writeFileSync(toolVersionFilePath, toolVersionContent); fs.writeFileSync(toolVersionFilePath, toolVersionContent);
expect(_fn(toolVersionFilePath)).toEqual(['3.9.10']); expect(_fn(toolVersionFilePath)).toEqual(['3.13.2']);
} }
); );
@ -189,9 +217,9 @@ describe('Version from file test', () => {
async _fn => { async _fn => {
const toolVersionFileName = '.tool-versions'; const toolVersionFileName = '.tool-versions';
const toolVersionFilePath = path.join(tempDir, toolVersionFileName); const toolVersionFilePath = path.join(tempDir, toolVersionFileName);
const toolVersionContent = 'python pypy3.10-7.3.14'; const toolVersionContent = 'python pypy3.10-7.3.19';
fs.writeFileSync(toolVersionFilePath, toolVersionContent); fs.writeFileSync(toolVersionFilePath, toolVersionContent);
expect(_fn(toolVersionFilePath)).toEqual(['pypy3.10-7.3.14']); expect(_fn(toolVersionFilePath)).toEqual(['pypy3.10-7.3.19']);
} }
); );

View File

@ -29,6 +29,8 @@ inputs:
freethreaded: freethreaded:
description: "When 'true', use the freethreaded version of Python." description: "When 'true', use the freethreaded version of Python."
default: false default: false
pip-version:
description: "Used to specify the version of pip to install with the Python. Supported format: major[.minor][.patch]."
outputs: outputs:
python-version: python-version:
description: "The installed Python or PyPy version. Useful when given a version range as input." description: "The installed Python or PyPy version. Useful when given a version range as input."

1171
dist/setup/index.js vendored

File diff suppressed because it is too large Load Diff

View File

@ -22,6 +22,7 @@
- [macOS](advanced-usage.md#macos) - [macOS](advanced-usage.md#macos)
- [Using `setup-python` on GHES](advanced-usage.md#using-setup-python-on-ghes) - [Using `setup-python` on GHES](advanced-usage.md#using-setup-python-on-ghes)
- [Allow pre-releases](advanced-usage.md#allow-pre-releases) - [Allow pre-releases](advanced-usage.md#allow-pre-releases)
- [Using the pip-version input](advanced-usage.md#using-the-pip-version-input)
## Using the `python-version` input ## Using the `python-version` input
@ -643,3 +644,22 @@ jobs:
- run: pipx run nox --error-on-missing-interpreters -s tests-${{ matrix.python_version }} - run: pipx run nox --error-on-missing-interpreters -s tests-${{ matrix.python_version }}
``` ```
## Using the pip-version input
The `pip-version` input allows you to specify the desired version of **Pip** to use with the standard Python version.
The version of Pip should be specified in the format `major`, `major.minor`, or `major.minor.patch` (for example: 25, 25.1, or 25.0.1).
```yaml
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.13'
pip-version: '25.0.1'
- name: Display Pip version
run: pip --version
```
> The `pip-version` input is supported only with standard Python versions. It is not available when using PyPy or GraalPy.
> Using a specific or outdated version of pip may result in compatibility or security issues and can cause job failures. For best practices and guidance, refer to the official [pip documentation](https://pip.pypa.io/en/stable/).

431
package-lock.json generated
View File

@ -15,25 +15,25 @@
"@actions/glob": "^0.5.0", "@actions/glob": "^0.5.0",
"@actions/http-client": "^2.2.3", "@actions/http-client": "^2.2.3",
"@actions/io": "^1.0.2", "@actions/io": "^1.0.2",
"@actions/tool-cache": "^2.0.1", "@actions/tool-cache": "^2.0.2",
"@iarna/toml": "^3.0.0", "@iarna/toml": "^3.0.0",
"semver": "^7.6.0" "semver": "^7.7.1"
}, },
"devDependencies": { "devDependencies": {
"@types/jest": "^29.5.12", "@types/jest": "^29.5.12",
"@types/node": "^20.11.25", "@types/node": "^20.11.25",
"@types/semver": "^7.5.8", "@types/semver": "^7.7.0",
"@typescript-eslint/eslint-plugin": "^5.54.0", "@typescript-eslint/eslint-plugin": "^5.54.0",
"@typescript-eslint/parser": "^5.54.0", "@typescript-eslint/parser": "^5.54.0",
"@vercel/ncc": "^0.38.3", "@vercel/ncc": "^0.38.3",
"eslint": "^8.57.0", "eslint": "^8.57.0",
"eslint-config-prettier": "^8.6.0", "eslint-config-prettier": "^8.6.0",
"eslint-plugin-jest": "^27.9.0", "eslint-plugin-jest": "^29.0.1",
"eslint-plugin-node": "^11.1.0", "eslint-plugin-node": "^11.1.0",
"jest": "^29.7.0", "jest": "^29.7.0",
"jest-circus": "^29.7.0", "jest-circus": "^29.7.0",
"prettier": "^2.8.4", "prettier": "^3.5.3",
"ts-jest": "^29.1.2", "ts-jest": "^29.3.2",
"typescript": "^5.4.2" "typescript": "^5.4.2"
} }
}, },
@ -123,16 +123,16 @@
"integrity": "sha512-wi9JjgKLYS7U/z8PPbco+PvTb/nRWjeoFlJ1Qer83k/3C5PHQi28hiVdeE2kHXmIL99mQFawx8qt/JPjZilJ8Q==" "integrity": "sha512-wi9JjgKLYS7U/z8PPbco+PvTb/nRWjeoFlJ1Qer83k/3C5PHQi28hiVdeE2kHXmIL99mQFawx8qt/JPjZilJ8Q=="
}, },
"node_modules/@actions/tool-cache": { "node_modules/@actions/tool-cache": {
"version": "2.0.1", "version": "2.0.2",
"resolved": "https://registry.npmjs.org/@actions/tool-cache/-/tool-cache-2.0.1.tgz", "resolved": "https://registry.npmjs.org/@actions/tool-cache/-/tool-cache-2.0.2.tgz",
"integrity": "sha512-iPU+mNwrbA8jodY8eyo/0S/QqCKDajiR8OxWTnSk/SnYg0sj8Hp4QcUEVC1YFpHWXtrfbQrE13Jz4k4HXJQKcA==", "integrity": "sha512-fBhNNOWxuoLxztQebpOaWu6WeVmuwa77Z+DxIZ1B+OYvGkGQon6kTVg6Z32Cb13WCuw0szqonK+hh03mJV7Z6w==",
"license": "MIT",
"dependencies": { "dependencies": {
"@actions/core": "^1.2.6", "@actions/core": "^1.11.1",
"@actions/exec": "^1.0.0", "@actions/exec": "^1.0.0",
"@actions/http-client": "^2.0.1", "@actions/http-client": "^2.0.1",
"@actions/io": "^1.1.1", "@actions/io": "^1.1.1",
"semver": "^6.1.0", "semver": "^6.1.0"
"uuid": "^3.3.2"
} }
}, },
"node_modules/@actions/tool-cache/node_modules/semver": { "node_modules/@actions/tool-cache/node_modules/semver": {
@ -827,16 +827,20 @@
"dev": true "dev": true
}, },
"node_modules/@eslint-community/eslint-utils": { "node_modules/@eslint-community/eslint-utils": {
"version": "4.4.0", "version": "4.7.0",
"resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz", "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.7.0.tgz",
"integrity": "sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==", "integrity": "sha512-dyybb3AcajC7uha6CvhdVRJqaKyn7w2YKqKyAN37NKYgZT36w+iRb0Dymmc5qEJ549c/S31cMMSFd75bteCpCw==",
"dev": true, "dev": true,
"license": "MIT",
"dependencies": { "dependencies": {
"eslint-visitor-keys": "^3.3.0" "eslint-visitor-keys": "^3.4.3"
}, },
"engines": { "engines": {
"node": "^12.22.0 || ^14.17.0 || >=16.0.0" "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
}, },
"funding": {
"url": "https://opencollective.com/eslint"
},
"peerDependencies": { "peerDependencies": {
"eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0"
} }
@ -1620,10 +1624,11 @@
} }
}, },
"node_modules/@types/semver": { "node_modules/@types/semver": {
"version": "7.5.8", "version": "7.7.0",
"resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.8.tgz", "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.7.0.tgz",
"integrity": "sha512-I8EUhyrgfLrcTkzV3TSsGyl1tSuPrEDzr0yd5m90UgNxQkyDXULk3b6MlQqTCpZpNtWe1K0hzclnZkTcLBe2UQ==", "integrity": "sha512-k107IF4+Xr7UHjwDc7Cfd6PRQfbdkiRabXGRjo07b4WyPahFBZCZ1sE+BNxYIJPPg73UkfOsVOLwqVc/6ETrIA==",
"dev": true "dev": true,
"license": "MIT"
}, },
"node_modules/@types/stack-utils": { "node_modules/@types/stack-utils": {
"version": "2.0.3", "version": "2.0.3",
@ -1715,6 +1720,42 @@
} }
} }
}, },
"node_modules/@typescript-eslint/project-service": {
"version": "8.34.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/project-service/-/project-service-8.34.1.tgz",
"integrity": "sha512-nuHlOmFZfuRwLJKDGQOVc0xnQrAmuq1Mj/ISou5044y1ajGNp2BNliIqp7F2LPQ5sForz8lempMFCovfeS1XoA==",
"dev": true,
"license": "MIT",
"dependencies": {
"@typescript-eslint/tsconfig-utils": "^8.34.1",
"@typescript-eslint/types": "^8.34.1",
"debug": "^4.3.4"
},
"engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/typescript-eslint"
},
"peerDependencies": {
"typescript": ">=4.8.4 <5.9.0"
}
},
"node_modules/@typescript-eslint/project-service/node_modules/@typescript-eslint/types": {
"version": "8.34.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.34.1.tgz",
"integrity": "sha512-rjLVbmE7HR18kDsjNIZQHxmv9RZwlgzavryL5Lnj2ujIRTeXlKtILHgRNmQ3j4daw7zd+mQgy+uyt6Zo6I0IGA==",
"dev": true,
"license": "MIT",
"engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/typescript-eslint"
}
},
"node_modules/@typescript-eslint/scope-manager": { "node_modules/@typescript-eslint/scope-manager": {
"version": "5.62.0", "version": "5.62.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.62.0.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.62.0.tgz",
@ -1732,6 +1773,23 @@
"url": "https://opencollective.com/typescript-eslint" "url": "https://opencollective.com/typescript-eslint"
} }
}, },
"node_modules/@typescript-eslint/tsconfig-utils": {
"version": "8.34.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.34.1.tgz",
"integrity": "sha512-K4Sjdo4/xF9NEeA2khOb7Y5nY6NSXBnod87uniVYW9kHP+hNlDV8trUSFeynA2uxWam4gIWgWoygPrv9VMWrYg==",
"dev": true,
"license": "MIT",
"engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/typescript-eslint"
},
"peerDependencies": {
"typescript": ">=4.8.4 <5.9.0"
}
},
"node_modules/@typescript-eslint/type-utils": { "node_modules/@typescript-eslint/type-utils": {
"version": "5.62.0", "version": "5.62.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.62.0.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.62.0.tgz",
@ -1985,6 +2043,13 @@
"node": ">=8" "node": ">=8"
} }
}, },
"node_modules/async": {
"version": "3.2.6",
"resolved": "https://registry.npmjs.org/async/-/async-3.2.6.tgz",
"integrity": "sha512-htCUDlxyyCLMgaM3xXg0C0LW2xqfuQ6p05pCEIsXuyQ+a1koYKTuBMzRNwmybfLgvJDMd0r1LTn4+E0Ti6C2AA==",
"dev": true,
"license": "MIT"
},
"node_modules/asynckit": { "node_modules/asynckit": {
"version": "0.4.0", "version": "0.4.0",
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
@ -2476,6 +2541,22 @@
"node": ">=6.0.0" "node": ">=6.0.0"
} }
}, },
"node_modules/ejs": {
"version": "3.1.10",
"resolved": "https://registry.npmjs.org/ejs/-/ejs-3.1.10.tgz",
"integrity": "sha512-UeJmFfOrAQS8OJWPZ4qtgHyWExa088/MtK5UEyoJGFH67cDEXkZSviOiKRCZ4Xij0zxI3JECgYs3oKx+AizQBA==",
"dev": true,
"license": "Apache-2.0",
"dependencies": {
"jake": "^10.8.5"
},
"bin": {
"ejs": "bin/cli.js"
},
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/electron-to-chromium": { "node_modules/electron-to-chromium": {
"version": "1.4.587", "version": "1.4.587",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.587.tgz", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.587.tgz",
@ -2617,19 +2698,20 @@
} }
}, },
"node_modules/eslint-plugin-jest": { "node_modules/eslint-plugin-jest": {
"version": "27.9.0", "version": "29.0.1",
"resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-27.9.0.tgz", "resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-29.0.1.tgz",
"integrity": "sha512-QIT7FH7fNmd9n4se7FFKHbsLKGQiw885Ds6Y/sxKgCZ6natwCsXdgPOADnYVxN2QrRweF0FZWbJ6S7Rsn7llug==", "integrity": "sha512-EE44T0OSMCeXhDrrdsbKAhprobKkPtJTbQz5yEktysNpHeDZTAL1SfDTNKmcFfJkY6yrQLtTKZALrD3j/Gpmiw==",
"dev": true, "dev": true,
"license": "MIT",
"dependencies": { "dependencies": {
"@typescript-eslint/utils": "^5.10.0" "@typescript-eslint/utils": "^8.0.0"
}, },
"engines": { "engines": {
"node": "^14.15.0 || ^16.10.0 || >=18.0.0" "node": "^20.12.0 || ^22.0.0 || >=24.0.0"
}, },
"peerDependencies": { "peerDependencies": {
"@typescript-eslint/eslint-plugin": "^5.0.0 || ^6.0.0 || ^7.0.0", "@typescript-eslint/eslint-plugin": "^8.0.0",
"eslint": "^7.0.0 || ^8.0.0", "eslint": "^8.57.0 || ^9.0.0",
"jest": "*" "jest": "*"
}, },
"peerDependenciesMeta": { "peerDependenciesMeta": {
@ -2641,6 +2723,148 @@
} }
} }
}, },
"node_modules/eslint-plugin-jest/node_modules/@typescript-eslint/scope-manager": {
"version": "8.34.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.34.1.tgz",
"integrity": "sha512-beu6o6QY4hJAgL1E8RaXNC071G4Kso2MGmJskCFQhRhg8VOH/FDbC8soP8NHN7e/Hdphwp8G8cE6OBzC8o41ZA==",
"dev": true,
"license": "MIT",
"dependencies": {
"@typescript-eslint/types": "8.34.1",
"@typescript-eslint/visitor-keys": "8.34.1"
},
"engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/typescript-eslint"
}
},
"node_modules/eslint-plugin-jest/node_modules/@typescript-eslint/types": {
"version": "8.34.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.34.1.tgz",
"integrity": "sha512-rjLVbmE7HR18kDsjNIZQHxmv9RZwlgzavryL5Lnj2ujIRTeXlKtILHgRNmQ3j4daw7zd+mQgy+uyt6Zo6I0IGA==",
"dev": true,
"license": "MIT",
"engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/typescript-eslint"
}
},
"node_modules/eslint-plugin-jest/node_modules/@typescript-eslint/typescript-estree": {
"version": "8.34.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.34.1.tgz",
"integrity": "sha512-rjCNqqYPuMUF5ODD+hWBNmOitjBWghkGKJg6hiCHzUvXRy6rK22Jd3rwbP2Xi+R7oYVvIKhokHVhH41BxPV5mA==",
"dev": true,
"license": "MIT",
"dependencies": {
"@typescript-eslint/project-service": "8.34.1",
"@typescript-eslint/tsconfig-utils": "8.34.1",
"@typescript-eslint/types": "8.34.1",
"@typescript-eslint/visitor-keys": "8.34.1",
"debug": "^4.3.4",
"fast-glob": "^3.3.2",
"is-glob": "^4.0.3",
"minimatch": "^9.0.4",
"semver": "^7.6.0",
"ts-api-utils": "^2.1.0"
},
"engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/typescript-eslint"
},
"peerDependencies": {
"typescript": ">=4.8.4 <5.9.0"
}
},
"node_modules/eslint-plugin-jest/node_modules/@typescript-eslint/utils": {
"version": "8.34.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.34.1.tgz",
"integrity": "sha512-mqOwUdZ3KjtGk7xJJnLbHxTuWVn3GO2WZZuM+Slhkun4+qthLdXx32C8xIXbO1kfCECb3jIs3eoxK3eryk7aoQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"@eslint-community/eslint-utils": "^4.7.0",
"@typescript-eslint/scope-manager": "8.34.1",
"@typescript-eslint/types": "8.34.1",
"@typescript-eslint/typescript-estree": "8.34.1"
},
"engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/typescript-eslint"
},
"peerDependencies": {
"eslint": "^8.57.0 || ^9.0.0",
"typescript": ">=4.8.4 <5.9.0"
}
},
"node_modules/eslint-plugin-jest/node_modules/@typescript-eslint/visitor-keys": {
"version": "8.34.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.34.1.tgz",
"integrity": "sha512-xoh5rJ+tgsRKoXnkBPFRLZ7rjKM0AfVbC68UZ/ECXoDbfggb9RbEySN359acY1vS3qZ0jVTVWzbtfapwm5ztxw==",
"dev": true,
"license": "MIT",
"dependencies": {
"@typescript-eslint/types": "8.34.1",
"eslint-visitor-keys": "^4.2.1"
},
"engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/typescript-eslint"
}
},
"node_modules/eslint-plugin-jest/node_modules/brace-expansion": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz",
"integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"balanced-match": "^1.0.0"
}
},
"node_modules/eslint-plugin-jest/node_modules/eslint-visitor-keys": {
"version": "4.2.1",
"resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.2.1.tgz",
"integrity": "sha512-Uhdk5sfqcee/9H/rCOJikYz67o0a2Tw2hGRPOG2Y1R2dg7brRe1uG0yaNQDHu+TO/uQPF/5eCapvYSmHUjt7JQ==",
"dev": true,
"license": "Apache-2.0",
"engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
},
"funding": {
"url": "https://opencollective.com/eslint"
}
},
"node_modules/eslint-plugin-jest/node_modules/minimatch": {
"version": "9.0.5",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz",
"integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==",
"dev": true,
"license": "ISC",
"dependencies": {
"brace-expansion": "^2.0.1"
},
"engines": {
"node": ">=16 || 14 >=14.17"
},
"funding": {
"url": "https://github.com/sponsors/isaacs"
}
},
"node_modules/eslint-plugin-node": { "node_modules/eslint-plugin-node": {
"version": "11.1.0", "version": "11.1.0",
"resolved": "https://registry.npmjs.org/eslint-plugin-node/-/eslint-plugin-node-11.1.0.tgz", "resolved": "https://registry.npmjs.org/eslint-plugin-node/-/eslint-plugin-node-11.1.0.tgz",
@ -2974,6 +3198,39 @@
"node": "^10.12.0 || >=12.0.0" "node": "^10.12.0 || >=12.0.0"
} }
}, },
"node_modules/filelist": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/filelist/-/filelist-1.0.4.tgz",
"integrity": "sha512-w1cEuf3S+DrLCQL7ET6kz+gmlJdbq9J7yXCSjK/OZCPA+qEN1WyF4ZAf0YYJa4/shHJra2t/d/r8SV4Ji+x+8Q==",
"dev": true,
"license": "Apache-2.0",
"dependencies": {
"minimatch": "^5.0.1"
}
},
"node_modules/filelist/node_modules/brace-expansion": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz",
"integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==",
"dev": true,
"license": "MIT",
"dependencies": {
"balanced-match": "^1.0.0"
}
},
"node_modules/filelist/node_modules/minimatch": {
"version": "5.1.6",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz",
"integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==",
"dev": true,
"license": "ISC",
"dependencies": {
"brace-expansion": "^2.0.1"
},
"engines": {
"node": ">=10"
}
},
"node_modules/fill-range": { "node_modules/fill-range": {
"version": "7.1.1", "version": "7.1.1",
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz",
@ -3446,6 +3703,25 @@
"node": ">=8" "node": ">=8"
} }
}, },
"node_modules/jake": {
"version": "10.9.2",
"resolved": "https://registry.npmjs.org/jake/-/jake-10.9.2.tgz",
"integrity": "sha512-2P4SQ0HrLQ+fw6llpLnOaGAvN2Zu6778SJMrCUwns4fOoG9ayrTiZk3VV8sCPkVZF8ab0zksVpS8FDY5pRCNBA==",
"dev": true,
"license": "Apache-2.0",
"dependencies": {
"async": "^3.2.3",
"chalk": "^4.0.2",
"filelist": "^1.0.4",
"minimatch": "^3.1.2"
},
"bin": {
"jake": "bin/cli.js"
},
"engines": {
"node": ">=10"
}
},
"node_modules/jest": { "node_modules/jest": {
"version": "29.7.0", "version": "29.7.0",
"resolved": "https://registry.npmjs.org/jest/-/jest-29.7.0.tgz", "resolved": "https://registry.npmjs.org/jest/-/jest-29.7.0.tgz",
@ -4569,15 +4845,16 @@
} }
}, },
"node_modules/prettier": { "node_modules/prettier": {
"version": "2.8.8", "version": "3.5.3",
"resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.8.tgz", "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.5.3.tgz",
"integrity": "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==", "integrity": "sha512-QQtaxnoDJeAkDvDKWCLiwIXkTgRhwYDEQCghU9Z6q03iyek/rxRh/2lC3HB7P8sWT2xC/y5JDctPLBIGzHKbhw==",
"dev": true, "dev": true,
"license": "MIT",
"bin": { "bin": {
"prettier": "bin-prettier.js" "prettier": "bin/prettier.cjs"
}, },
"engines": { "engines": {
"node": ">=10.13.0" "node": ">=14"
}, },
"funding": { "funding": {
"url": "https://github.com/prettier/prettier?sponsor=1" "url": "https://github.com/prettier/prettier?sponsor=1"
@ -4812,12 +5089,10 @@
"integrity": "sha512-0s+oAmw9zLl1V1cS9BtZN7JAd0cW5e0QH4W3LWEK6a4LaLEA2OTpGYWDY+6XasBLtz6wkm3u1xRw95mRuJ59WA==" "integrity": "sha512-0s+oAmw9zLl1V1cS9BtZN7JAd0cW5e0QH4W3LWEK6a4LaLEA2OTpGYWDY+6XasBLtz6wkm3u1xRw95mRuJ59WA=="
}, },
"node_modules/semver": { "node_modules/semver": {
"version": "7.6.0", "version": "7.7.1",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.6.0.tgz", "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.1.tgz",
"integrity": "sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg==", "integrity": "sha512-hlq8tAfn0m/61p4BVRcPzIGr6LKiMwo4VM6dGi6pt4qcRkmNzTcWq6eCEjEh+qXjkMDvPlOFFSGwQjoEa6gyMA==",
"dependencies": { "license": "ISC",
"lru-cache": "^6.0.0"
},
"bin": { "bin": {
"semver": "bin/semver.js" "semver": "bin/semver.js"
}, },
@ -4825,22 +5100,6 @@
"node": ">=10" "node": ">=10"
} }
}, },
"node_modules/semver/node_modules/lru-cache": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
"integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==",
"dependencies": {
"yallist": "^4.0.0"
},
"engines": {
"node": ">=10"
}
},
"node_modules/semver/node_modules/yallist": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A=="
},
"node_modules/shebang-command": { "node_modules/shebang-command": {
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz",
@ -5065,29 +5324,46 @@
"resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz",
"integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw=="
}, },
"node_modules/ts-jest": { "node_modules/ts-api-utils": {
"version": "29.1.2", "version": "2.1.0",
"resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-29.1.2.tgz", "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-2.1.0.tgz",
"integrity": "sha512-br6GJoH/WUX4pu7FbZXuWGKGNDuU7b8Uj77g/Sp7puZV6EXzuByl6JrECvm0MzVzSTkSHWTihsXt+5XYER5b+g==", "integrity": "sha512-CUgTZL1irw8u29bzrOD/nH85jqyc74D6SshFgujOIA7osm2Rz7dYH77agkx7H4FBNxDq7Cjf+IjaX/8zwFW+ZQ==",
"dev": true, "dev": true,
"license": "MIT",
"engines": {
"node": ">=18.12"
},
"peerDependencies": {
"typescript": ">=4.8.4"
}
},
"node_modules/ts-jest": {
"version": "29.3.2",
"resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-29.3.2.tgz",
"integrity": "sha512-bJJkrWc6PjFVz5g2DGCNUo8z7oFEYaz1xP1NpeDU7KNLMWPpEyV8Chbpkn8xjzgRDpQhnGMyvyldoL7h8JXyug==",
"dev": true,
"license": "MIT",
"dependencies": { "dependencies": {
"bs-logger": "0.x", "bs-logger": "^0.2.6",
"fast-json-stable-stringify": "2.x", "ejs": "^3.1.10",
"fast-json-stable-stringify": "^2.1.0",
"jest-util": "^29.0.0", "jest-util": "^29.0.0",
"json5": "^2.2.3", "json5": "^2.2.3",
"lodash.memoize": "4.x", "lodash.memoize": "^4.1.2",
"make-error": "1.x", "make-error": "^1.3.6",
"semver": "^7.5.3", "semver": "^7.7.1",
"yargs-parser": "^21.0.1" "type-fest": "^4.39.1",
"yargs-parser": "^21.1.1"
}, },
"bin": { "bin": {
"ts-jest": "cli.js" "ts-jest": "cli.js"
}, },
"engines": { "engines": {
"node": "^16.10.0 || ^18.0.0 || >=20.0.0" "node": "^14.15.0 || ^16.10.0 || ^18.0.0 || >=20.0.0"
}, },
"peerDependencies": { "peerDependencies": {
"@babel/core": ">=7.0.0-beta.0 <8", "@babel/core": ">=7.0.0-beta.0 <8",
"@jest/transform": "^29.0.0",
"@jest/types": "^29.0.0", "@jest/types": "^29.0.0",
"babel-jest": "^29.0.0", "babel-jest": "^29.0.0",
"jest": "^29.0.0", "jest": "^29.0.0",
@ -5097,6 +5373,9 @@
"@babel/core": { "@babel/core": {
"optional": true "optional": true
}, },
"@jest/transform": {
"optional": true
},
"@jest/types": { "@jest/types": {
"optional": true "optional": true
}, },
@ -5108,6 +5387,19 @@
} }
} }
}, },
"node_modules/ts-jest/node_modules/type-fest": {
"version": "4.40.0",
"resolved": "https://registry.npmjs.org/type-fest/-/type-fest-4.40.0.tgz",
"integrity": "sha512-ABHZ2/tS2JkvH1PEjxFDTUWC8dB5OsIGZP4IFLhR293GqT5Y5qB1WwL2kMPYhQW9DVgVD8Hd7I8gjwPIf5GFkw==",
"dev": true,
"license": "(MIT OR CC0-1.0)",
"engines": {
"node": ">=16"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/tslib": { "node_modules/tslib": {
"version": "2.6.2", "version": "2.6.2",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz",
@ -5244,15 +5536,6 @@
"punycode": "^2.1.0" "punycode": "^2.1.0"
} }
}, },
"node_modules/uuid": {
"version": "3.4.0",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz",
"integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==",
"deprecated": "Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.",
"bin": {
"uuid": "bin/uuid"
}
},
"node_modules/v8-to-istanbul": { "node_modules/v8-to-istanbul": {
"version": "9.1.3", "version": "9.1.3",
"resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-9.1.3.tgz", "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-9.1.3.tgz",

View File

@ -31,25 +31,25 @@
"@actions/glob": "^0.5.0", "@actions/glob": "^0.5.0",
"@actions/http-client": "^2.2.3", "@actions/http-client": "^2.2.3",
"@actions/io": "^1.0.2", "@actions/io": "^1.0.2",
"@actions/tool-cache": "^2.0.1", "@actions/tool-cache": "^2.0.2",
"@iarna/toml": "^3.0.0", "@iarna/toml": "^3.0.0",
"semver": "^7.6.0" "semver": "^7.7.1"
}, },
"devDependencies": { "devDependencies": {
"@types/jest": "^29.5.12", "@types/jest": "^29.5.12",
"@types/node": "^20.11.25", "@types/node": "^20.11.25",
"@types/semver": "^7.5.8", "@types/semver": "^7.7.0",
"@typescript-eslint/eslint-plugin": "^5.54.0", "@typescript-eslint/eslint-plugin": "^5.54.0",
"@typescript-eslint/parser": "^5.54.0", "@typescript-eslint/parser": "^5.54.0",
"@vercel/ncc": "^0.38.3", "@vercel/ncc": "^0.38.3",
"eslint": "^8.57.0", "eslint": "^8.57.0",
"eslint-config-prettier": "^8.6.0", "eslint-config-prettier": "^8.6.0",
"eslint-plugin-jest": "^27.9.0", "eslint-plugin-jest": "^29.0.1",
"eslint-plugin-node": "^11.1.0", "eslint-plugin-node": "^11.1.0",
"jest": "^29.7.0", "jest": "^29.7.0",
"jest-circus": "^29.7.0", "jest-circus": "^29.7.0",
"prettier": "^2.8.4", "prettier": "^3.5.3",
"ts-jest": "^29.1.2", "ts-jest": "^29.3.2",
"typescript": "^5.4.2" "typescript": "^5.4.2"
} }
} }

View File

@ -8,6 +8,7 @@ import * as installer from './install-python';
import * as core from '@actions/core'; import * as core from '@actions/core';
import * as tc from '@actions/tool-cache'; import * as tc from '@actions/tool-cache';
import * as exec from '@actions/exec';
// Python has "scripts" or "bin" directories where command-line tools that come with packages are installed. // Python has "scripts" or "bin" directories where command-line tools that come with packages are installed.
// This is where pip is, along with anything that pip installs. // This is where pip is, along with anything that pip installs.
@ -30,6 +31,27 @@ function binDir(installDir: string): string {
} }
} }
async function installPip(pythonLocation: string) {
const pipVersion = core.getInput('pip-version');
// Validate pip-version format: major[.minor][.patch]
const versionRegex = /^\d+(\.\d+)?(\.\d+)?$/;
if (pipVersion && !versionRegex.test(pipVersion)) {
throw new Error(
`Invalid pip-version "${pipVersion}". Please specify a version in the format major[.minor][.patch].`
);
}
if (pipVersion) {
core.info(
`pip-version input is specified. Installing pip version ${pipVersion}`
);
await exec.exec(
`${pythonLocation}/python -m pip install --upgrade pip==${pipVersion} --disable-pip-version-check --no-warn-script-location`
);
}
}
export async function useCpythonVersion( export async function useCpythonVersion(
version: string, version: string,
architecture: string, architecture: string,
@ -179,6 +201,9 @@ export async function useCpythonVersion(
core.setOutput('python-version', pythonVersion); core.setOutput('python-version', pythonVersion);
core.setOutput('python-path', pythonPath); core.setOutput('python-path', pythonPath);
const binaryPath = IS_WINDOWS ? installDir : _binDir;
await installPip(binaryPath);
return {impl: 'CPython', version: pythonVersion}; return {impl: 'CPython', version: pythonVersion};
} }

View File

@ -5,6 +5,7 @@ import * as exec from '@actions/exec';
import * as httpm from '@actions/http-client'; import * as httpm from '@actions/http-client';
import {ExecOptions} from '@actions/exec/lib/interfaces'; import {ExecOptions} from '@actions/exec/lib/interfaces';
import {IS_WINDOWS, IS_LINUX, getDownloadFileName} from './utils'; import {IS_WINDOWS, IS_LINUX, getDownloadFileName} from './utils';
import {IToolRelease} from '@actions/tool-cache';
const TOKEN = core.getInput('token'); const TOKEN = core.getInput('token');
const AUTH = !TOKEN ? undefined : `token ${TOKEN}`; const AUTH = !TOKEN ? undefined : `token ${TOKEN}`;
@ -31,14 +32,41 @@ export async function findReleaseFromManifest(
return foundRelease; return foundRelease;
} }
function isIToolRelease(obj: any): obj is IToolRelease {
return (
typeof obj === 'object' &&
obj !== null &&
typeof obj.version === 'string' &&
typeof obj.stable === 'boolean' &&
Array.isArray(obj.files) &&
obj.files.every(
(file: any) =>
typeof file.filename === 'string' &&
typeof file.platform === 'string' &&
typeof file.arch === 'string' &&
typeof file.download_url === 'string'
)
);
}
export async function getManifest(): Promise<tc.IToolRelease[]> { export async function getManifest(): Promise<tc.IToolRelease[]> {
try { try {
return await getManifestFromRepo(); const repoManifest = await getManifestFromRepo();
if (
Array.isArray(repoManifest) &&
repoManifest.length &&
repoManifest.every(isIToolRelease)
) {
return repoManifest;
}
throw new Error(
'The repository manifest is invalid or does not include any valid tool release (IToolRelease) entries.'
);
} catch (err) { } catch (err) {
core.debug('Fetching the manifest via the API failed.'); core.debug('Fetching the manifest via the API failed.');
if (err instanceof Error) { if (err instanceof Error) {
core.debug(err.message); core.debug(err.message);
} else {
core.error('An unexpected error occurred while fetching the manifest.');
} }
} }
return await getManifestFromURL(); return await getManifestFromURL();
@ -93,6 +121,9 @@ async function installPython(workingDirectory: string) {
} }
export async function installCpythonFromRelease(release: tc.IToolRelease) { export async function installCpythonFromRelease(release: tc.IToolRelease) {
if (!release.files || release.files.length === 0) {
throw new Error('No files found in the release to download.');
}
const downloadUrl = release.files[0].download_url; const downloadUrl = release.files[0].download_url;
core.info(`Download from "${downloadUrl}"`); core.info(`Download from "${downloadUrl}"`);
@ -113,9 +144,13 @@ export async function installCpythonFromRelease(release: tc.IToolRelease) {
} catch (err) { } catch (err) {
if (err instanceof tc.HTTPError) { if (err instanceof tc.HTTPError) {
// Rate limit? // Rate limit?
if (err.httpStatusCode === 403 || err.httpStatusCode === 429) { if (err.httpStatusCode === 403) {
core.error(
`Received HTTP status code 403. This indicates a permission issue or restricted access.`
);
} else if (err.httpStatusCode === 429) {
core.info( core.info(
`Received HTTP status code ${err.httpStatusCode}. This usually indicates the rate limit has been exceeded` `Received HTTP status code 429. This usually indicates the rate limit has been exceeded`
); );
} else { } else {
core.info(err.message); core.info(err.message);

View File

@ -11,7 +11,7 @@ import {
logWarning, logWarning,
IS_MAC, IS_MAC,
getVersionInputFromFile, getVersionInputFromFile,
getVersionInputFromPlainFile getVersionsInputFromPlainFile
} from './utils'; } from './utils';
function isPyPyVersion(versionSpec: string) { function isPyPyVersion(versionSpec: string) {
@ -35,7 +35,7 @@ async function cacheDependencies(cache: string, pythonVersion: string) {
function resolveVersionInputFromDefaultFile(): string[] { function resolveVersionInputFromDefaultFile(): string[] {
const couples: [string, (versionFile: string) => string[]][] = [ const couples: [string, (versionFile: string) => string[]][] = [
['.python-version', getVersionInputFromPlainFile] ['.python-version', getVersionsInputFromPlainFile]
]; ];
for (const [versionFile, _fn] of couples) { for (const [versionFile, _fn] of couples) {
logWarning( logWarning(

View File

@ -228,7 +228,7 @@ function extractValue(obj: any, keys: string[]): string | undefined {
* If none is present, returns an empty list. * If none is present, returns an empty list.
*/ */
export function getVersionInputFromTomlFile(versionFile: string): string[] { export function getVersionInputFromTomlFile(versionFile: string): string[] {
core.debug(`Trying to resolve version form ${versionFile}`); core.debug(`Trying to resolve version from ${versionFile}`);
let pyprojectFile = fs.readFileSync(versionFile, 'utf8'); let pyprojectFile = fs.readFileSync(versionFile, 'utf8');
// Normalize the line endings in the pyprojectFile // Normalize the line endings in the pyprojectFile
@ -269,13 +269,28 @@ export function getVersionInputFromTomlFile(versionFile: string): string[] {
} }
/** /**
* Python version extracted from a plain text file. * Python versions extracted from a plain text file.
* - Resolves multiple versions from multiple lines.
* - Handles pyenv-virtualenv pointers (e.g. `3.10/envs/virtualenv`).
* - Ignores empty lines and lines starting with `#`
* - Trims whitespace.
*/ */
export function getVersionInputFromPlainFile(versionFile: string): string[] { export function getVersionsInputFromPlainFile(versionFile: string): string[] {
core.debug(`Trying to resolve version form ${versionFile}`); core.debug(`Trying to resolve versions from ${versionFile}`);
const version = fs.readFileSync(versionFile, 'utf8').trim(); const content = fs.readFileSync(versionFile, 'utf8').trim();
core.info(`Resolved ${versionFile} as ${version}`); const lines = content.split(/\r\n|\r|\n/);
return [version]; const versions = lines
.map(line => {
if (line.startsWith('#') || line.trim() === '') {
return undefined;
}
let version: string = line.trim();
version = version.split('/')[0];
return version;
})
.filter(version => version !== undefined) as string[];
core.info(`Resolved ${versionFile} as ${versions.join(', ')}`);
return versions;
} }
/** /**
@ -319,7 +334,7 @@ export function getVersionInputFromFile(versionFile: string): string[] {
} else if (versionFile.match('.tool-versions')) { } else if (versionFile.match('.tool-versions')) {
return getVersionInputFromToolVersions(versionFile); return getVersionInputFromToolVersions(versionFile);
} else { } else {
return getVersionInputFromPlainFile(versionFile); return getVersionsInputFromPlainFile(versionFile);
} }
} }