Skip to content

Commit 324565d

Browse files
authored
Merge pull request #8339 from tautschnig/codecov-multiple-platforms
Refactor Codecov CI job
2 parents 8d3c22a + 7cb9ed2 commit 324565d

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

0 commit comments

Comments
 (0)