From a4b7d57c79160ef24002274a86479a5b1e08fbe6 Mon Sep 17 00:00:00 2001 From: Tobias Brunner Date: Mon, 11 May 2026 11:27:44 +0200 Subject: [PATCH] github: Only store a cache for large custom-built crypto libs The others are either included already in the "all" build (to which we now switch) or they have a relatively small diff to that (e.g. gcrypt only differs in that relatively small plugin). For the "openssl-sys" build, we can rely on the "default" build but only on ubuntu-latest as we don't build that on ubuntu-22.04. --- .github/workflows/linux.yml | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 6a112a72a..f92283410 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -146,19 +146,25 @@ jobs: CC: ${{ matrix.compiler || 'gcc' }} TEST: ${{ matrix.test }} ACTIVE_TRANSFORMS_REF: .github/active-transforms/${{ matrix.test }} + # only store a cache for some tests as the others have a minimal diff (if + # any) compared to the 'all' build STORE_CACHE: >- ${{ github.event_name == 'push' && + contains(fromJSON('["openssl-4", "openssl-awslc"]'), matrix.test) && (!matrix.leak-detective || matrix.leak-detective == 'no') }} + CACHE_KEY: >- + ${{ case(contains(fromJSON('["openssl-4", "openssl-awslc"]'), matrix.test), + format('ccache-{0}-gcc-{1}', matrix.os, matrix.test), + matrix.os == 'ubuntu-latest' && matrix.test == 'openssl-sys', + format('ccache-{0}-gcc-default', matrix.os), + format('ccache-{0}-gcc-all', matrix.os)) }} steps: - uses: actions/checkout@v6 - uses: actions/cache/restore@v5 id: cache-restore with: - # path is different on newer systems - path: | - ~/.cache/ccache - ~/.ccache - key: ccache-${{ matrix.os }}-${{ env.CC }}-${{ matrix.test }} + path: ~/.cache/ccache + key: ${{ env.CACHE_KEY }} - run: | sudo apt-get install -qq ccache echo "PATH=/usr/lib/ccache:$PATH" >> $GITHUB_ENV @@ -184,9 +190,7 @@ jobs: - if: fromJSON(env.STORE_CACHE) uses: actions/cache/save@v5 with: - path: | - ~/.cache/ccache - ~/.ccache + path: ~/.cache/ccache key: ${{ steps.cache-restore.outputs.cache-primary-key }} - if: ${{ failure() }} uses: actions/upload-artifact@v6 @@ -216,10 +220,7 @@ jobs: - uses: actions/cache/restore@v5 id: cache-restore with: - # path is different on newer systems - path: | - ~/.cache/ccache - ~/.ccache + path: ~/.cache/ccache key: ccache-${{ matrix.os }}-${{ env.CC }}-${{ matrix.test }} - run: | sudo apt-get install -qq ccache @@ -236,9 +237,7 @@ jobs: - if: github.event_name == 'push' uses: actions/cache/save@v5 with: - path: | - ~/.cache/ccache - ~/.ccache + path: ~/.cache/ccache key: ${{ steps.cache-restore.outputs.cache-primary-key }} - if: ${{ failure() }} uses: actions/upload-artifact@v6