forked from chriskohlhoff/asio
-
Notifications
You must be signed in to change notification settings - Fork 2
238 lines (188 loc) · 6.61 KB
/
cmake.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
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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
name: Continuous Integration
on:
push:
branches:
- master
- develop
- feature/*
pull_request:
branches:
- develop
jobs:
lint:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with: {python-version: "3.12"}
- name: Install codespell
run: pip3 install codespell
# - name: Lint
# if: always()
# working-directory: asio
# run: cmake -D FORMAT_COMMAND=clang-format-18 -P cmake/lint.cmake || echo ignored
- name: Spell check
if: always()
working-directory: asio
run: cmake -P cmake/spell.cmake || echo ignored
coverage:
needs: [lint]
runs-on: ubuntu-24.04
# To enable coverage, delete the last line from the conditional below and
# edit the "<name>" placeholder to your GitHub name.
# If you do not wish to use codecov, then simply delete this job from the
# workflow.
if: github.repository_owner == '<name>'
steps:
- uses: actions/checkout@v4
- name: Install LCov
run: sudo apt-get update -q
&& sudo apt-get install ninja-build lcov -q -y
- name: Configure
working-directory: asio
run: cmake --preset=ci-coverage
- name: Build
working-directory: asio
run: cmake --build build/coverage -j 4
- name: Test
working-directory: asio/build/coverage
run: ctest --output-on-failure --no-tests=error -j 4
- name: Process coverage info
working-directory: asio
run: cmake --build build/coverage -t coverage
- name: Submit to codecov.io
uses: codecov/codecov-action@v4
with:
file: build/coverage/coverage.info
sanitize:
needs: [lint]
runs-on: ubuntu-24.04
env: {CXX: clang++-18}
steps:
- uses: actions/checkout@v4
- name: Setup ninja build toolchain
uses: aminya/setup-cpp@v1
with:
ninja: true
- name: Configure
working-directory: asio
run: cmake --preset=ci-sanitize
- name: Build
working-directory: asio
run: cmake --build build/sanitize -j 4
- name: Test
working-directory: asio/build/sanitize
env:
ASAN_OPTIONS: "strict_string_checks=1:\
detect_stack_use_after_return=1:\
check_initialization_order=1:\
strict_init_order=1:\
detect_leaks=1"
UBSAN_OPTIONS: print_stacktrace=1
run: ctest --output-on-failure --no-tests=error -j 4
test:
needs: [lint]
strategy:
fail-fast: false
matrix:
os: [macos-15, ubuntu-24.04, windows-2022]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Setup ninja build toolchain
uses: aminya/setup-cpp@v1
with:
ninja: true
- name: Install static analyzers
if: matrix.os == 'ubuntu-24.04'
run: |
# Not used! sudo apt-get install cppcheck -y -q
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 19 all
sudo update-alternatives --install \
/usr/bin/clang-tidy clang-tidy \
/usr/bin/clang-tidy-19 150
- name: Install llvm-19
if: startsWith(matrix.os, 'macos')
run: |
brew install llvm@19
echo 'export PATH="/opt/homebrew/opt/llvm/bin:$PATH"' >> /Users/runner/.envrc
echo 'export LDFLAGS="-L/opt/homebrew/opt/llvm/lib"' >> /Users/runner/.envrc
echo 'export CPPFLAGS="-L/opt/homebrew/opt/llvm/include"' >> /Users/runner/.envrc
# see https://github.com/mathstuf/cxx-modules-sandbox/blob/master/.github/workflows/cmake.yml
- name: Visual Studio toolchain environment
uses: TheMrMilchmann/setup-msvc-dev@v1
with:
arch: x64
# # see https://github.com/marketplace/actions/enable-developer-command-prompt
# - uses: ilammy/msvc-dev-cmd@v1
# if: matrix.os == 'windows-2022'
# with:
# vsversion: 2022
- name: Configure windows
if: matrix.os == 'windows-2022'
working-directory: asio
run: |
Add-Content "$env:GITHUB_ENV" 'UseMultiToolTask=true'
Add-Content "$env:GITHUB_ENV" 'EnforceProcessCountAcrossBuilds=true'
cmake --preset=ci-windows
- name: Configure macos
if: matrix.os == 'macos-15'
working-directory: asio
shell: bash
run: |
source /Users/runner/.envrc
which clang++ && clang++ --version
CXX=$(brew --prefix llvm@19)/bin/clang++ cmake --preset=ci-macos
- name: Configure ubuntu
if: matrix.os == 'ubuntu-24.04'
working-directory: asio
env:
CXX: clang++-19
run: cmake --preset=ci-ubuntu
- name: Build
working-directory: asio
run: cmake --build build --config Debug -j 4
- name: Install
working-directory: asio
run: cmake --install build --config Debug # see CMakePresets.json! --prefix stagedir
- name: Test
working-directory: asio/build
run: ctest --output-on-failure --no-tests=error -C Debug -j 4
docs:
# Deploy docs only when builds succeed
needs: [sanitize, test]
runs-on: ubuntu-24.04
# To enable, first you have to create an orphaned gh-pages branch:
#
# git switch --orphan gh-pages
# git commit --allow-empty -m "Initial commit"
# git push -u origin gh-pages
#
# Edit the <name> placeholder below to your GitHub name, so this action
# runs only in your repository and no one else's fork. After these, delete
# this comment and the last line in the conditional below.
# If you do not wish to use GitHub Pages for deploying documentation, then
# simply delete this job similarly to the coverage one.
if: github.ref == 'refs/heads/master'
&& github.event_name == 'push'
&& github.repository_owner == '<name>'
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with: {python-version: "3.12"}
- name: Install m.css dependencies
run: pip3 install ninja jinja2 Pygments
- name: Install Doxygen
run: sudo apt-get update -q
&& sudo apt-get install doxygen -q -y
- name: Build docs
working-directory: asio
run: cmake "-DPROJECT_SOURCE_DIR=$PWD" "-DPROJECT_BINARY_DIR=$PWD/build"
-P cmake/docs-ci.cmake
- name: Deploy docs
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: build/docs/html