Skip to content

Commit

Permalink
CI: Add ccache to GitHub Actions build tests (#1935)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
kinkie authored and squid-anubis committed Nov 5, 2024
1 parent 884dcf4 commit 627cca6
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
12 changes: 9 additions & 3 deletions .github/workflows/quick.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand All @@ -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/[email protected]
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 }}

Expand Down
10 changes: 8 additions & 2 deletions .github/workflows/slow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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/[email protected]
with:
verbose: 2 # default 0
key: ${{ matrix.os }}-${{ matrix.compiler.CC }}-${{ matrix.layer.nick }}

- name: Run test-builds
id: test-builds
run: |
Expand Down

0 comments on commit 627cca6

Please sign in to comment.