Skip to content

Commit b12532f

Browse files
authored
fix: fall back to VERSION_CODENAME when VERSION_ID is not available (#774)
Debian unstable and testing don't have VERSION_ID in /etc/os-release. This change falls back to VERSION_CODENAME when VERSION_ID is missing, producing cache keys like 'debian-sid' for unstable. Fixes #773
1 parent 0098a75 commit b12532f

File tree

4 files changed

+33
-0
lines changed

4 files changed

+33
-0
lines changed

.github/workflows/test.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,20 @@ jobs:
418418
PY
419419
shell: bash
420420

421+
test-debian-unstable:
422+
runs-on: ubuntu-latest
423+
container: debian:unstable
424+
steps:
425+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
426+
with:
427+
persist-credentials: false
428+
- name: Install latest version
429+
uses: ./
430+
with:
431+
enable-cache: true
432+
- run: uv sync
433+
working-directory: __tests__/fixtures/uv-project
434+
421435
test-musl:
422436
runs-on: ubuntu-latest
423437
container: alpine
@@ -1031,6 +1045,7 @@ jobs:
10311045
- test-python-version
10321046
- test-activate-environment
10331047
- test-activate-environment-custom-path
1048+
- test-debian-unstable
10341049
- test-musl
10351050
- test-cache-key-os-version
10361051
- test-cache-local

dist/save-cache/index.js

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/setup/index.js

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/utils/platforms.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,16 @@ function getLinuxOSNameVersion(): string {
106106
const content = fs.readFileSync(file, "utf8");
107107
const id = parseOsReleaseValue(content, "ID");
108108
const versionId = parseOsReleaseValue(content, "VERSION_ID");
109+
// Fallback for rolling releases (debian:unstable/testing, arch, etc.)
110+
// that don't have VERSION_ID but have VERSION_CODENAME
111+
const versionCodename = parseOsReleaseValue(content, "VERSION_CODENAME");
109112

110113
if (id && versionId) {
111114
return `${id}-${versionId}`;
112115
}
116+
if (id && versionCodename) {
117+
return `${id}-${versionCodename}`;
118+
}
113119
} catch {
114120
// Try next file
115121
}

0 commit comments

Comments
 (0)