Skip to content

Commit 0cb1a84

Browse files
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
1 parent c8813ba commit 0cb1a84

9 files changed

Lines changed: 12469 additions & 6909 deletions

File tree

__tests__/cache-restore.test.ts

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -190,19 +190,12 @@ virtualenvs.path = "{cache-dir}/virtualenvs" # /Users/patrick/Library/Caches/py
190190

191191
restoredKeys.forEach(restoredKey => {
192192
if (restoredKey) {
193-
if (process.platform === 'linux' && packageManager === 'pip') {
194-
expect(infoSpy).toHaveBeenCalledWith(
195-
`Cache restored from key: setup-python-${process.env['RUNNER_OS']}-${process.arch}-20.04-Ubuntu-python-${pythonVersion}-${packageManager}-${fileHash}`
196-
);
197-
} else if (packageManager === 'poetry') {
198-
expect(infoSpy).toHaveBeenCalledWith(
199-
`Cache restored from key: setup-python-${process.env['RUNNER_OS']}-${process.arch}-python-${pythonVersion}-${packageManager}-v2-${fileHash}`
200-
);
201-
} else {
202-
expect(infoSpy).toHaveBeenCalledWith(
203-
`Cache restored from key: setup-python-${process.env['RUNNER_OS']}-${process.arch}-python-${pythonVersion}-${packageManager}-${fileHash}`
204-
);
205-
}
193+
const osSegment =
194+
process.platform === 'linux' ? '-20.04-Ubuntu' : '';
195+
const versionSuffix = packageManager === 'poetry' ? '-v2' : '';
196+
expect(infoSpy).toHaveBeenCalledWith(
197+
`Cache restored from key: setup-python-${process.env['RUNNER_OS']}-${process.arch}${osSegment}-python-${pythonVersion}-${packageManager}${versionSuffix}-${fileHash}`
198+
);
206199
} else {
207200
expect(infoSpy).toHaveBeenCalledWith(
208201
`${packageManager} cache is not found`

0 commit comments

Comments
 (0)