-
Notifications
You must be signed in to change notification settings - Fork 828
103 lines (81 loc) · 2.55 KB
/
cmake_ubuntu.yml
File metadata and controls
103 lines (81 loc) · 2.55 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
name: cmake Ubuntu
on:
push:
branches:
- master
pull_request:
types: [opened, synchronize, reopened]
workflow_dispatch:
env:
BUILD_TYPE: Release
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04]
steps:
- uses: actions/checkout@v6
- name: Install Conan
id: conan
uses: turtlebrowser/get-conan@main
- name: Create default profile
run: conan profile detect
- name: Install conan dependencies
run: conan install conanfile.py -s build_type=${{env.BUILD_TYPE}} --build=missing
- name: Normalize build type
shell: bash
run: echo "BUILD_TYPE_LOWERCASE=$(echo "${BUILD_TYPE}" | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
- name: Configure CMake
shell: bash
run: cmake --preset conan-${{ env.BUILD_TYPE_LOWERCASE }}
- name: Build
shell: bash
run: cmake --build --preset conan-${{ env.BUILD_TYPE_LOWERCASE }}
- name: run test (Linux)
run: ctest --test-dir build/${{env.BUILD_TYPE}}
coverage:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v6
- name: Install lcov
run: sudo apt-get update && sudo apt-get install -y lcov
- name: Install Conan
id: conan
uses: turtlebrowser/get-conan@main
- name: Create default profile
run: conan profile detect
- name: Install conan dependencies
run: conan install conanfile.py -s build_type=Debug --build=missing
- name: Configure CMake with coverage
shell: bash
run: |
cmake --preset conan-debug \
-DCMAKE_C_FLAGS="--coverage -fprofile-update=atomic" \
-DCMAKE_CXX_FLAGS="--coverage -fprofile-update=atomic"
- name: Build
shell: bash
run: cmake --build --preset conan-debug
- name: Run tests
run: ctest --test-dir build/Debug --output-on-failure
- name: Collect coverage
run: |
lcov --capture --directory build/Debug \
--output-file coverage.info \
--ignore-errors mismatch \
--ignore-errors negative
lcov --remove coverage.info \
'/usr/*' \
'*/3rdparty/*' \
'*/tests/*' \
'*/examples/*' \
'*/sample_nodes/*' \
'*/tools/*' \
--output-file coverage.info \
--ignore-errors unused
lcov --list coverage.info
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v5
with:
files: coverage.info
token: ${{ secrets.CODECOV_TOKEN }}