From 7ff1123711ea86a3be0654ac6b7648b92b337a7a Mon Sep 17 00:00:00 2001 From: Dimitrios Apostolou Date: Mon, 28 Sep 2020 16:42:51 +0200 Subject: Github Actions: ccache updates + Specify the ccache cache directory to avoid the defaults, because ccache >= 4.0 puts the cache directory in system-dependent paths + Adjust sloppiness to increase cache hit ratio + print compression stats but don't err if `-x` flag is missing (only available only on ccache >= 4.0) + Print ccache config for debugging purposes + Enable ccache compression and limit size Regarding the last point, ccache < v4.0 optionally compresses using the zlib algorithm, but ccache >= v4.0 uses zstd and compression is enabled by default. By forcing compression to true, all platforms will need similar size cache. We have to limit it because the default (5GB) fills up the cache artifacts size that Github Actions offers. Pick-to: 6.0 Change-Id: Iea72d08b223c611ee4a4443625647a1f01809b08 Reviewed-by: Volker Hilsheimer --- .github/workflows/ninja-build.yml | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ninja-build.yml b/.github/workflows/ninja-build.yml index 22ac8ae6ff..66c15f2860 100644 --- a/.github/workflows/ninja-build.yml +++ b/.github/workflows/ninja-build.yml @@ -64,7 +64,7 @@ jobs: id: ccache uses: actions/cache@v2 with: - path: ~/.ccache + path: ${{ runner.temp }}/ccache # "github.run_id" is unique, which causes the cache to always get # saved at the end of a successful run. key: ccache-${{ matrix.os }}-${{ github.ref }}-${{ github.run_id }} @@ -81,6 +81,12 @@ jobs: if: matrix.deps != '' - name: install compiler tools run: ${{ matrix.install_cmd }} ${{ matrix.tools }} ${{ matrix.install_cmd_postfix }} + - name: configure ccache + run: | + ccache --set-config sloppiness=file_macro,time_macros + ccache --set-config cache_dir='${{ runner.temp }}'/ccache + ccache --set-config compression=true + ccache --set-config max_size=1G - name: print versions and environment run: | gcc --version | head -1 @@ -88,6 +94,7 @@ jobs: echo Ninja `ninja --version` { ninja --help || true ; } 2>&1 | grep "run N jobs in parallel" ccache --version | head -1 + ccache --show-config || echo 'Old ccache version does not support --show-config' echo Environment: printenv @@ -105,4 +112,7 @@ jobs: - name: various stats # Print ccache utilization statistics, then reset them. - run: ccache -s && ccache -z + run: | + ccache -s + ccache -x 2>/dev/null || true + ccache -z -- cgit v1.2.3