Skip to content

Commit edd0cb8

Browse files
[3.12] CI: Precompute hash for config cache key in check_source job (GH-105008) (#105014)
Co-authored-by: Itamar Ostricher <[email protected]>
1 parent 368d177 commit edd0cb8

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

.github/workflows/build.yml

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ jobs:
3939
outputs:
4040
run_tests: ${{ steps.check.outputs.run_tests }}
4141
run_hypothesis: ${{ steps.check.outputs.run_hypothesis }}
42+
config_hash: ${{ steps.config_hash.outputs.hash }}
4243
steps:
4344
- uses: actions/checkout@v3
4445
- name: Check for source changes
@@ -74,6 +75,10 @@ jobs:
7475
echo "Run hypothesis tests"
7576
echo "run_hypothesis=true" >> $GITHUB_OUTPUT
7677
fi
78+
- name: Compute hash for config cache key
79+
id: config_hash
80+
run: |
81+
echo "hash=${{ hashFiles('configure', 'configure.ac', '.github/workflows/build.yml') }}" >> $GITHUB_OUTPUT
7782
7883
check_abi:
7984
name: 'Check if the ABI has changed'
@@ -117,7 +122,7 @@ jobs:
117122
uses: actions/cache@v3
118123
with:
119124
path: config.cache
120-
key: ${{ github.job }}-${{ runner.os }}-${{ hashFiles('configure', 'configure.ac', '.github/workflows/build.yml') }}
125+
key: ${{ github.job }}-${{ runner.os }}-${{ needs.check_source.outputs.config_hash }}
121126
- uses: actions/setup-python@v3
122127
- name: Install Dependencies
123128
run: sudo ./.github/workflows/posix-deps-apt.sh
@@ -219,7 +224,7 @@ jobs:
219224
uses: actions/cache@v3
220225
with:
221226
path: config.cache
222-
key: ${{ github.job }}-${{ runner.os }}-${{ hashFiles('configure', 'configure.ac', '.github/workflows/build.yml') }}
227+
key: ${{ github.job }}-${{ runner.os }}-${{ needs.check_source.outputs.config_hash }}
223228
- name: Install Homebrew dependencies
224229
run: brew install pkg-config [email protected] xz gdbm tcl-tk
225230
- name: Configure CPython
@@ -285,7 +290,7 @@ jobs:
285290
uses: actions/cache@v3
286291
with:
287292
path: ${{ env.CPYTHON_BUILDDIR }}/config.cache
288-
key: ${{ github.job }}-${{ runner.os }}-${{ hashFiles('configure', 'configure.ac', '.github/workflows/build.yml') }}
293+
key: ${{ github.job }}-${{ runner.os }}-${{ needs.check_source.outputs.config_hash }}
289294
- name: Configure CPython out-of-tree
290295
working-directory: ${{ env.CPYTHON_BUILDDIR }}
291296
run: |
@@ -327,7 +332,7 @@ jobs:
327332
uses: actions/cache@v3
328333
with:
329334
path: config.cache
330-
key: ${{ github.job }}-${{ runner.os }}-${{ hashFiles('configure', 'configure.ac', '.github/workflows/build.yml') }}
335+
key: ${{ github.job }}-${{ runner.os }}-${{ needs.check_source.outputs.config_hash }}
331336
- name: Register gcc problem matcher
332337
run: echo "::add-matcher::.github/problem-matchers/gcc.json"
333338
- name: Install Dependencies
@@ -406,7 +411,7 @@ jobs:
406411
uses: actions/cache@v3
407412
with:
408413
path: ${{ env.CPYTHON_BUILDDIR }}/config.cache
409-
key: ${{ github.job }}-${{ runner.os }}-${{ hashFiles('configure', 'configure.ac', '.github/workflows/build.yml') }}
414+
key: ${{ github.job }}-${{ runner.os }}-${{ needs.check_source.outputs.config_hash }}
410415
- name: Configure CPython out-of-tree
411416
working-directory: ${{ env.CPYTHON_BUILDDIR }}
412417
run: |
@@ -485,7 +490,7 @@ jobs:
485490
uses: actions/cache@v3
486491
with:
487492
path: config.cache
488-
key: ${{ github.job }}-${{ runner.os }}-${{ hashFiles('configure', 'configure.ac', '.github/workflows/build.yml') }}
493+
key: ${{ github.job }}-${{ runner.os }}-${{ needs.check_source.outputs.config_hash }}
489494
- name: Register gcc problem matcher
490495
run: echo "::add-matcher::.github/problem-matchers/gcc.json"
491496
- name: Install Dependencies

0 commit comments

Comments
 (0)