5
0
mirror of https://gitea.com/actions/setup-python.git synced 2026-06-20 02:31:17 +00:00

Add RHEL support and include Linux distro in cache keys (#1323)

* Add RHEL support for manifest matching and OS detection

* update dist

* make cache keys distro-aware and key RHEL by major version

* Normalize RHEL OS detection and improve cache key consistency

* Refactor OS info retrieval to use getOSInfo and handle null cases for improved reliability
This commit is contained in:
Priya Gupta
2026-06-19 05:17:28 +05:30
committed by GitHub
parent c8813ba1bc
commit 0cb1a84326
9 changed files with 5612 additions and 52 deletions
+6 -13
View File
@@ -190,19 +190,12 @@ virtualenvs.path = "{cache-dir}/virtualenvs" # /Users/patrick/Library/Caches/py
restoredKeys.forEach(restoredKey => {
if (restoredKey) {
if (process.platform === 'linux' && packageManager === 'pip') {
expect(infoSpy).toHaveBeenCalledWith(
`Cache restored from key: setup-python-${process.env['RUNNER_OS']}-${process.arch}-20.04-Ubuntu-python-${pythonVersion}-${packageManager}-${fileHash}`
);
} else if (packageManager === 'poetry') {
expect(infoSpy).toHaveBeenCalledWith(
`Cache restored from key: setup-python-${process.env['RUNNER_OS']}-${process.arch}-python-${pythonVersion}-${packageManager}-v2-${fileHash}`
);
} else {
expect(infoSpy).toHaveBeenCalledWith(
`Cache restored from key: setup-python-${process.env['RUNNER_OS']}-${process.arch}-python-${pythonVersion}-${packageManager}-${fileHash}`
);
}
const osSegment =
process.platform === 'linux' ? '-20.04-Ubuntu' : '';
const versionSuffix = packageManager === 'poetry' ? '-v2' : '';
expect(infoSpy).toHaveBeenCalledWith(
`Cache restored from key: setup-python-${process.env['RUNNER_OS']}-${process.arch}${osSegment}-python-${pythonVersion}-${packageManager}${versionSuffix}-${fileHash}`
);
} else {
expect(infoSpy).toHaveBeenCalledWith(
`${packageManager} cache is not found`