Skip to content

Commit a0d1047

Browse files
committed
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.
1 parent 51c59e9 commit a0d1047

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

.github/workflows/pull-request-checks.yaml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -513,10 +513,28 @@ jobs:
513513
DEBIAN_FRONTEND: noninteractive
514514
run: |
515515
sudo apt-get update
516-
sudo apt-get install --no-install-recommends -y g++ gcc binutils flex bison cmake maven jq libxml2-utils openjdk-11-jdk-headless lcov
516+
sudo apt-get install --no-install-recommends -y g++ gcc binutils flex bison cmake maven jq libxml2-utils openjdk-11-jdk-headless lcov ccache
517+
- name: Prepare ccache
518+
uses: actions/cache@v2
519+
with:
520+
path: .ccache
521+
key: ${{ runner.os }}-20.04-Coverage-${{ github.ref }}-${{ github.sha }}-PR
522+
restore-keys: |
523+
${{ runner.os }}-20.04-Coverage-${{ github.ref }}
524+
${{ runner.os }}-20.04-Coverage
525+
- name: ccache environment
526+
run: |
527+
echo "CCACHE_BASEDIR=$PWD" >> $GITHUB_ENV
528+
echo "CCACHE_DIR=$PWD/.ccache" >> $GITHUB_ENV
517529
- name: Configure CMake CBMC build with coverage instrumentation parameters
518530
run: cmake -S . -Bbuild -Denable_coverage=1 -Dparallel_tests=2 -DCMAKE_CXX_COMPILER=/usr/bin/g++
531+
- name: Zero ccache stats and limit in size
532+
run: ccache -z --max-size=4G
519533
- name: Execute CMake CBMC build
534+
run: cmake --build build -- -j2
535+
- name: Print ccache stats
536+
run: ccache -s
537+
- name: Run CTest
520538
run: cmake --build build --target coverage -- -j2
521539
- name: Collect coverage statistics
522540
run: |

0 commit comments

Comments
 (0)