]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
CI: Add ccache to GitHub Actions build tests (#1935)
authorFrancesco Chemolli <5175948+kinkie@users.noreply.github.com>
Tue, 5 Nov 2024 22:21:26 +0000 (22:21 +0000)
committerSquid Anubis <squid-anubis@squid-cache.org>
Tue, 5 Nov 2024 22:21:37 +0000 (22:21 +0000)
Depending on an individual build test, adding ccache currently reduces
build test time 35-60% (e.g., from 6m42s to 4m18s and from 17m to 7m).

Problematic ccache entries can be removed using GitHub API. For example:

    gh -R squid-cache/squid cache list
    gh -R squid-cache/squid cache delete <cache-key|"all">

Do not add ccache to MacOS build tests because I had mixed experience
with that optimization on that OS.

.github/workflows/quick.yaml
.github/workflows/slow.yaml

index 05f91dbbde610493d028be9a30d17badbdb49a95..6a9766ad96d8cb7f977319d4957e8b4ae207e434 100644 (file)
@@ -116,8 +116,8 @@ jobs:
     name: build-tests(${{ matrix.os }},${{ matrix.compiler.CC }},${{ matrix.layer.nick }})
 
     env:
-      CC: ${{ matrix.compiler.CC }}
-      CXX: ${{ matrix.compiler.CXX }}
+      CC: /usr/bin/ccache ${{ matrix.compiler.CC }}
+      CXX: /usr/bin/ccache ${{ matrix.compiler.CXX }}
 
     steps:
 
@@ -127,11 +127,17 @@ jobs:
           sudo sed --in-place -E 's/# (deb-src.*updates main)/  \1/g' /etc/apt/sources.list
           sudo apt-get --quiet=2 update
           sudo apt-get --quiet=2 build-dep squid
-          sudo apt-get --quiet=2 install linuxdoc-tools libtool-bin ${{ matrix.compiler.CC }}
+          sudo apt-get --quiet=2 install linuxdoc-tools libtool-bin ${{ matrix.compiler.CC }} ccache
 
       - name: Checkout sources
         uses: actions/checkout@v4
 
+      - name: Setup ccache
+        uses: squid-cache/ccache-action@v1.2.14
+        with:
+          verbose: 2 # default 0
+          key: ${{ matrix.os }}-${{ matrix.compiler.CC }}-${{ matrix.layer.nick }}
+
       - name: Run build on Linux
         run: ./test-builds.sh ${{ matrix.layer.name }}
 
index f33f45d5014bf87acfe79be36e9587e6ffa7d1be..2594c6abd7d6fad3cb5bb5c51f0ca5b96d60979a 100644 (file)
@@ -49,13 +49,19 @@ jobs:
 
     name: linux-distros(${{ matrix.os }},${{ matrix.compiler.CC }},${{ matrix.layer.nick }})
     env:
-      CC: ${{ matrix.compiler.CC }}
-      CXX: ${{ matrix.compiler.CXX }}
+      CC: /usr/bin/ccache ${{ matrix.compiler.CC }}
+      CXX: /usr/bin/ccache ${{ matrix.compiler.CXX }}
 
     steps:
       - name: Checkout Sources
         uses: actions/checkout@v4
 
+      - name: Setup ccache
+        uses: squid-cache/ccache-action@v1.2.14
+        with:
+          verbose: 2 # default 0
+          key: ${{ matrix.os }}-${{ matrix.compiler.CC }}-${{ matrix.layer.nick }}
+
       - name: Run test-builds
         id: test-builds
         run: |