From 627cca6dc8d0edb74ba3b42b1dcf45b170ddd1f1 Mon Sep 17 00:00:00 2001 From: Francesco Chemolli <5175948+kinkie@users.noreply.github.com> Date: Tue, 5 Nov 2024 22:21:26 +0000 Subject: [PATCH] CI: Add ccache to GitHub Actions build tests (#1935) 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 Do not add ccache to MacOS build tests because I had mixed experience with that optimization on that OS. --- .github/workflows/quick.yaml | 12 +++++++++--- .github/workflows/slow.yaml | 10 ++++++++-- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/.github/workflows/quick.yaml b/.github/workflows/quick.yaml index 05f91dbbde..6a9766ad96 100644 --- a/.github/workflows/quick.yaml +++ b/.github/workflows/quick.yaml @@ -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 }} diff --git a/.github/workflows/slow.yaml b/.github/workflows/slow.yaml index f33f45d501..2594c6abd7 100644 --- a/.github/workflows/slow.yaml +++ b/.github/workflows/slow.yaml @@ -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: | -- 2.47.2