-
Notifications
You must be signed in to change notification settings - Fork 33
143 lines (125 loc) · 4.5 KB
/
test.yml
File metadata and controls
143 lines (125 loc) · 4.5 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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
name: Test
on:
workflow_dispatch:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
push:
branches: [ "main" ]
env:
BUILD_TYPE: Debug
jobs:
build:
strategy:
matrix:
include:
# GCC on Ubuntu 22.04 (older GCC versions)
- os: ubuntu-22.04
compiler: g++-10
- os: ubuntu-22.04
compiler: g++-11
- os: ubuntu-22.04
compiler: g++-12
# GCC on Ubuntu 24.04 (newer GCC versions)
- os: ubuntu-24.04
compiler: g++-13
- os: ubuntu-24.04
compiler: g++-14
gcov: gcov-14
extra_build_flags: -DENABLE_COVERAGE:BOOL=ON # coverage build
# Clang on Ubuntu 22.04 (older Clang versions)
- os: ubuntu-22.04
compiler: clang++-13
- os: ubuntu-22.04
compiler: clang++-14
- os: ubuntu-22.04
compiler: clang++-15
# Clang on Ubuntu 24.04 (newer Clang versions)
- os: ubuntu-24.04
compiler: clang++-16
- os: ubuntu-24.04
compiler: clang++-17
- os: ubuntu-24.04
compiler: clang++-18
- os: ubuntu-24.04
compiler: clang++-19
install: clang-19
# GCC on macOS
- os: macos-15
compiler: g++-13
- os: macos-15
compiler: g++-15
# AppleClang on macOS
- os: macos-15
comp: AppleClang # default compiler, unused var to show in GH UI
# MSVC on Windows
- os: windows-2019
comp: MSVC # Visual Studio 2019 ATTOW
- os: windows-2025
comp: MSVC # Visual Studio 2022 ATTOW
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 2 # Codecov requests >1
- name: Install compiler
if: ${{matrix.install}}
run: |
sudo apt-get update
sudo apt-get install ${{matrix.install}}
- name: Determine number of cpus on Linux
if: startsWith(matrix.os, 'ubuntu')
run: echo "num_cpus=$(nproc)" >> $GITHUB_ENV
- name: Determine number of cpus on macOS
if: startsWith(matrix.os, 'macos')
run: echo "num_cpus=$(sysctl -n hw.ncpu)" >> $GITHUB_ENV
- name: Determine number of cpus on Windows
if: startsWith(matrix.os, 'windows')
run: echo "num_cpus=$env:NUMBER_OF_PROCESSORS" >> $env:GITHUB_ENV
- name: Determine number of compilation test jobs on macOS and Linux
if: ${{ !startsWith(matrix.os, 'windows') }}
shell: bash
run: echo "num_comp_tests=$((${{env.num_cpus}} * 2))" >> $GITHUB_ENV
- name: Determine number of compilation test jobs on Windows
if: startsWith(matrix.os, 'windows')
shell: bash
run: echo "num_comp_tests=1" >> $GITHUB_ENV
- name: Determine compiler flag
if: ${{matrix.compiler}}
run: echo "CXX=${{matrix.compiler}}" >> $GITHUB_ENV
- name: Configure CMake
run: cmake -Wdev -Werror=dev -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
${{matrix.extra_build_flags}}
- name: Build
working-directory: ${{github.workspace}}/build
run: cmake --build . --config ${{env.BUILD_TYPE}} --parallel ${{env.num_cpus}}
- name: Test
working-directory: ${{github.workspace}}/build
run: cmake --build . --config ${{env.BUILD_TYPE}} --target test
ARGS=-j${{env.num_comp_tests}} # don't pass --parallel, which would affect compilation tests
- name: Produce coverage reports
if: contains(matrix.extra_build_flags, 'coverage')
working-directory: ${{github.workspace}}/build
run: |
echo "Producing coverage reports..."
find . -name catch_tests.cpp.gcno -exec "${{matrix.gcov}}" -p {} +
echo "Finding relevant report..."
cov_report=$(find . -name "*scope_guard.hpp.gcov" -exec readlink -e {} +)
echo "COV_REPORT=$cov_report" >> $GITHUB_ENV
- name: Codecov
if: contains(matrix.extra_build_flags, 'coverage')
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ${{ env.COV_REPORT }}
disable_search: true
flags: unittests
fail_ci_if_error: 'true'
overall-status:
name: Overall Status
runs-on: ubuntu-latest
needs: build
if: always()
steps:
- name: Check overall workflow status, to provide a single pass/fail result
if: needs.build.result != 'success'
run: exit 1