-
Notifications
You must be signed in to change notification settings - Fork 4
97 lines (95 loc) · 3.01 KB
/
build-and-test.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
name: Build and Test
on: push
jobs:
build-and-test:
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu
os_ver: "22.04"
config: Release
coverage: false
cc: gcc-11
cxx: g++-11
experimental: false
- os: ubuntu
os_ver: "20.04"
config: Release
coverage: false
cc: gcc-10
cxx: g++-10
experimental: false
- os: windows
os_ver: "2022"
config: Release
coverage: false
cc: cl
cxx: cl
experimental: false
- os: macos
os_ver: "13"
config: Release
coverage: false
cc: clang
cxx: clang++
experimental: false
- os: ubuntu
os_ver: "20.04"
config: Debug
coverage: true
cc: gcc-10
cxx: g++-10
experimental: false
defaults:
run:
shell: bash
name: ${{ matrix.os }}-${{ matrix.os_ver }} ${{ matrix.cxx }} ${{ matrix.config }} coverage=${{ matrix.coverage }}
env:
CC: ${{ matrix.cc }}
CXX: ${{ matrix.cxx }}
runs-on: ${{ matrix.os }}-${{ matrix.os_ver }}
continue-on-error: ${{ matrix.experimental }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set Project Name
run: echo "REPOSITORY_NAME=$(echo '${{ github.repository }}' | awk -F '/' '{print $2}')" >> $GITHUB_ENV
- name: Create Build Directory
run: cmake -E make_directory ${{github.workspace}}/build
- name: Set coverage variables
id: cov
run: |
if ${{matrix.coverage}}; then
echo "COVERAGE=ON" >> $GITHUB_OUTPUT
echo "STATIC_LIB=OFF" >> $GITHUB_OUTPUT
else
echo "COVERAGE=OFF" >> $GITHUB_OUTPUT
echo "STATIC_LIB=ON" >> $GITHUB_OUTPUT
fi
- name: Setup python
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install Poetry
run: pipx install poetry==1.7.1
- name: Configure CMake
run: cmake -S . -B build -DCMAKE_BUILD_TYPE="${{ matrix.config }}" -D${{ env.REPOSITORY_NAME }}_BUILD_TESTING="ON" -D${{ env.REPOSITORY_NAME }}_STATIC_LIB="${{ steps.cov.outputs.STATIC_LIB }}" -D${{ env.REPOSITORY_NAME }}_COVERAGE="${{ steps.cov.outputs.COVERAGE }}"
- name: Build
run: cmake --build build --config ${{ matrix.config }}
- name: Test
run: ctest -C ${{ matrix.config }} --output-on-failure
working-directory: build
- name: Code Coverage Analysis
if: "matrix.coverage"
run: make gcov
working-directory: build
- name: Upload Code Coverage Report
if: "matrix.coverage"
uses: codecov/codecov-action@v3
with:
flags: integration
functionalities: "gcov"
move_coverage_to_trash: true