mirror of
https://github.com/actions/setup-python.git
synced 2025-04-21 17:23:52 +00:00
Compare commits
No commits in common. "main" and "v5.5.0" have entirely different histories.
4
.github/workflows/e2e-cache.yml
vendored
4
.github/workflows/e2e-cache.yml
vendored
@ -78,12 +78,8 @@ 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
|
||||||
|
1
.github/workflows/e2e-tests.yml
vendored
1
.github/workflows/e2e-tests.yml
vendored
@ -19,6 +19,7 @@ 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,
|
||||||
|
2
.github/workflows/test-graalpy.yml
vendored
2
.github/workflows/test-graalpy.yml
vendored
@ -21,6 +21,7 @@ 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,
|
||||||
@ -76,6 +77,7 @@ 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,
|
||||||
|
4
.github/workflows/test-pypy.yml
vendored
4
.github/workflows/test-pypy.yml
vendored
@ -24,6 +24,7 @@ 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,
|
||||||
@ -141,6 +142,7 @@ 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,
|
||||||
@ -175,6 +177,7 @@ 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,
|
||||||
@ -217,6 +220,7 @@ 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,
|
||||||
|
8
.github/workflows/test-python.yml
vendored
8
.github/workflows/test-python.yml
vendored
@ -24,6 +24,7 @@ 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,
|
||||||
@ -68,6 +69,7 @@ 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,
|
||||||
@ -115,6 +117,7 @@ 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,
|
||||||
@ -160,6 +163,7 @@ 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,
|
||||||
@ -210,6 +214,7 @@ 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,
|
||||||
@ -260,6 +265,7 @@ 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,
|
||||||
@ -294,6 +300,7 @@ 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,
|
||||||
@ -412,6 +419,7 @@ 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,
|
||||||
|
@ -8,29 +8,10 @@ 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', () => ({
|
|
||||||
getManifestFromRepo: jest.fn()
|
const mockManifest = [{version: '1.0.0'}];
|
||||||
}));
|
|
||||||
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();
|
||||||
|
32
dist/setup/index.js
vendored
32
dist/setup/index.js
vendored
@ -97461,36 +97461,16 @@ function findReleaseFromManifest(semanticVersionSpec, architecture, manifest) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
exports.findReleaseFromManifest = findReleaseFromManifest;
|
exports.findReleaseFromManifest = findReleaseFromManifest;
|
||||||
function isIToolRelease(obj) {
|
|
||||||
return (typeof obj === 'object' &&
|
|
||||||
obj !== null &&
|
|
||||||
typeof obj.version === 'string' &&
|
|
||||||
typeof obj.stable === 'boolean' &&
|
|
||||||
Array.isArray(obj.files) &&
|
|
||||||
obj.files.every((file) => typeof file.filename === 'string' &&
|
|
||||||
typeof file.platform === 'string' &&
|
|
||||||
typeof file.arch === 'string' &&
|
|
||||||
typeof file.download_url === 'string'));
|
|
||||||
}
|
|
||||||
function getManifest() {
|
function getManifest() {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
try {
|
try {
|
||||||
const repoManifest = yield getManifestFromRepo();
|
return yield 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 yield getManifestFromURL();
|
return yield getManifestFromURL();
|
||||||
});
|
});
|
||||||
@ -97538,9 +97518,6 @@ function installPython(workingDirectory) {
|
|||||||
}
|
}
|
||||||
function installCpythonFromRelease(release) {
|
function installCpythonFromRelease(release) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
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}"`);
|
||||||
let pythonPath = '';
|
let pythonPath = '';
|
||||||
@ -97561,11 +97538,8 @@ function installCpythonFromRelease(release) {
|
|||||||
catch (err) {
|
catch (err) {
|
||||||
if (err instanceof tc.HTTPError) {
|
if (err instanceof tc.HTTPError) {
|
||||||
// Rate limit?
|
// Rate limit?
|
||||||
if (err.httpStatusCode === 403) {
|
if (err.httpStatusCode === 403 || err.httpStatusCode === 429) {
|
||||||
core.error(`Received HTTP status code 403. This indicates a permission issue or restricted access.`);
|
core.info(`Received HTTP status code ${err.httpStatusCode}. This usually indicates the rate limit has been exceeded`);
|
||||||
}
|
|
||||||
else if (err.httpStatusCode === 429) {
|
|
||||||
core.info(`Received HTTP status code 429. This usually indicates the rate limit has been exceeded`);
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
core.info(err.message);
|
core.info(err.message);
|
||||||
|
@ -5,7 +5,6 @@ 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}`;
|
||||||
@ -32,41 +31,14 @@ 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 {
|
||||||
const repoManifest = await getManifestFromRepo();
|
return 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();
|
||||||
@ -121,9 +93,6 @@ 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}"`);
|
||||||
@ -144,13 +113,9 @@ 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) {
|
if (err.httpStatusCode === 403 || err.httpStatusCode === 429) {
|
||||||
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 429. This usually indicates the rate limit has been exceeded`
|
`Received HTTP status code ${err.httpStatusCode}. This usually indicates the rate limit has been exceeded`
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
core.info(err.message);
|
core.info(err.message);
|
||||||
|
Loading…
Reference in New Issue
Block a user