[Python-checkins] [3.11] CI: Cache config.cache across runs to speed up build (GH-104800) (#104968)

hugovk webhook-mailer at python.org
Fri May 26 12:09:16 EDT 2023


https://github.com/python/cpython/commit/4af56ec957d9dad599c429c8ffc179cdc3cb5cd5
commit: 4af56ec957d9dad599c429c8ffc179cdc3cb5cd5
branch: 3.11
author: Hugo van Kemenade <hugovk at users.noreply.github.com>
committer: hugovk <hugovk at users.noreply.github.com>
date: 2023-05-26T16:09:09Z
summary:

[3.11] CI: Cache config.cache across runs to speed up build (GH-104800) (#104968)

Co-authored-by: Hugo van Kemenade <hugovk at users.noreply.github.com>

files:
M .github/workflows/build.yml

diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 93dcb3f5f414..9c0ad2361302 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -102,6 +102,11 @@ jobs:
     if: needs.check_source.outputs.run_tests == 'true'
     steps:
       - uses: actions/checkout at v3
+      - name: Restore config.cache
+        uses: actions/cache at v3
+        with:
+          path: config.cache
+          key: ${{ github.job }}-${{ runner.os }}-${{ hashFiles('configure', 'configure.ac', '.github/workflows/build.yml') }}
       - uses: actions/setup-python at v3
       - name: Install Dependencies
         run: sudo ./.github/workflows/posix-deps-apt.sh
@@ -118,7 +123,7 @@ jobs:
       - name: Configure CPython
         run: |
           # Build Python with the libpython dynamic library
-          ./configure --with-pydebug --enable-shared
+          ./configure --config-cache --with-pydebug --enable-shared
       - name: Regenerate autoconf files with container image
         run: make regen-configure
       - name: Build CPython
@@ -196,6 +201,11 @@ jobs:
       PYTHONSTRICTEXTENSIONBUILD: 1
     steps:
     - uses: actions/checkout at v3
+    - name: Restore config.cache
+      uses: actions/cache at v3
+      with:
+        path: config.cache
+        key: ${{ github.job }}-${{ runner.os }}-${{ hashFiles('configure', 'configure.ac', '.github/workflows/build.yml') }}
     - name: Install Homebrew dependencies
       run: brew install pkg-config openssl at 1.1 xz gdbm tcl-tk
     - name: Configure CPython
@@ -204,6 +214,7 @@ jobs:
         LDFLAGS="-L$(brew --prefix gdbm)/lib -I$(brew --prefix xz)/lib" \
         PKG_CONFIG_PATH="$(brew --prefix tcl-tk)/lib/pkgconfig" \
         ./configure \
+          --config-cache \
           --with-pydebug \
           --prefix=/opt/python-dev \
           --with-openssl="$(brew --prefix openssl at 1.1)"
@@ -256,9 +267,18 @@ jobs:
       run: mkdir -p $CPYTHON_RO_SRCDIR $CPYTHON_BUILDDIR
     - name: Bind mount sources read-only
       run: sudo mount --bind -o ro $GITHUB_WORKSPACE $CPYTHON_RO_SRCDIR
+    - name: Restore config.cache
+      uses: actions/cache at v3
+      with:
+        path: ${{ env.CPYTHON_BUILDDIR }}/config.cache
+        key: ${{ github.job }}-${{ runner.os }}-${{ hashFiles('configure', 'configure.ac', '.github/workflows/build.yml') }}
     - name: Configure CPython out-of-tree
       working-directory: ${{ env.CPYTHON_BUILDDIR }}
-      run: ../cpython-ro-srcdir/configure --with-pydebug --with-openssl=$OPENSSL_DIR
+      run: |
+        ../cpython-ro-srcdir/configure \
+          --config-cache \
+          --with-pydebug \
+          --with-openssl=$OPENSSL_DIR
     - name: Build CPython out-of-tree
       working-directory: ${{ env.CPYTHON_BUILDDIR }}
       run: make -j4
@@ -289,6 +309,11 @@ jobs:
       LD_LIBRARY_PATH: ${{ github.workspace }}/multissl/openssl/${{ matrix.openssl_ver }}/lib
     steps:
     - uses: actions/checkout at v3
+    - name: Restore config.cache
+      uses: actions/cache at v3
+      with:
+        path: config.cache
+        key: ${{ github.job }}-${{ runner.os }}-${{ hashFiles('configure', 'configure.ac', '.github/workflows/build.yml') }}
     - name: Register gcc problem matcher
       run: echo "::add-matcher::.github/problem-matchers/gcc.json"
     - name: Install Dependencies
@@ -313,7 +338,7 @@ jobs:
     - name: Configure ccache action
       uses: hendrikmuhs/ccache-action at v1.2
     - name: Configure CPython
-      run: ./configure --with-pydebug --with-openssl=$OPENSSL_DIR
+      run: ./configure --config-cache --with-pydebug --with-openssl=$OPENSSL_DIR
     - name: Build CPython
       run: make -j4
     - name: Display build info
@@ -321,7 +346,6 @@ jobs:
     - name: SSL tests
       run: ./python Lib/test/ssltests.py
 
-
   build_asan:
     name: 'Address sanitizer'
     runs-on: ubuntu-20.04
@@ -334,6 +358,11 @@ jobs:
       ASAN_OPTIONS: detect_leaks=0:allocator_may_return_null=1:handle_segv=0
     steps:
     - uses: actions/checkout at v3
+    - name: Restore config.cache
+      uses: actions/cache at v3
+      with:
+        path: config.cache
+        key: ${{ github.job }}-${{ runner.os }}-${{ hashFiles('configure', 'configure.ac', '.github/workflows/build.yml') }}
     - name: Register gcc problem matcher
       run: echo "::add-matcher::.github/problem-matchers/gcc.json"
     - name: Install Dependencies
@@ -362,7 +391,7 @@ jobs:
     - name: Configure ccache action
       uses: hendrikmuhs/ccache-action at v1.2
     - name: Configure CPython
-      run: ./configure --with-address-sanitizer --without-pymalloc
+      run: ./configure --config-cache --with-address-sanitizer --without-pymalloc
     - name: Build CPython
       run: make -j4
     - name: Display build info



More information about the Python-checkins mailing list