Skip to content

Commit a75fb56

Browse files
author
voidzeronull0
committed
Add Coveralls support
1 parent e4d1e7b commit a75fb56

1 file changed

Lines changed: 48 additions & 26 deletions

File tree

.github/workflows/clang-gtest.yml

Lines changed: 48 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,54 @@
1-
name: Clang gtest pipeline
1+
name: CI clang-gtest
22

3-
on:
4-
push:
5-
branches: [ master ]
6-
pull_request:
7-
branches: [ master ]
3+
on: ["push", "pull_request"]
84

95
jobs:
10-
build-and-test:
6+
build-test-coverage:
117
runs-on: ubuntu-latest
128

9+
env:
10+
LLVM_PROFILE_FILE: "${{ github.workspace }}/build/%p.profraw"
11+
1312
steps:
14-
- name: Checkout code
15-
uses: actions/checkout@v3
16-
17-
- name: Install build tools
18-
run: |
19-
sudo apt-get update
20-
sudo apt-get install -y clang cmake ninja-build
21-
22-
- name: Run cmake and ninja
23-
run: |
24-
mkdir build
25-
cd build
26-
cmake .. -G Ninja
27-
ninja
28-
29-
- name: Run tests
30-
run: |
31-
cd build
32-
ctest --output-on-failure
13+
- name: Checkout
14+
uses: actions/checkout@v4
15+
16+
- name: Install dependencies
17+
run: |
18+
sudo apt-get update
19+
sudo apt-get install -y ninja-build llvm clang lcov
20+
21+
- name: Run cmake
22+
run: |
23+
mkdir build
24+
cd build
25+
cmake .. -G Ninja
26+
27+
- name: Build
28+
run: |
29+
ninja
30+
31+
- name: Test
32+
run: |
33+
cd build
34+
ctest --output-on-failure
35+
36+
- name: Make coverage report
37+
run: |
38+
cd build
39+
llvm-profdata merge -sparse *.profraw -o coverage.profdata
40+
TEST_BINARIES=$(find . -type f -executable -name '*_ut')
41+
42+
for BIN in $TEST_BINARIES; do
43+
llvm-cov export "$BIN" \
44+
-instr-profile=coverage.profdata \
45+
-format=lcov \
46+
-ignore-filename-regex='(third_party|_deps|/usr/include|/usr/lib)' \
47+
>> combined_coverage.info
48+
done
49+
50+
- name: Coveralls GitHub Action
51+
uses: coverallsapp/github-action@v2.3.6
52+
with:
53+
github-token: ${{ secrets.GITHUB_TOKEN }}
54+
path-to-lcov: build/combined_coverage.info

0 commit comments

Comments
 (0)