Skip to content

Commit 3d7a141

Browse files
authored
CI: Use ImageOS (ubuntu24) instead of runner.os (Linux) in cache keys (#130200)
1 parent aa845af commit 3d7a141

File tree

5 files changed

+27
-27
lines changed

5 files changed

+27
-27
lines changed

.github/workflows/build.yml

+15-17
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,6 @@ jobs:
6262
with:
6363
fetch-depth: 1
6464
persist-credentials: false
65-
- name: Runner image version
66-
run: echo "IMAGE_VERSION=${ImageVersion}" >> "$GITHUB_ENV"
6765
- name: Check Autoconf and aclocal versions
6866
run: |
6967
grep "Generated by GNU Autoconf 2.72" configure
@@ -104,14 +102,14 @@ jobs:
104102
with:
105103
python-version: '3.x'
106104
- name: Runner image version
107-
run: echo "IMAGE_VERSION=${ImageVersion}" >> "$GITHUB_ENV"
105+
run: echo "IMAGE_OS_VERSION=${ImageOS}-${ImageVersion}" >> "$GITHUB_ENV"
108106
- name: Restore config.cache
109107
uses: actions/cache@v4
110108
with:
111109
path: config.cache
112110
# Include env.pythonLocation in key to avoid changes in environment when setup-python updates Python
113-
key: ${{ github.job }}-${{ runner.os }}-${{ env.IMAGE_VERSION }}-${{ needs.build-context.outputs.config-hash }}-${{ env.pythonLocation }}
114-
- name: Install Dependencies
111+
key: ${{ github.job }}-${{ env.IMAGE_OS_VERSION }}-${{ needs.build-context.outputs.config-hash }}-${{ env.pythonLocation }}
112+
- name: Install dependencies
115113
run: sudo ./.github/workflows/posix-deps-apt.sh
116114
- name: Add ccache to PATH
117115
run: echo "PATH=/usr/lib/ccache:$PATH" >> "$GITHUB_ENV"
@@ -284,15 +282,15 @@ jobs:
284282
with:
285283
persist-credentials: false
286284
- name: Runner image version
287-
run: echo "IMAGE_VERSION=${ImageVersion}" >> "$GITHUB_ENV"
285+
run: echo "IMAGE_OS_VERSION=${ImageOS}-${ImageVersion}" >> "$GITHUB_ENV"
288286
- name: Restore config.cache
289287
uses: actions/cache@v4
290288
with:
291289
path: config.cache
292-
key: ${{ github.job }}-${{ runner.os }}-${{ env.IMAGE_VERSION }}-${{ needs.build-context.outputs.config-hash }}
290+
key: ${{ github.job }}-${{ env.IMAGE_OS_VERSION }}-${{ needs.build-context.outputs.config-hash }}
293291
- name: Register gcc problem matcher
294292
run: echo "::add-matcher::.github/problem-matchers/gcc.json"
295-
- name: Install Dependencies
293+
- name: Install dependencies
296294
run: sudo ./.github/workflows/posix-deps-apt.sh
297295
- name: Configure OpenSSL env vars
298296
run: |
@@ -347,7 +345,7 @@ jobs:
347345
persist-credentials: false
348346
- name: Register gcc problem matcher
349347
run: echo "::add-matcher::.github/problem-matchers/gcc.json"
350-
- name: Install Dependencies
348+
- name: Install dependencies
351349
run: sudo ./.github/workflows/posix-deps-apt.sh
352350
- name: Configure OpenSSL env vars
353351
run: |
@@ -379,12 +377,12 @@ jobs:
379377
- name: Bind mount sources read-only
380378
run: sudo mount --bind -o ro "$GITHUB_WORKSPACE" "$CPYTHON_RO_SRCDIR"
381379
- name: Runner image version
382-
run: echo "IMAGE_VERSION=${ImageVersion}" >> "$GITHUB_ENV"
380+
run: echo "IMAGE_OS_VERSION=${ImageOS}-${ImageVersion}" >> "$GITHUB_ENV"
383381
- name: Restore config.cache
384382
uses: actions/cache@v4
385383
with:
386384
path: ${{ env.CPYTHON_BUILDDIR }}/config.cache
387-
key: ${{ github.job }}-${{ runner.os }}-${{ env.IMAGE_VERSION }}-${{ needs.build-context.outputs.config-hash }}
385+
key: ${{ github.job }}-${{ env.IMAGE_OS_VERSION }}-${{ needs.build-context.outputs.config-hash }}
388386
- name: Configure CPython out-of-tree
389387
working-directory: ${{ env.CPYTHON_BUILDDIR }}
390388
run: |
@@ -466,15 +464,15 @@ jobs:
466464
with:
467465
persist-credentials: false
468466
- name: Runner image version
469-
run: echo "IMAGE_VERSION=${ImageVersion}" >> "$GITHUB_ENV"
467+
run: echo "IMAGE_OS_VERSION=${ImageOS}-${ImageVersion}" >> "$GITHUB_ENV"
470468
- name: Restore config.cache
471469
uses: actions/cache@v4
472470
with:
473471
path: config.cache
474-
key: ${{ github.job }}-${{ runner.os }}-${{ env.IMAGE_VERSION }}-${{ needs.build-context.outputs.config-hash }}
472+
key: ${{ github.job }}-${{ env.IMAGE_OS_VERSION }}-${{ needs.build-context.outputs.config-hash }}
475473
- name: Register gcc problem matcher
476474
run: echo "::add-matcher::.github/problem-matchers/gcc.json"
477-
- name: Install Dependencies
475+
- name: Install dependencies
478476
run: sudo ./.github/workflows/posix-deps-apt.sh
479477
- name: Set up GCC-10 for ASAN
480478
uses: egor-tensin/setup-gcc@v1
@@ -537,19 +535,19 @@ jobs:
537535
with:
538536
persist-credentials: false
539537
- name: Runner image version
540-
run: echo "IMAGE_VERSION=${ImageVersion}" >> "$GITHUB_ENV"
538+
run: echo "IMAGE_OS_VERSION=${ImageOS}-${ImageVersion}" >> "$GITHUB_ENV"
541539
- name: Restore config.cache
542540
uses: actions/cache@v4
543541
with:
544542
path: config.cache
545-
key: ${{ github.job }}-${{ runner.os }}-${{ env.IMAGE_VERSION }}-${{ needs.build-context.outputs.config-hash }}
543+
key: ${{ github.job }}-${{ env.IMAGE_OS_VERSION }}-${{ needs.build-context.outputs.config-hash }}
546544
- name: Register gcc problem matcher
547545
run: echo "::add-matcher::.github/problem-matchers/gcc.json"
548546
- name: Set build dir
549547
run:
550548
# an absolute path outside of the working directoy
551549
echo "BUILD_DIR=$(realpath ${{ github.workspace }}/../build)" >> "$GITHUB_ENV"
552-
- name: Install Dependencies
550+
- name: Install dependencies
553551
run: sudo ./.github/workflows/posix-deps-apt.sh
554552
- name: Configure host build
555553
run: ./configure --prefix="$BUILD_DIR/host-python"

.github/workflows/reusable-macos.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,12 @@ jobs:
3535
with:
3636
persist-credentials: false
3737
- name: Runner image version
38-
run: echo "IMAGE_VERSION=${ImageVersion}" >> "$GITHUB_ENV"
38+
run: echo "IMAGE_OS_VERSION=${ImageOS}-${ImageVersion}" >> "$GITHUB_ENV"
3939
- name: Restore config.cache
4040
uses: actions/cache@v4
4141
with:
4242
path: config.cache
43-
key: ${{ github.job }}-${{ inputs.os }}-${{ env.IMAGE_VERSION }}-${{ inputs.config_hash }}
43+
key: ${{ github.job }}-${{ env.IMAGE_OS_VERSION }}-${{ inputs.config_hash }}
4444
- name: Install Homebrew dependencies
4545
run: |
4646
brew install pkg-config [email protected] xz gdbm tcl-tk@8 make

.github/workflows/reusable-tsan.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@ jobs:
2525
with:
2626
persist-credentials: false
2727
- name: Runner image version
28-
run: echo "IMAGE_VERSION=${ImageVersion}" >> "$GITHUB_ENV"
28+
run: echo "IMAGE_OS_VERSION=${ImageOS}-${ImageVersion}" >> "$GITHUB_ENV"
2929
- name: Restore config.cache
3030
uses: actions/cache@v4
3131
with:
3232
path: config.cache
33-
key: ${{ github.job }}-${{ runner.os }}-${{ env.IMAGE_VERSION }}-${{ inputs.config_hash }}
34-
- name: Install Dependencies
33+
key: ${{ github.job }}-${{ env.IMAGE_OS_VERSION }}-${{ inputs.config_hash }}
34+
- name: Install dependencies
3535
run: |
3636
sudo ./.github/workflows/posix-deps-apt.sh
3737
# Install clang-18
@@ -44,7 +44,7 @@ jobs:
4444
sudo update-alternatives --set clang++ /usr/bin/clang++-17
4545
# Reduce ASLR to avoid TSAN crashing
4646
sudo sysctl -w vm.mmap_rnd_bits=28
47-
- name: TSAN Option Setup
47+
- name: TSAN option setup
4848
run: |
4949
echo "TSAN_OPTIONS=log_path=${GITHUB_WORKSPACE}/tsan_log suppressions=${GITHUB_WORKSPACE}/Tools/tsan/suppressions${{
5050
fromJSON(inputs.free-threading)

.github/workflows/reusable-ubuntu.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,12 @@ jobs:
7878
- name: Bind mount sources read-only
7979
run: sudo mount --bind -o ro "$GITHUB_WORKSPACE" "$CPYTHON_RO_SRCDIR"
8080
- name: Runner image version
81-
run: echo "IMAGE_VERSION=${ImageVersion}" >> "$GITHUB_ENV"
81+
run: echo "IMAGE_OS_VERSION=${ImageOS}-${ImageVersion}" >> "$GITHUB_ENV"
8282
- name: Restore config.cache
8383
uses: actions/cache@v4
8484
with:
8585
path: ${{ env.CPYTHON_BUILDDIR }}/config.cache
86-
key: ${{ github.job }}-${{ runner.os }}-${{ env.IMAGE_VERSION }}-${{ inputs.config_hash }}
86+
key: ${{ github.job }}-${{ env.IMAGE_OS_VERSION }}-${{ inputs.config_hash }}
8787
- name: Configure CPython out-of-tree
8888
working-directory: ${{ env.CPYTHON_BUILDDIR }}
8989
# `test_unpickle_module_race` writes to the source directory, which is

.github/workflows/reusable-wasi.yml

+4-2
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,16 @@ jobs:
5353
uses: actions/setup-python@v5
5454
with:
5555
python-version: '3.x'
56+
- name: "Runner image version"
57+
run: echo "IMAGE_OS_VERSION=${ImageOS}-${ImageVersion}" >> "$GITHUB_ENV"
5658
- name: "Restore Python build config.cache"
5759
uses: actions/cache@v4
5860
with:
5961
path: ${{ env.CROSS_BUILD_PYTHON }}/config.cache
6062
# Include env.pythonLocation in key to avoid changes in environment when setup-python updates Python.
6163
# Include the hash of `Tools/wasm/wasi.py` as it may change the environment variables.
6264
# (Make sure to keep the key in sync with the other config.cache step below.)
63-
key: ${{ github.job }}-${{ runner.os }}-${{ env.IMAGE_VERSION }}-${{ env.WASI_SDK_VERSION }}-${{ env.WASMTIME_VERSION }}-${{ inputs.config_hash }}-${{ hashFiles('Tools/wasm/wasi.py') }}-${{ env.pythonLocation }}
65+
key: ${{ github.job }}-${{ env.IMAGE_OS_VERSION }}-${{ env.WASI_SDK_VERSION }}-${{ env.WASMTIME_VERSION }}-${{ inputs.config_hash }}-${{ hashFiles('Tools/wasm/wasi.py') }}-${{ env.pythonLocation }}
6466
- name: "Configure build Python"
6567
run: python3 Tools/wasm/wasi.py configure-build-python -- --config-cache --with-pydebug
6668
- name: "Make build Python"
@@ -70,7 +72,7 @@ jobs:
7072
with:
7173
path: ${{ env.CROSS_BUILD_WASI }}/config.cache
7274
# Should be kept in sync with the other config.cache step above.
73-
key: ${{ github.job }}-${{ runner.os }}-${{ env.IMAGE_VERSION }}-${{ env.WASI_SDK_VERSION }}-${{ env.WASMTIME_VERSION }}-${{ inputs.config_hash }}-${{ hashFiles('Tools/wasm/wasi.py') }}-${{ env.pythonLocation }}
75+
key: ${{ github.job }}-${{ env.IMAGE_OS_VERSION }}-${{ env.WASI_SDK_VERSION }}-${{ env.WASMTIME_VERSION }}-${{ inputs.config_hash }}-${{ hashFiles('Tools/wasm/wasi.py') }}-${{ env.pythonLocation }}
7476
- name: "Configure host"
7577
# `--with-pydebug` inferred from configure-build-python
7678
run: python3 Tools/wasm/wasi.py configure-host -- --config-cache

0 commit comments

Comments
 (0)