-
-
Notifications
You must be signed in to change notification settings - Fork 0
107 lines (85 loc) · 3.32 KB
/
c-cpp.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
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
name: Ubuntu CI
on:
push:
branches: main
pull_request:
branches: main
workflow_dispatch: {}
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
# Set fail-fast to false to ensure that feedback is delivered for all matrix combinations.
fail-fast: false
matrix:
os: [ubuntu-latest]
build_type: [Release, Debug]
cpp_compiler: [g++, clang++]
steps:
- uses: actions/checkout@v4
- name: Fix kernel mmap rnd bits
# Asan in llvm 14 provided in ubuntu 22.04 is incompatible with
# high-entropy ASLR in much newer kernels that GitHub runners are
# using leading to random crashes: https://reviews.llvm.org/D148280
run: sudo sysctl vm.mmap_rnd_bits=28
- name: Configure CMake
run: >
cmake -B ${{ github.workspace }}/build
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
-DUNIT_TESTS=1
-S ${{ github.workspace }}
- name: Build
run: cmake --build ${{ github.workspace }}/build --config ${{ matrix.build_type }} -j
- name: Test
run: ctest --test-dir ${{ github.workspace }}/build --output-on-failure --build-config ${{ matrix.build_type }} --timeout 600 -j
- name: Install lcov
if: matrix.cpp_compiler == 'g++'
run: sudo apt-get install lcov
- name: Make coverage directory
if: matrix.cpp_compiler == 'g++'
run: mkdir -p ${{ github.workspace }}/coverage
- name: Build coverage report
if: matrix.cpp_compiler == 'g++'
run: lcov -c -d build -o ${{ github.workspace }}/coverage/tests_${{ matrix.build_type }}_cov.info
- uses: actions/upload-artifact@v4
if: matrix.cpp_compiler == 'g++'
with:
name: coverage_${{ matrix.build_type }}_${{ matrix.cpp_compiler }}
path: ${{ github.workspace }}/coverage/tests_${{ matrix.build_type }}_cov.info
Coverage:
name: "Upload coverage report"
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v4
- name: Make coverage directory
run: mkdir -p ${{ github.workspace }}/coverage
- name: Download artifact
uses: actions/download-artifact@v4
with:
pattern: coverage_*
merge-multiple: true
path: ${{ github.workspace }}/coverage
- name: Install lcov
run: sudo apt-get install lcov
- name: Merge Release and Debug reports
run: lcov -a ${{ github.workspace }}/coverage/tests_Release_cov.info -a ${{ github.workspace }}/coverage/tests_Debug_cov.info -o ${{ github.workspace }}/coverage/tests_cov.info
- name: Only select YASL library files
run: lcov -e ${{ github.workspace }}/coverage/tests_cov.info yasl/include/*/ -o ${{ github.workspace }}/coverage/tests_cov.info
- name: Upload coverage reports to Codecov
uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}
slug: c4v4/yasl
file: ${{ github.workspace }}/coverage/tests_cov.info
Reuse-lint:
name: "Check Reuse compliance"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v3
- name: Install REUSE tool
run: python -m pip install reuse
- name: Run REUSE lint
run: reuse lint