-
Notifications
You must be signed in to change notification settings - Fork 617
Output python-versions
, containing all Python versions, for cache-busting
#611
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
python-versions
for cache-busting
Closes #606
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -95,6 +95,7 @@ async function run() { | |
|
||
if (versions.length) { | ||
let pythonVersion = ''; | ||
const pythonVersions: string[] = []; | ||
const arch: string = core.getInput('architecture') || os.arch(); | ||
const updateEnvironment = core.getBooleanInput('update-environment'); | ||
core.startGroup('Installed versions'); | ||
|
@@ -108,6 +109,9 @@ async function run() { | |
allowPreReleases | ||
); | ||
pythonVersion = `${installed.resolvedPyPyVersion}-${installed.resolvedPythonVersion}`; | ||
pythonVersions.push( | ||
`${installed.resolvedPythonVersion}-pypy${installed.resolvedPyPyVersion}` | ||
); | ||
core.info( | ||
`Successfully set up PyPy ${installed.resolvedPyPyVersion} with Python (${installed.resolvedPythonVersion})` | ||
); | ||
|
@@ -120,6 +124,7 @@ async function run() { | |
allowPreReleases | ||
); | ||
pythonVersion = `${installed}`; | ||
pythonVersions.push(`graalpy${installed}`); | ||
core.info(`Successfully set up GraalPy ${installed}`); | ||
} else { | ||
if (version.startsWith('2')) { | ||
|
@@ -135,9 +140,11 @@ async function run() { | |
allowPreReleases | ||
); | ||
pythonVersion = installed.version; | ||
pythonVersions.push(installed.version); | ||
core.info(`Successfully set up ${installed.impl} (${pythonVersion})`); | ||
} | ||
} | ||
core.setOutput('python-versions', pythonVersions.sort().join(',')); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need to sort versions ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I sorted it to help stabilize the cache key. If one developer writes their workflow YAML file as: - uses: actions/setup-python@v4
with:
python-version: |
3.11
3.10
3.9
3.8
3.7 and the versions are later rearranged to: - uses: actions/setup-python@v4
with:
python-version: |
3.7
3.8
3.9
3.10
3.11 sorting the versions will provide stability to the cache key. I currently think this is beneficial behavior, but can remove the sorting if desired. |
||
core.endGroup(); | ||
const cache = core.getInput('cache'); | ||
if (cache && isCacheFeatureAvailable()) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to change pypy and python version parts order ?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm fine with either order.
I did it this way for potential parsing purposes later in the workflow. It seemed like if someone wanted to determine all of the Python versions (regardless of CPython vs PyPy implementation), it would be easier if the Python version appeared at the beginning of the string. If
-pypy
appeared later in the string it could be stripped off or extracted out as needed.However, I don't view the ordering as a critical need, and can change the order if desired.