-
Notifications
You must be signed in to change notification settings - Fork 0
75 lines (64 loc) · 2.37 KB
/
unit_tests.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
name: Tests
on: [push, pull_request, workflow_dispatch]
env:
BUILD_TYPE: RelWithDebInfo
jobs:
build-test:
name: Tests (${{ matrix.compiler }} C++${{ matrix.std }} Coverage-${{ matrix.coverage }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
compiler: [ GCC, Clang ]
coverage: [ OFF, ON ]
std: [20, 23]
exclude:
- coverage: ON
include:
- compiler: Clang
- compiler: GCC
version: latest
- compiler: Clang
std: 23
coverage: ON
steps:
- uses: actions/checkout@v4
- name: Set up Clang
if: matrix.compiler == 'Clang'
env:
CLANG_VERSION: ${{ vars.CLANG_VERSION }}
run: |
wget https://apt.llvm.org/llvm.sh
chmod +x ./llvm.sh
sudo ./llvm.sh $CLANG_VERSION all
sudo ln -f -s /usr/bin/clang-$CLANG_VERSION /usr/local/bin/cc
sudo ln -f -s /usr/bin/clang++-$CLANG_VERSION /usr/local/bin/c++
sudo ln -f -s /usr/bin/ld.lld-$CLANG_VERSION /usr/local/bin/ld
sudo ln -f -s /usr/bin/llvm-profdata-$CLANG_VERSION /usr/local/bin/llvm-profdata
sudo ln -f -s /usr/bin/llvm-cov-$CLANG_VERSION /usr/local/bin/llvm-cov
- name: Set up GCC
if: matrix.compiler == 'GCC'
uses: egor-tensin/setup-gcc@v1
with:
version: ${{ matrix.version }}
cc: 1
- name: Configure CMake
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCODE_COVERAGE=${{ matrix.coverage }} -DCMAKE_CXX_STANDARD=${{ matrix.std }}
- name: Build
run: cmake --build ${{github.workspace}}/build --parallel --config ${{env.BUILD_TYPE}}
- name: Test
working-directory: ${{github.workspace}}/build
# Coverage processing seems to be broken when run through ctest
# run: ctest -C ${{env.BUILD_TYPE}}
run: ./mays_tests --colour-mode ansi
- name: Process coverage data
if: matrix.coverage == 'ON'
working-directory: ${{github.workspace}}/build
run: |
llvm-profdata merge -sparse default.profraw -o coverage.profdata
llvm-cov show ./mays_tests -instr-profile=coverage.profdata > coverage.txt
- name: Upload coverage data to Codecov
uses: codecov/codecov-action@v2
if: matrix.coverage == 'ON'
with:
files: ${{github.workspace}}/build/coverage.txt