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.

Change-Id: Iea72d08b223c611ee4a4443625647a1f01809b08
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 7ff1123711ea86a3be0654ac6b7648b92b337a7a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Dimitrios Apostolou 2020-09-28 16:42:51 +02:00 committed by Qt Cherry-pick Bot
parent 236302c44d
commit ab279af23c

View File

@ -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