-
Notifications
You must be signed in to change notification settings - Fork 1
59 lines (50 loc) · 1.5 KB
/
linux.yml
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
name: Linux
on: [push, pull_request]
jobs:
build:
name: GCC-${{matrix.build_type}}
runs-on: ubuntu-24.04
strategy:
fail-fast: true
matrix:
build_type: [Release, Debug]
steps:
- uses: actions/checkout@v4
- name: Setup Dependencies
shell: bash
run: |
sudo apt-get update
DEBIAN_FRONTEND=noninteractive sudo apt-get install -y \
build-essential \
cmake \
lcov \
ninja-build
- name: Configure
shell: bash
run: |
if [[ ${{matrix.build_type}} == "Debug" ]]; then
export CXXFLAGS=--coverage
fi
cmake -S . -B build_${{matrix.build_type}} -G Ninja \
-DCMAKE_CXX_STANDARD=11 \
-DCMAKE_CXX_STANDARD_REQUIRED=ON
- name: Build
run: |
cmake --build build_${{matrix.build_type}} \
--config ${{matrix.build_type}}
- name: Test
run: |
./build_${{matrix.build_type}}/test_cpuidpp
- name: Generate Coverage
if: ${{ startswith(matrix.build_type, 'Debug') }}
run: |
lcov --directory . --capture --output-file coverage.info
lcov --remove coverage.info 'tests/*' '/usr/*' --output-file coverage.info
lcov --list coverage.info
- name: Upload Coverage to Codecov
if: ${{ startswith(matrix.build_type, 'Debug') }}
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
verbose: true