-
Notifications
You must be signed in to change notification settings - Fork 306
70 lines (63 loc) · 2.36 KB
/
Copy pathcpp_coverage.yml
File metadata and controls
70 lines (63 loc) · 2.36 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
name: CPP Coverage
on:
push:
branches:
- master
jobs:
calculate-coverage:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Install dependencies
run: sudo apt-get update && sudo apt-get install -y libssl-dev zlib1g-dev lcov
- name: Cache gRPC
id: cache-grpc
uses: actions/cache@v3
with:
path: ${{ runner.temp }}/grpc-install
key: grpc-1.46.3-ubuntu-22.04
- name: Build gRPC from source
if: steps.cache-grpc.outputs.cache-hit != 'true'
run: |
git clone --recurse-submodules -b v1.46.3 --depth 1 https://github.com/grpc/grpc.git "${{ runner.temp }}/grpc-src"
cmake -S "${{ runner.temp }}/grpc-src" -B "${{ runner.temp }}/grpc-build" \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX="${{ runner.temp }}/grpc-install" \
-DCMAKE_POLICY_VERSION_MINIMUM=3.5 \
-DgRPC_INSTALL=ON \
-DgRPC_BUILD_TESTS=OFF \
-DgRPC_SSL_PROVIDER=package \
-DgRPC_ZLIB_PROVIDER=package
cmake --build "${{ runner.temp }}/grpc-build" --parallel 4 --config Release
cmake --install "${{ runner.temp }}/grpc-build" --config Release
- name: Build with coverage
working-directory: ./cpp
run: |
cmake -S . -B build \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_PREFIX_PATH="${{ runner.temp }}/grpc-install" \
-DCMAKE_POLICY_VERSION_MINIMUM=3.5 \
-DCMAKE_C_FLAGS="--coverage" \
-DCMAKE_CXX_FLAGS="--coverage" \
-DBUILD_EXAMPLES=OFF \
-DBUILD_TESTS=ON
cmake --build build --parallel 4
- name: Run tests
working-directory: ./cpp/build
run: ctest --output-on-failure -j4
- name: Collect coverage
working-directory: ./cpp
run: |
lcov --capture --directory build --output-file coverage.info
lcov --remove coverage.info '/usr/*' '*/build/_deps/*' '*/proto/*' --output-file coverage.info
lcov --list coverage.info
- name: Upload to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_ACTION_KEY }}
file: ./cpp/coverage.info
flags: cpp
fail_ci_if_error: true
verbose: true