Skip to content

Commit 949f0f5

Browse files
authored
CI: Precompute hash for config cache key in check_source job (#105008)
1 parent 7df861c commit 949f0f5

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_generated_files:
7984
name: 'Check if generated files are up to date'
@@ -87,7 +92,7 @@ jobs:
8792
uses: actions/cache@v3
8893
with:
8994
path: config.cache
90-
key: ${{ github.job }}-${{ runner.os }}-${{ hashFiles('configure', 'configure.ac', '.github/workflows/build.yml') }}
95+
key: ${{ github.job }}-${{ runner.os }}-${{ needs.check_source.outputs.config_hash }}
9196
- uses: actions/setup-python@v3
9297
- name: Install Dependencies
9398
run: sudo ./.github/workflows/posix-deps-apt.sh
@@ -189,7 +194,7 @@ jobs:
189194
uses: actions/cache@v3
190195
with:
191196
path: config.cache
192-
key: ${{ github.job }}-${{ runner.os }}-${{ hashFiles('configure', 'configure.ac', '.github/workflows/build.yml') }}
197+
key: ${{ github.job }}-${{ runner.os }}-${{ needs.check_source.outputs.config_hash }}
193198
- name: Install Homebrew dependencies
194199
run: brew install pkg-config [email protected] xz gdbm tcl-tk
195200
- name: Configure CPython
@@ -255,7 +260,7 @@ jobs:
255260
uses: actions/cache@v3
256261
with:
257262
path: ${{ env.CPYTHON_BUILDDIR }}/config.cache
258-
key: ${{ github.job }}-${{ runner.os }}-${{ hashFiles('configure', 'configure.ac', '.github/workflows/build.yml') }}
263+
key: ${{ github.job }}-${{ runner.os }}-${{ needs.check_source.outputs.config_hash }}
259264
- name: Configure CPython out-of-tree
260265
working-directory: ${{ env.CPYTHON_BUILDDIR }}
261266
run: |
@@ -297,7 +302,7 @@ jobs:
297302
uses: actions/cache@v3
298303
with:
299304
path: config.cache
300-
key: ${{ github.job }}-${{ runner.os }}-${{ hashFiles('configure', 'configure.ac', '.github/workflows/build.yml') }}
305+
key: ${{ github.job }}-${{ runner.os }}-${{ needs.check_source.outputs.config_hash }}
301306
- name: Register gcc problem matcher
302307
run: echo "::add-matcher::.github/problem-matchers/gcc.json"
303308
- name: Install Dependencies
@@ -376,7 +381,7 @@ jobs:
376381
uses: actions/cache@v3
377382
with:
378383
path: ${{ env.CPYTHON_BUILDDIR }}/config.cache
379-
key: ${{ github.job }}-${{ runner.os }}-${{ hashFiles('configure', 'configure.ac', '.github/workflows/build.yml') }}
384+
key: ${{ github.job }}-${{ runner.os }}-${{ needs.check_source.outputs.config_hash }}
380385
- name: Configure CPython out-of-tree
381386
working-directory: ${{ env.CPYTHON_BUILDDIR }}
382387
run: |
@@ -455,7 +460,7 @@ jobs:
455460
uses: actions/cache@v3
456461
with:
457462
path: config.cache
458-
key: ${{ github.job }}-${{ runner.os }}-${{ hashFiles('configure', 'configure.ac', '.github/workflows/build.yml') }}
463+
key: ${{ github.job }}-${{ runner.os }}-${{ needs.check_source.outputs.config_hash }}
459464
- name: Register gcc problem matcher
460465
run: echo "::add-matcher::.github/problem-matchers/gcc.json"
461466
- name: Install Dependencies

0 commit comments

Comments
 (0)