From a0d10472bae15d8819ba09112e30c19329afb943 Mon Sep 17 00:00:00 2001 From: Michael Tautschnig Date: Thu, 11 Mar 2021 20:08:33 +0000 Subject: [PATCH] Use ccache in codecov-coverage-report GitHub action The GitHub action takes by far the longest, and while the execution time likely is dominated by test execution we should not unnecessarily waste time for compiling. Building previously took more than 20 minutes, and now takes around 3 minutes instead. The ccache size has to be set to at least 2 GB to avoid cache entries being removed during build, but the packed archive of cache results is below 500 MB, which should be safe as far as our use of the 5 GB of total cache storage is concerned. --- .github/workflows/pull-request-checks.yaml | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pull-request-checks.yaml b/.github/workflows/pull-request-checks.yaml index 72e7e1b496f..2f6f2194f73 100644 --- a/.github/workflows/pull-request-checks.yaml +++ b/.github/workflows/pull-request-checks.yaml @@ -513,10 +513,28 @@ jobs: DEBIAN_FRONTEND: noninteractive run: | sudo apt-get update - sudo apt-get install --no-install-recommends -y g++ gcc binutils flex bison cmake maven jq libxml2-utils openjdk-11-jdk-headless lcov + sudo apt-get install --no-install-recommends -y g++ gcc binutils flex bison cmake maven jq libxml2-utils openjdk-11-jdk-headless lcov ccache + - name: Prepare ccache + uses: actions/cache@v2 + with: + path: .ccache + key: ${{ runner.os }}-20.04-Coverage-${{ github.ref }}-${{ github.sha }}-PR + restore-keys: | + ${{ runner.os }}-20.04-Coverage-${{ github.ref }} + ${{ runner.os }}-20.04-Coverage + - name: ccache environment + run: | + echo "CCACHE_BASEDIR=$PWD" >> $GITHUB_ENV + echo "CCACHE_DIR=$PWD/.ccache" >> $GITHUB_ENV - name: Configure CMake CBMC build with coverage instrumentation parameters run: cmake -S . -Bbuild -Denable_coverage=1 -Dparallel_tests=2 -DCMAKE_CXX_COMPILER=/usr/bin/g++ + - name: Zero ccache stats and limit in size + run: ccache -z --max-size=4G - name: Execute CMake CBMC build + run: cmake --build build -- -j2 + - name: Print ccache stats + run: ccache -s + - name: Run CTest run: cmake --build build --target coverage -- -j2 - name: Collect coverage statistics run: |