Skip to content

Commit 4af56ec

Browse files
authored
[3.11] CI: Cache config.cache across runs to speed up build (GH-104800) (#104968)
Co-authored-by: Hugo van Kemenade <[email protected]>
1 parent ca55247 commit 4af56ec

File tree

1 file changed

+34
-5
lines changed

1 file changed

+34
-5
lines changed

.github/workflows/build.yml

Lines changed: 34 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,11 @@ jobs:
102102
if: needs.check_source.outputs.run_tests == 'true'
103103
steps:
104104
- uses: actions/checkout@v3
105+
- name: Restore config.cache
106+
uses: actions/cache@v3
107+
with:
108+
path: config.cache
109+
key: ${{ github.job }}-${{ runner.os }}-${{ hashFiles('configure', 'configure.ac', '.github/workflows/build.yml') }}
105110
- uses: actions/setup-python@v3
106111
- name: Install Dependencies
107112
run: sudo ./.github/workflows/posix-deps-apt.sh
@@ -118,7 +123,7 @@ jobs:
118123
- name: Configure CPython
119124
run: |
120125
# Build Python with the libpython dynamic library
121-
./configure --with-pydebug --enable-shared
126+
./configure --config-cache --with-pydebug --enable-shared
122127
- name: Regenerate autoconf files with container image
123128
run: make regen-configure
124129
- name: Build CPython
@@ -196,6 +201,11 @@ jobs:
196201
PYTHONSTRICTEXTENSIONBUILD: 1
197202
steps:
198203
- uses: actions/checkout@v3
204+
- name: Restore config.cache
205+
uses: actions/cache@v3
206+
with:
207+
path: config.cache
208+
key: ${{ github.job }}-${{ runner.os }}-${{ hashFiles('configure', 'configure.ac', '.github/workflows/build.yml') }}
199209
- name: Install Homebrew dependencies
200210
run: brew install pkg-config [email protected] xz gdbm tcl-tk
201211
- name: Configure CPython
@@ -204,6 +214,7 @@ jobs:
204214
LDFLAGS="-L$(brew --prefix gdbm)/lib -I$(brew --prefix xz)/lib" \
205215
PKG_CONFIG_PATH="$(brew --prefix tcl-tk)/lib/pkgconfig" \
206216
./configure \
217+
--config-cache \
207218
--with-pydebug \
208219
--prefix=/opt/python-dev \
209220
--with-openssl="$(brew --prefix [email protected])"
@@ -256,9 +267,18 @@ jobs:
256267
run: mkdir -p $CPYTHON_RO_SRCDIR $CPYTHON_BUILDDIR
257268
- name: Bind mount sources read-only
258269
run: sudo mount --bind -o ro $GITHUB_WORKSPACE $CPYTHON_RO_SRCDIR
270+
- name: Restore config.cache
271+
uses: actions/cache@v3
272+
with:
273+
path: ${{ env.CPYTHON_BUILDDIR }}/config.cache
274+
key: ${{ github.job }}-${{ runner.os }}-${{ hashFiles('configure', 'configure.ac', '.github/workflows/build.yml') }}
259275
- name: Configure CPython out-of-tree
260276
working-directory: ${{ env.CPYTHON_BUILDDIR }}
261-
run: ../cpython-ro-srcdir/configure --with-pydebug --with-openssl=$OPENSSL_DIR
277+
run: |
278+
../cpython-ro-srcdir/configure \
279+
--config-cache \
280+
--with-pydebug \
281+
--with-openssl=$OPENSSL_DIR
262282
- name: Build CPython out-of-tree
263283
working-directory: ${{ env.CPYTHON_BUILDDIR }}
264284
run: make -j4
@@ -289,6 +309,11 @@ jobs:
289309
LD_LIBRARY_PATH: ${{ github.workspace }}/multissl/openssl/${{ matrix.openssl_ver }}/lib
290310
steps:
291311
- uses: actions/checkout@v3
312+
- name: Restore config.cache
313+
uses: actions/cache@v3
314+
with:
315+
path: config.cache
316+
key: ${{ github.job }}-${{ runner.os }}-${{ hashFiles('configure', 'configure.ac', '.github/workflows/build.yml') }}
292317
- name: Register gcc problem matcher
293318
run: echo "::add-matcher::.github/problem-matchers/gcc.json"
294319
- name: Install Dependencies
@@ -313,15 +338,14 @@ jobs:
313338
- name: Configure ccache action
314339
uses: hendrikmuhs/[email protected]
315340
- name: Configure CPython
316-
run: ./configure --with-pydebug --with-openssl=$OPENSSL_DIR
341+
run: ./configure --config-cache --with-pydebug --with-openssl=$OPENSSL_DIR
317342
- name: Build CPython
318343
run: make -j4
319344
- name: Display build info
320345
run: make pythoninfo
321346
- name: SSL tests
322347
run: ./python Lib/test/ssltests.py
323348

324-
325349
build_asan:
326350
name: 'Address sanitizer'
327351
runs-on: ubuntu-20.04
@@ -334,6 +358,11 @@ jobs:
334358
ASAN_OPTIONS: detect_leaks=0:allocator_may_return_null=1:handle_segv=0
335359
steps:
336360
- uses: actions/checkout@v3
361+
- name: Restore config.cache
362+
uses: actions/cache@v3
363+
with:
364+
path: config.cache
365+
key: ${{ github.job }}-${{ runner.os }}-${{ hashFiles('configure', 'configure.ac', '.github/workflows/build.yml') }}
337366
- name: Register gcc problem matcher
338367
run: echo "::add-matcher::.github/problem-matchers/gcc.json"
339368
- name: Install Dependencies
@@ -362,7 +391,7 @@ jobs:
362391
- name: Configure ccache action
363392
uses: hendrikmuhs/[email protected]
364393
- name: Configure CPython
365-
run: ./configure --with-address-sanitizer --without-pymalloc
394+
run: ./configure --config-cache --with-address-sanitizer --without-pymalloc
366395
- name: Build CPython
367396
run: make -j4
368397
- name: Display build info

0 commit comments

Comments
 (0)