Skip to content

Commit 5cd6a26

Browse files
committed
Move coverage CI spec to separate file
pull-request-checks.yaml has become too large to manage. Also prepares improvements to the coverage job.
1 parent 98f6e71 commit 5cd6a26

File tree

2 files changed

+74
-63
lines changed

2 files changed

+74
-63
lines changed

.github/workflows/coverage.yaml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: Codecov coverage report
2+
on:
3+
push:
4+
branches: [ develop ]
5+
pull_request:
6+
branches: [ develop ]
7+
env:
8+
cvc5-version: "1.0.0"
9+
linux-vcpus: 4
10+
windows-vcpus: 4
11+
12+
jobs:
13+
# This job takes approximately 40 to 75 minutes
14+
Linux:
15+
runs-on: ubuntu-20.04
16+
steps:
17+
- name: Clone repository
18+
uses: actions/checkout@v4
19+
with:
20+
submodules: recursive
21+
- name: Remove unnecessary software to free up disk space
22+
run: |
23+
# inspired by https://github.com/easimon/maximize-build-space/blob/master/action.yml
24+
df -h
25+
sudo rm -rf /usr/share/dotnet /usr/local/lib/* /opt/*
26+
df -h
27+
- name: Download testing and coverage dependencies
28+
env:
29+
# This is needed in addition to -yq to prevent apt-get from asking for
30+
# user input
31+
DEBIAN_FRONTEND: noninteractive
32+
run: |
33+
sudo apt-get update
34+
sudo apt-get install --no-install-recommends -y g++ gcc gdb binutils flex bison cmake maven jq libxml2-utils openjdk-11-jdk-headless lcov ccache z3
35+
- name: Confirm z3 solver is available and log the version installed
36+
run: z3 --version
37+
- name: Download cvc-5 from the releases page and make sure it can be deployed
38+
run: |
39+
wget -O cvc5 https://github.com/cvc5/cvc5/releases/download/cvc5-${{env.cvc5-version}}/cvc5-Linux
40+
chmod u+x cvc5
41+
mv cvc5 /usr/local/bin
42+
cvc5 --version
43+
- name: Prepare ccache
44+
uses: actions/cache@v4
45+
with:
46+
save-always: true
47+
path: .ccache
48+
key: ${{ runner.os }}-20.04-Coverage-${{ github.ref }}-${{ github.sha }}-PR
49+
restore-keys: |
50+
${{ runner.os }}-20.04-Coverage-${{ github.ref }}
51+
${{ runner.os }}-20.04-Coverage
52+
- name: ccache environment
53+
run: |
54+
echo "CCACHE_BASEDIR=$PWD" >> $GITHUB_ENV
55+
echo "CCACHE_DIR=$PWD/.ccache" >> $GITHUB_ENV
56+
- name: Configure CMake CBMC build with coverage instrumentation parameters
57+
run: cmake -S . -Bbuild -Denable_coverage=1 -Dparallel_tests=2 -DCMAKE_CXX_COMPILER=/usr/bin/g++
58+
- name: Zero ccache stats and limit in size
59+
run: ccache -z --max-size=7G
60+
- name: Execute CMake CBMC build
61+
run: cmake --build build -- -j${{env.linux-vcpus}}
62+
- name: Print ccache stats
63+
run: ccache -s
64+
- name: Run CTest and collect coverage statistics
65+
run: |
66+
echo "lcov_excl_line = UNREACHABLE" > ~/.lcovrc
67+
cmake --build build --target coverage -- -j${{env.linux-vcpus}}
68+
- name: Upload coverage statistics to Codecov
69+
uses: codecov/codecov-action@v4
70+
with:
71+
token: ${{ secrets.CODECOV_TOKEN }}
72+
files: build/html/coverage.info
73+
fail_ci_if_error: true
74+
verbose: true

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

Lines changed: 0 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -916,66 +916,3 @@ jobs:
916916
echo "Unnecessary includes found. Use '// IWYU pragma: keep' to override this."
917917
exit 1
918918
fi
919-
920-
# This job takes approximately 40 to 75 minutes
921-
codecov-coverage-report:
922-
runs-on: ubuntu-20.04
923-
steps:
924-
- name: Clone repository
925-
uses: actions/checkout@v4
926-
with:
927-
submodules: recursive
928-
- name: Remove unnecessary software to free up disk space
929-
run: |
930-
# inspired by https://github.com/easimon/maximize-build-space/blob/master/action.yml
931-
df -h
932-
sudo rm -rf /usr/share/dotnet /usr/local/lib/* /opt/*
933-
df -h
934-
- name: Download testing and coverage dependencies
935-
env:
936-
# This is needed in addition to -yq to prevent apt-get from asking for
937-
# user input
938-
DEBIAN_FRONTEND: noninteractive
939-
run: |
940-
sudo apt-get update
941-
sudo apt-get install --no-install-recommends -y g++ gcc gdb binutils flex bison cmake maven jq libxml2-utils openjdk-11-jdk-headless lcov ccache z3
942-
- name: Confirm z3 solver is available and log the version installed
943-
run: z3 --version
944-
- name: Download cvc-5 from the releases page and make sure it can be deployed
945-
run: |
946-
wget -O cvc5 https://github.com/cvc5/cvc5/releases/download/cvc5-${{env.cvc5-version}}/cvc5-Linux
947-
chmod u+x cvc5
948-
mv cvc5 /usr/local/bin
949-
cvc5 --version
950-
- name: Prepare ccache
951-
uses: actions/cache@v4
952-
with:
953-
save-always: true
954-
path: .ccache
955-
key: ${{ runner.os }}-20.04-Coverage-${{ github.ref }}-${{ github.sha }}-PR
956-
restore-keys: |
957-
${{ runner.os }}-20.04-Coverage-${{ github.ref }}
958-
${{ runner.os }}-20.04-Coverage
959-
- name: ccache environment
960-
run: |
961-
echo "CCACHE_BASEDIR=$PWD" >> $GITHUB_ENV
962-
echo "CCACHE_DIR=$PWD/.ccache" >> $GITHUB_ENV
963-
- name: Configure CMake CBMC build with coverage instrumentation parameters
964-
run: cmake -S . -Bbuild -Denable_coverage=1 -Dparallel_tests=2 -DCMAKE_CXX_COMPILER=/usr/bin/g++
965-
- name: Zero ccache stats and limit in size
966-
run: ccache -z --max-size=7G
967-
- name: Execute CMake CBMC build
968-
run: cmake --build build -- -j${{env.linux-vcpus}}
969-
- name: Print ccache stats
970-
run: ccache -s
971-
- name: Run CTest and collect coverage statistics
972-
run: |
973-
echo "lcov_excl_line = UNREACHABLE" > ~/.lcovrc
974-
cmake --build build --target coverage -- -j${{env.linux-vcpus}}
975-
- name: Upload coverage statistics to Codecov
976-
uses: codecov/codecov-action@v4
977-
with:
978-
token: ${{ secrets.CODECOV_TOKEN }}
979-
files: build/html/coverage.info
980-
fail_ci_if_error: true
981-
verbose: true

0 commit comments

Comments
 (0)