mirror of
https://gitea.com/actions/setup-python.git
synced 2025-10-26 07:16:42 +00:00
graalpy: add graalpy early-access and windows builds (#880)
This commit is contained in:
@@ -15,7 +15,6 @@ import {
|
||||
IGraalPyManifestRelease,
|
||||
createSymlinkInFolder,
|
||||
isNightlyKeyword,
|
||||
getBinaryDirectory,
|
||||
getNextPageUrl
|
||||
} from './utils';
|
||||
|
||||
@@ -64,7 +63,11 @@ export async function installGraalPy(
|
||||
const graalpyPath = await tc.downloadTool(downloadUrl, undefined, AUTH);
|
||||
|
||||
core.info('Extracting downloaded archive...');
|
||||
downloadDir = await tc.extractTar(graalpyPath);
|
||||
if (IS_WINDOWS) {
|
||||
downloadDir = await tc.extractZip(graalpyPath);
|
||||
} else {
|
||||
downloadDir = await tc.extractTar(graalpyPath);
|
||||
}
|
||||
|
||||
// root folder in archive can have unpredictable name so just take the first folder
|
||||
// downloadDir is unique folder under TEMP and can't contain any other folders
|
||||
@@ -81,7 +84,7 @@ export async function installGraalPy(
|
||||
);
|
||||
}
|
||||
|
||||
const binaryPath = getBinaryDirectory(installDir);
|
||||
const binaryPath = path.join(installDir, 'bin');
|
||||
await createGraalPySymlink(binaryPath, resolvedGraalPyVersion);
|
||||
await installPip(binaryPath);
|
||||
|
||||
@@ -115,6 +118,9 @@ export async function getAvailableGraalPyVersions() {
|
||||
headers.authorization = AUTH;
|
||||
}
|
||||
|
||||
/*
|
||||
Get releases first.
|
||||
*/
|
||||
let url: string | null =
|
||||
'https://api.github.com/repos/oracle/graalpython/releases';
|
||||
const result: IGraalPyManifestRelease[] = [];
|
||||
@@ -130,6 +136,23 @@ export async function getAvailableGraalPyVersions() {
|
||||
url = getNextPageUrl(response);
|
||||
} while (url);
|
||||
|
||||
/*
|
||||
Add pre-release builds.
|
||||
*/
|
||||
url =
|
||||
'https://api.github.com/repos/graalvm/graal-languages-ea-builds/releases';
|
||||
do {
|
||||
const response: ifm.TypedResponse<IGraalPyManifestRelease[]> =
|
||||
await http.getJson(url, headers);
|
||||
if (!response.result) {
|
||||
throw new Error(
|
||||
`Unable to retrieve the list of available GraalPy versions from '${url}'`
|
||||
);
|
||||
}
|
||||
result.push(...response.result);
|
||||
url = getNextPageUrl(response);
|
||||
} while (url);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -175,7 +198,8 @@ async function installPip(pythonLocation: string) {
|
||||
}
|
||||
|
||||
export function graalPyTagToVersion(tag: string) {
|
||||
const versionPattern = /.*-(\d+\.\d+\.\d+(?:\.\d+)?)((?:a|b|rc))?(\d*)?/;
|
||||
const versionPattern =
|
||||
/.*-(\d+\.\d+\.\d+(?:\.\d+)?)(?:-((?:ea|a|b|rc))\.0*(\d+))?/;
|
||||
const match = tag.match(versionPattern);
|
||||
if (match && match[2]) {
|
||||
return `${match[1]}-${match[2]}.${match[3]}`;
|
||||
@@ -251,10 +275,11 @@ export function findAsset(
|
||||
) {
|
||||
const graalpyArch = toGraalPyArchitecture(architecture);
|
||||
const graalpyPlatform = toGraalPyPlatform(platform);
|
||||
const graalpyExt = platform == 'win32' ? 'zip' : 'tar.gz';
|
||||
const found = item.assets.filter(
|
||||
file =>
|
||||
file.name.startsWith('graalpy') &&
|
||||
file.name.endsWith(`-${graalpyPlatform}-${graalpyArch}.tar.gz`)
|
||||
file.name.endsWith(`-${graalpyPlatform}-${graalpyArch}.${graalpyExt}`)
|
||||
);
|
||||
/*
|
||||
In the future there could be more variants of GraalPy for a single release. Pick the shortest name, that one is the most likely to be the primary variant.
|
||||
|
||||
Reference in New Issue
Block a user