Skip to content

Commit 97509ca

Browse files
authored
[3.12] CI: Cache config.cache across runs to speed up build (GH-104800) (#104967)
1 parent 8ca2957 commit 97509ca

File tree

1 file changed

+45
-6
lines changed

1 file changed

+45
-6
lines changed

.github/workflows/build.yml

+45-6
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,11 @@ jobs:
113113
if: needs.check_source.outputs.run_tests == 'true'
114114
steps:
115115
- uses: actions/checkout@v3
116+
- name: Restore config.cache
117+
uses: actions/cache@v3
118+
with:
119+
path: config.cache
120+
key: ${{ github.job }}-${{ runner.os }}-${{ hashFiles('configure', 'configure.ac', '.github/workflows/build.yml') }}
116121
- uses: actions/setup-python@v3
117122
- name: Install Dependencies
118123
run: sudo ./.github/workflows/posix-deps-apt.sh
@@ -129,7 +134,7 @@ jobs:
129134
- name: Configure CPython
130135
run: |
131136
# Build Python with the libpython dynamic library
132-
./configure --with-pydebug --enable-shared
137+
./configure --config-cache --with-pydebug --enable-shared
133138
- name: Regenerate autoconf files with container image
134139
run: make regen-configure
135140
- name: Build CPython
@@ -210,6 +215,11 @@ jobs:
210215
PYTHONSTRICTEXTENSIONBUILD: 1
211216
steps:
212217
- uses: actions/checkout@v3
218+
- name: Restore config.cache
219+
uses: actions/cache@v3
220+
with:
221+
path: config.cache
222+
key: ${{ github.job }}-${{ runner.os }}-${{ hashFiles('configure', 'configure.ac', '.github/workflows/build.yml') }}
213223
- name: Install Homebrew dependencies
214224
run: brew install pkg-config [email protected] xz gdbm tcl-tk
215225
- name: Configure CPython
@@ -218,6 +228,7 @@ jobs:
218228
LDFLAGS="-L$(brew --prefix gdbm)/lib -I$(brew --prefix xz)/lib" \
219229
PKG_CONFIG_PATH="$(brew --prefix tcl-tk)/lib/pkgconfig" \
220230
./configure \
231+
--config-cache \
221232
--with-pydebug \
222233
--prefix=/opt/python-dev \
223234
--with-openssl="$(brew --prefix [email protected])"
@@ -270,9 +281,18 @@ jobs:
270281
run: mkdir -p $CPYTHON_RO_SRCDIR $CPYTHON_BUILDDIR
271282
- name: Bind mount sources read-only
272283
run: sudo mount --bind -o ro $GITHUB_WORKSPACE $CPYTHON_RO_SRCDIR
284+
- name: Restore config.cache
285+
uses: actions/cache@v3
286+
with:
287+
path: ${{ env.CPYTHON_BUILDDIR }}/config.cache
288+
key: ${{ github.job }}-${{ runner.os }}-${{ hashFiles('configure', 'configure.ac', '.github/workflows/build.yml') }}
273289
- name: Configure CPython out-of-tree
274290
working-directory: ${{ env.CPYTHON_BUILDDIR }}
275-
run: ../cpython-ro-srcdir/configure --with-pydebug --with-openssl=$OPENSSL_DIR
291+
run: |
292+
../cpython-ro-srcdir/configure \
293+
--config-cache \
294+
--with-pydebug \
295+
--with-openssl=$OPENSSL_DIR
276296
- name: Build CPython out-of-tree
277297
working-directory: ${{ env.CPYTHON_BUILDDIR }}
278298
run: make -j4
@@ -303,6 +323,11 @@ jobs:
303323
LD_LIBRARY_PATH: ${{ github.workspace }}/multissl/openssl/${{ matrix.openssl_ver }}/lib
304324
steps:
305325
- uses: actions/checkout@v3
326+
- name: Restore config.cache
327+
uses: actions/cache@v3
328+
with:
329+
path: config.cache
330+
key: ${{ github.job }}-${{ runner.os }}-${{ hashFiles('configure', 'configure.ac', '.github/workflows/build.yml') }}
306331
- name: Register gcc problem matcher
307332
run: echo "::add-matcher::.github/problem-matchers/gcc.json"
308333
- name: Install Dependencies
@@ -327,7 +352,7 @@ jobs:
327352
- name: Configure ccache action
328353
uses: hendrikmuhs/[email protected]
329354
- name: Configure CPython
330-
run: ./configure --with-pydebug --with-openssl=$OPENSSL_DIR
355+
run: ./configure --config-cache --with-pydebug --with-openssl=$OPENSSL_DIR
331356
- name: Build CPython
332357
run: make -j4
333358
- name: Display build info
@@ -336,7 +361,7 @@ jobs:
336361
run: ./python Lib/test/ssltests.py
337362

338363
test_hypothesis:
339-
name: "Hypothesis Tests on Ubuntu"
364+
name: "Hypothesis tests on Ubuntu"
340365
runs-on: ubuntu-20.04
341366
timeout-minutes: 60
342367
needs: check_source
@@ -377,9 +402,18 @@ jobs:
377402
run: mkdir -p $CPYTHON_RO_SRCDIR $CPYTHON_BUILDDIR
378403
- name: Bind mount sources read-only
379404
run: sudo mount --bind -o ro $GITHUB_WORKSPACE $CPYTHON_RO_SRCDIR
405+
- name: Restore config.cache
406+
uses: actions/cache@v3
407+
with:
408+
path: ${{ env.CPYTHON_BUILDDIR }}/config.cache
409+
key: ${{ github.job }}-${{ runner.os }}-${{ hashFiles('configure', 'configure.ac', '.github/workflows/build.yml') }}
380410
- name: Configure CPython out-of-tree
381411
working-directory: ${{ env.CPYTHON_BUILDDIR }}
382-
run: ../cpython-ro-srcdir/configure --with-pydebug --with-openssl=$OPENSSL_DIR
412+
run: |
413+
../cpython-ro-srcdir/configure \
414+
--config-cache \
415+
--with-pydebug \
416+
--with-openssl=$OPENSSL_DIR
383417
- name: Build CPython out-of-tree
384418
working-directory: ${{ env.CPYTHON_BUILDDIR }}
385419
run: make -j4
@@ -447,6 +481,11 @@ jobs:
447481
ASAN_OPTIONS: detect_leaks=0:allocator_may_return_null=1:handle_segv=0
448482
steps:
449483
- uses: actions/checkout@v3
484+
- name: Restore config.cache
485+
uses: actions/cache@v3
486+
with:
487+
path: config.cache
488+
key: ${{ github.job }}-${{ runner.os }}-${{ hashFiles('configure', 'configure.ac', '.github/workflows/build.yml') }}
450489
- name: Register gcc problem matcher
451490
run: echo "::add-matcher::.github/problem-matchers/gcc.json"
452491
- name: Install Dependencies
@@ -475,7 +514,7 @@ jobs:
475514
- name: Configure ccache action
476515
uses: hendrikmuhs/[email protected]
477516
- name: Configure CPython
478-
run: ./configure --with-address-sanitizer --without-pymalloc
517+
run: ./configure --config-cache --with-address-sanitizer --without-pymalloc
479518
- name: Build CPython
480519
run: make -j4
481520
- name: Display build info

0 commit comments

Comments
 (0)