-
Notifications
You must be signed in to change notification settings - Fork 38
166 lines (137 loc) · 4.7 KB
/
cmake.yml
File metadata and controls
166 lines (137 loc) · 4.7 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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
name: build
on:
push:
branches:
- master
paths-ignore:
- '.devcontainer/**'
- '.vscode/**'
- 'LICENSE'
- 'Makefile'
- '**/README.md'
pull_request:
paths-ignore:
- '.devcontainer/**'
- '.vscode/**'
- 'LICENSE'
- 'Makefile'
- '**/README.md'
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
CTEST_OUTPUT_ON_FAILURE: ON
CTEST_PARALLEL_LEVEL: 2
jobs:
test:
name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
- {
name: "Ubuntu 24.04 GCC, C++11 (Debug)",
os: ubuntu-24.04,
build_type: "Debug",
std: "11",
sanitizers: "ON",
}
- {
name: "Ubuntu Latest GCC, C++17 (Debug)",
os: ubuntu-latest,
build_type: "Debug",
std: "17",
sanitizers: "OFF",
}
- {
name: "Ubuntu Latest GCC, C++11 (Release)",
os: ubuntu-latest,
build_type: "Release",
std: "11",
sanitizers: "OFF",
}
- {
name: "macOS Latest Clang, C++11 (Release)",
os: macos-latest,
build_type: "Release",
std: "11",
sanitizers: "OFF",
}
- {
name: "Windows Latest, C++11 (Release)",
os: windows-latest,
build_type: "Release",
std: "11",
sanitizers: "OFF",
}
steps:
- uses: actions/checkout@v4
- name: Create Build Environment
run: cmake -E make_directory ${{github.workspace}}/build
- name: Configure CMake
working-directory: ${{github.workspace}}/build
run: cmake ${{ github.workspace }} -DCMAKE_BUILD_TYPE=${{ matrix.config.build_type }} -DCMAKE_CXX_STANDARD=${{ matrix.config.std }} -DCPP_CHANNEL_BUILD_EXAMPLES=ON -DCPP_CHANNEL_BUILD_TESTS=ON -DCPP_CHANNEL_SANITIZERS=${{ matrix.config.sanitizers }}
- name: Build
working-directory: ${{github.workspace}}/build
run: cmake --build . --config ${{ matrix.config.build_type }} --target channel_tests -j
- name: Test
working-directory: ${{github.workspace}}/build
run: ctest -C ${{ matrix.config.build_type }} --verbose -L channel_tests --output-on-failure -j
- name: Run examples
working-directory: ${{github.workspace}}/build
run: cmake --build . --config ${{ matrix.config.build_type }} --target run_examples -j
coverage:
name: Coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Create Build Environment
run: cmake -E make_directory ${{github.workspace}}/build
- name: Configure CMake
working-directory: ${{github.workspace}}/build
run: cmake ${{ github.workspace }} -DCMAKE_BUILD_TYPE=Debug -DCPP_CHANNEL_BUILD_TESTS=ON -DCPP_CHANNEL_COVERAGE=ON
- name: Build
working-directory: ${{github.workspace}}/build
run: cmake --build . --config Debug --target channel_tests -j
- name: Test
working-directory: ${{github.workspace}}/build
run: ctest -C Debug --verbose -L channel_tests -j
- name: Generate coverage
working-directory: ${{github.workspace}}/build
run: |
sudo apt-get install lcov -y
lcov --capture --directory . --output-file coverage.info --ignore-errors mismatch
lcov --remove coverage.info "*/usr/*" -o coverage.info
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ${{github.workspace}}/build/coverage.info
format:
name: Format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: C++
run: clang-format --dry-run --Werror $(find . -name *.*pp)
- name: CMake
run: |
pip install cmake-format
cmake-format -i $(find -name CMakeLists.txt)
git diff --exit-code
clang-tidy:
name: Clang Tidy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install
run: sudo apt-get install -y clang-tidy
- name: Create Build Environment
run: cmake -E make_directory ${{github.workspace}}/build
- name: Configure CMake
working-directory: ${{github.workspace}}/build
run: cmake ${{ github.workspace }} -DCMAKE_BUILD_TYPE=Debug -DCPP_CHANNEL_BUILD_TESTS=ON
- name: Run Clang Tidy
run: clang-tidy -p ${{github.workspace}}/build $(find include -type f) -- -std=c++11