-
Notifications
You must be signed in to change notification settings - Fork 0
131 lines (111 loc) · 5.79 KB
/
Copy pathcoverage.yml
File metadata and controls
131 lines (111 loc) · 5.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
name: Coverage
on:
workflow_dispatch:
push:
branches: [ main ]
paths: [ '**.cpp', '**.hpp*', '**.cmake', '**/CMakeLists.txt' ]
pull_request:
branches: [ main ]
paths: [ '**.cpp', '**.hpp*', '**.cmake', '**/CMakeLists.txt' ]
jobs:
main:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Install dependencies
run: |
sudo apt-get update
sudo wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
sudo add-apt-repository "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-14 main"
sudo apt-get update
sudo apt-get install ninja-build lcov googletest \
gcc-12 g++-12 libstdc++-12-dev lld-14
# llvm-14 clang-14 libc++-14-dev libc++abi-14-dev
sudo ln -sf /usr/bin/lld-14 /usr/local/bin/ld
sudo update-alternatives \
--install /usr/bin/gcc gcc /usr/bin/gcc-12 200 \
--slave /usr/bin/g++ g++ /usr/bin/g++-12 \
--slave /usr/bin/gcc-ar gcc-ar /usr/bin/gcc-ar-12 \
--slave /usr/bin/gcc-nm gcc-nm /usr/bin/gcc-nm-12 \
--slave /usr/bin/gcc-ranlib gcc-ranlib /usr/bin/gcc-ranlib-12 \
--slave /usr/bin/gcov gcov /usr/bin/gcov-12 \
--slave /usr/bin/gcov-tool gcov-tool /usr/bin/gcov-tool-12 \
--slave /usr/bin/gcov-dump gcov-dump /usr/bin/gcov-dump-12
sudo update-alternatives --auto gcc
sudo update-alternatives \
--install /usr/bin/cpp cpp /usr/bin/cpp-12 200
sudo update-alternatives --auto cpp
gcc --version; gcov --version
- name: Configure CMake
run: |
wait_type=""
compilers=(g++)
c_compilers=(gcc)
for (( i=0; i<${#compilers[*]}; i+=1 )); do
dir="build_${compilers[$i]}"
echo $dir
cmake -S . -B $dir \
-G "Ninja" \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_CXX_COMPILER="${compilers[$i]}" \
-DCMAKE_C_COMPILER="${c_compilers[$i]}" \
-DIONE_TEST=SINGLE \
-DIONE_FLAGS="COVERAGE;$wait_type" \
-DIONE_CXX_STANDARD=20 \
-DIONE_COMPILE_OPTIONS="-Og;-fno-inline"
lcov --zerocounters --directory .
if [[ "$wait_type" == "" ]]; then
wait_type="DISABLE_FUTEX"
fi
done
- name: Build
run: |
for dir in build*/; do
ninja -C $dir
done
- name: Test
run: |
for dir in build*/; do
cd $dir
ctest --output-on-failure -C Debug -V
cd ..
done
- name: Collect with lcov
run: |
echo '#!/bin/bash
exec llvm-cov-14 gcov "$@"' > ./llvm_gcov.sh
chmod +x ./llvm_gcov.sh
compilers=(g++)
c_compilers=(gcc)
for (( i=0; i<${#compilers[*]}; i+=1 )); do
dir="build_${compilers[$i]}"
echo $dir
if [[ "${compilers[i]}" == "g++" ]]; then
gcov_tool="gcov"
else
gcov_tool="`pwd`/llvm_gcov.sh"
fi
cd $dir
lcov --rc lcov_branch_coverage=1 --gcov-tool "$gcov_tool" -d . -c -o lcov.info
lcov --rc lcov_branch_coverage=1 \
-r lcov.info "/usr/*" \
-r lcov.info "*/_deps/*" \
-r lcov.info "*/test/*" \
-o lcov.info
cd ..
done
lcov --rc lcov_branch_coverage=1 \
--add-tracefile ./build_g++/lcov.info \
--output-file ./total.info
lcov --rc lcov_branch_coverage=0 -r ./total.info -o ./total_without_branch.info
lcov --rc lcov_branch_coverage=1 --list ./total.info
- name: Coveralls
uses: coverallsapp/github-action@1.1.3
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: ./total.info
- name: Codecov
uses: codecov/codecov-action@v3.1.0
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./total_without_branch.info