Output python-versions for cache-busting

Closes #606
This commit is contained in:
Kurt McKee 2023-02-09 21:41:05 -06:00
parent 5f2af211d6
commit 2d235cd868
No known key found for this signature in database
GPG Key ID: 64713C0B5BA8E1C2
3 changed files with 14 additions and 0 deletions

View File

@ -29,6 +29,8 @@ inputs:
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."
python-versions:
description: "A comma-separated list of all installed Python implementations and versions. Useful for cache-busting."
cache-hit: cache-hit:
description: "A boolean value to indicate a cache entry was found" description: "A boolean value to indicate a cache entry was found"
python-path: python-path:

5
dist/setup/index.js vendored
View File

@ -70208,6 +70208,7 @@ function run() {
const allowPreReleases = core.getBooleanInput('allow-prereleases'); const allowPreReleases = core.getBooleanInput('allow-prereleases');
if (versions.length) { if (versions.length) {
let pythonVersion = ''; let pythonVersion = '';
const pythonVersions = [];
const arch = core.getInput('architecture') || os.arch(); const arch = core.getInput('architecture') || os.arch();
const updateEnvironment = core.getBooleanInput('update-environment'); const updateEnvironment = core.getBooleanInput('update-environment');
core.startGroup('Installed versions'); core.startGroup('Installed versions');
@ -70215,11 +70216,13 @@ function run() {
if (isPyPyVersion(version)) { if (isPyPyVersion(version)) {
const installed = yield finderPyPy.findPyPyVersion(version, arch, updateEnvironment, checkLatest, allowPreReleases); const installed = yield finderPyPy.findPyPyVersion(version, arch, updateEnvironment, checkLatest, allowPreReleases);
pythonVersion = `${installed.resolvedPyPyVersion}-${installed.resolvedPythonVersion}`; pythonVersion = `${installed.resolvedPyPyVersion}-${installed.resolvedPythonVersion}`;
pythonVersions.push(`${installed.resolvedPythonVersion}-pypy${installed.resolvedPyPyVersion}`);
core.info(`Successfully set up PyPy ${installed.resolvedPyPyVersion} with Python (${installed.resolvedPythonVersion})`); core.info(`Successfully set up PyPy ${installed.resolvedPyPyVersion} with Python (${installed.resolvedPythonVersion})`);
} }
else if (isGraalPyVersion(version)) { else if (isGraalPyVersion(version)) {
const installed = yield finderGraalPy.findGraalPyVersion(version, arch, updateEnvironment, checkLatest, allowPreReleases); const installed = yield finderGraalPy.findGraalPyVersion(version, arch, updateEnvironment, checkLatest, allowPreReleases);
pythonVersion = `${installed}`; pythonVersion = `${installed}`;
pythonVersions.push(`graalpy${installed}`);
core.info(`Successfully set up GraalPy ${installed}`); core.info(`Successfully set up GraalPy ${installed}`);
} }
else { else {
@ -70228,9 +70231,11 @@ function run() {
} }
const installed = yield finder.useCpythonVersion(version, arch, updateEnvironment, checkLatest, allowPreReleases); const installed = yield finder.useCpythonVersion(version, arch, updateEnvironment, checkLatest, allowPreReleases);
pythonVersion = installed.version; pythonVersion = installed.version;
pythonVersions.push(installed.version);
core.info(`Successfully set up ${installed.impl} (${pythonVersion})`); core.info(`Successfully set up ${installed.impl} (${pythonVersion})`);
} }
} }
core.setOutput('python-versions', pythonVersions.sort().join(','));
core.endGroup(); core.endGroup();
const cache = core.getInput('cache'); const cache = core.getInput('cache');
if (cache && utils_1.isCacheFeatureAvailable()) { if (cache && utils_1.isCacheFeatureAvailable()) {

View File

@ -95,6 +95,7 @@ async function run() {
if (versions.length) { if (versions.length) {
let pythonVersion = ''; let pythonVersion = '';
const pythonVersions: string[] = [];
const arch: string = core.getInput('architecture') || os.arch(); const arch: string = core.getInput('architecture') || os.arch();
const updateEnvironment = core.getBooleanInput('update-environment'); const updateEnvironment = core.getBooleanInput('update-environment');
core.startGroup('Installed versions'); core.startGroup('Installed versions');
@ -108,6 +109,9 @@ async function run() {
allowPreReleases allowPreReleases
); );
pythonVersion = `${installed.resolvedPyPyVersion}-${installed.resolvedPythonVersion}`; pythonVersion = `${installed.resolvedPyPyVersion}-${installed.resolvedPythonVersion}`;
pythonVersions.push(
`${installed.resolvedPythonVersion}-pypy${installed.resolvedPyPyVersion}`
);
core.info( core.info(
`Successfully set up PyPy ${installed.resolvedPyPyVersion} with Python (${installed.resolvedPythonVersion})` `Successfully set up PyPy ${installed.resolvedPyPyVersion} with Python (${installed.resolvedPythonVersion})`
); );
@ -120,6 +124,7 @@ async function run() {
allowPreReleases allowPreReleases
); );
pythonVersion = `${installed}`; pythonVersion = `${installed}`;
pythonVersions.push(`graalpy${installed}`);
core.info(`Successfully set up GraalPy ${installed}`); core.info(`Successfully set up GraalPy ${installed}`);
} else { } else {
if (version.startsWith('2')) { if (version.startsWith('2')) {
@ -135,9 +140,11 @@ async function run() {
allowPreReleases allowPreReleases
); );
pythonVersion = installed.version; pythonVersion = installed.version;
pythonVersions.push(installed.version);
core.info(`Successfully set up ${installed.impl} (${pythonVersion})`); core.info(`Successfully set up ${installed.impl} (${pythonVersion})`);
} }
} }
core.setOutput('python-versions', pythonVersions.sort().join(','));
core.endGroup(); core.endGroup();
const cache = core.getInput('cache'); const cache = core.getInput('cache');
if (cache && isCacheFeatureAvailable()) { if (cache && isCacheFeatureAvailable()) {