-
Notifications
You must be signed in to change notification settings - Fork 9
350 lines (310 loc) · 12.1 KB
/
ci.yml
File metadata and controls
350 lines (310 loc) · 12.1 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
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
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
name: CI
on:
pull_request:
branches:
- master
- develop
push:
branches:
- '*'
tags:
- "v*.*.*"
concurrency:
group: ${{format('{0}:{1}', github.repository, github.ref)}}
cancel-in-progress: true
env:
GIT_FETCH_JOBS: 8
NET_RETRY_COUNT: 5
DEFAULT_BUILD_VARIANT: debug,release
jobs:
# ===========================================================================
# Developer workflow tests
# Ensures contributors can clone, install, build, and test locally
# ===========================================================================
dev-workflow:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
name: Dev Workflow (${{ matrix.os }})
runs-on: ${{ matrix.os }}
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install dependencies and build
run: npm install
- name: Run tests
run: npm test
- name: Lint
run: npm run lint
- name: Check action.yml files
if: matrix.os == 'ubuntu-latest'
run: |
# npm install already ran prepare (which regenerates action.yml from schemas).
# If any action.yml differs from what is committed, the schema is out of sync.
if ! git diff --quiet -- '*/action.yml'; then
echo "::error::action.yml files are out of date. Run 'npm run build' and commit the updated action.yml files."
git diff --name-only -- '*/action.yml'
exit 1
fi
echo "action.yml check passed"
- name: Check dist bundles
if: matrix.os == 'ubuntu-latest'
run: |
# npm install already ran prepare (which rebuilds all workspaces).
# If any dist/ file differs from what is committed, the bundle is stale.
if ! git diff --quiet -- '*/dist/'; then
echo "::error::dist/ files are out of date. Run 'npm run build' and commit the updated dist/ files."
git diff --name-only -- '*/dist/'
exit 1
fi
echo "Dist bundle check passed"
# ===========================================================================
# Action integration tests
# Tests the actions in practice with various C++ compilers and platforms
# ===========================================================================
cpp-matrix:
needs: dev-workflow
runs-on: ubuntu-latest
name: Generate Test Matrix
outputs:
matrix: ${{ steps.cpp-matrix.outputs.matrix }}
steps:
- name: Clone cpp-actions
uses: actions/checkout@v4
- name: Generate Test Matrix
uses: ./cpp-matrix
id: cpp-matrix
with:
standards: '>=14'
compilers: |
gcc >=4.8 <6 || >=9
clang >=3.8 <6 || >11
msvc >=14
apple-clang *
mingw *
clang-cl *
subrange-policy: |
msvc: one-per-minor
latest-factors: |
gcc Coverage TSan UBSan Fetch-Content
clang Fetch-Content
factors: |
gcc ASan Shared No-Deps
msvc Shared x86
clang Time-Trace ASan+UBSan
mingw Shared
force-factors: |
mingw: No-Deps
trace-commands: true
extra-values: |
vcpkg-packages: {{#if (not fetch-content)}}fmt{{/if}}
address-model: {{#if (eq arch 'x86')}}32{{else}}64{{/if}}
github-token: ${{ secrets.GITHUB_TOKEN }}
build:
needs: cpp-matrix
strategy:
fail-fast: false
matrix:
include: ${{ fromJSON(needs.cpp-matrix.outputs.matrix) }}
defaults:
run:
shell: bash
name: ${{ matrix.name }}
runs-on: ${{ matrix.runs-on }}
container: ${{ matrix.container }}
env: ${{ matrix.env }}
timeout-minutes: 30
permissions:
contents: write
steps:
# GitHub Actions no longer support older containers.
# The workaround is to install our own Node.js for the actions.
- name: Patch Node
# The containers that need Node.js 20 will have volumes set up so that
# the Node.js 20 installation can go there.
if: ${{ matrix.container.volumes }}
run: |
set -x
apt-get update
apt-get install -y curl xz-utils
curl -LO https://unofficial-builds.nodejs.org/download/release/v20.9.0/node-v20.9.0-linux-x64-glibc-217.tar.xz
tar -xf node-v20.9.0-linux-x64-glibc-217.tar.xz --strip-components 1 -C /node20217
ldd /__e/node20/bin/node
- name: Clone cpp-actions
uses: actions/checkout@v4
# Set up the compiler before package-install in case one of the packages needs a compiler
- name: Setup C++
uses: ./setup-cpp
id: setup-cpp
with:
compiler: ${{ matrix.compiler }}
# For GCC/Clang, we are iterating majors, so we get whatever major is available from the system
# so that we get the version most likely to be installed by default.
# For other libraries, any logic might be acceptable here.
version: ${{ matrix.version }}
trace-commands: true
arch: ${{ matrix.arch }}
# We're not really going to use doxygen. This is only here to test the action.
- name: Setup Doxygen
uses: ./setup-program
id: setup-doxygen
with:
name: doxygen
version: '>=1.9'
url: |
https://github.com/doxygen/doxygen/releases/download/Release_1_9_7/doxygen-1.9.7.{{ os }}${{ ( runner.os == 'Windows' && '.x64' ) || '' }}.bin.${{ ( runner.os == 'Windows' && 'zip' ) || 'tar.gz' }}
install-prefix: ${{ ( runner.os == 'Linux' && '/usr/local' ) || '' }}
check-latest: true
update-environment: true
fail-on-error: ${{ runner.os != 'macOS' }}
trace-commands: true
- name: Install packages
uses: ./package-install
id: package-install
with:
vcpkg: ${{ matrix.vcpkg-packages }}
vcpkg-triplet: ${{ matrix.triplet }}
apt-get: ${{ matrix.install }}
apt-get-ignore-missing: ${{ matrix.is-container }}
cc: ${{ steps.setup-cpp.outputs.cc }}
ccflags: ${{ matrix.ccflags }}
cxx: ${{ steps.setup-cpp.outputs.cxx }}
cxxflags: ${{ matrix.cxxflags }}
trace-commands: true
- name: Clone Boost.Variant2
uses: ./boost-clone
id: boost-clone
with:
branch: master
modules: variant2
modules-scan-paths: 'test'
modules-exclude-paths: ''
trace-commands: true
- name: B2 Workflow
if: ${{ ! matrix.has-factors && ! runner.os == 'Windows' }}
uses: ./b2-workflow
with:
source-dir: ${{ steps.boost-clone.outputs.boost-dir }}
modules: variant2
toolset: ${{ matrix.b2-toolset }}
build-variant: ${{ matrix.build-type }}
cxx: ${{ steps.setup-cpp.outputs.cxx || '' }}
cxxstd: ${{ matrix.cxxstd }}
address-model: ${{ matrix.address-model }}
arch: ${{ matrix.arch }}
asan: ${{ matrix.asan }}
ubsan: ${{ matrix.ubsan }}
tsan: ${{ matrix.tsan }}
shared: ${{ matrix.shared }}
trace-commands: true
- name: CMake Workflow
uses: ./cmake-workflow
with:
cmake-version: '>=3.20'
source-dir: tests
generator: ${{ matrix.generator }}
generator-toolset: ${{ matrix.generator-toolset }}
arch: ${{ matrix.arch }}
toolchain: ${{ steps.package-install.outputs.vcpkg-toolchain }}
build-type: ${{ matrix.build-type }}
run-tests: true
install-prefix: .local
cxxstd: ${{ matrix.cxxstd }}
cc: ${{ steps.setup-cpp.outputs.cc }}
ccflags: ${{ matrix.ccflags }}
cxx: ${{ steps.setup-cpp.outputs.cxx }}
cxxflags: ${{ matrix.cxxflags }}
shared: ${{ matrix.shared }}
extra-args: |
${{ ( !matrix.no-deps && format('-D BOOST_SRC_DIR="{0}"', steps.boost-clone.outputs.boost-dir) ) || '' }}
${{ ( matrix.no-deps && '-D CPP_ACTIONS_NO_DEPS=ON' ) || '' }}
export-compile-commands: ${{ matrix.time-trace }}
package: true
package-artifact: ${{ matrix.is-main }}
ref-source-dir: .
trace-commands: true
- name: FlameGraph
uses: ./flamegraph
if: matrix.time-trace
with:
source-dir: tests
build-dir: tests/build
github-token: ${{ secrets.GITHUB_TOKEN }}
trace-commands: true
- name: Codecov
if: ${{ matrix.coverage }}
run: |
set -x
gcov_tool="gcov"
if command -v "gcov-${{ steps.setup-cpp.outputs.version-major }}.${{ steps.setup-cpp.outputs.version-minor }}" &> /dev/null; then
gcov_tool="gcov"
elif command -v "gcov-${{ steps.setup-cpp.outputs.version-major }}" &> /dev/null; then
gcov_tool="gcov-${{ steps.setup-cpp.outputs.version-major }}"
fi
lcov -c -q -o "./tests/build/coverage.info" -d "./tests/build" --include "$(pwd)/*" --gcov-tool "$gcov_tool"
# genhtml --legend -f -q "./tests/build/coverage.info" -p "./tests" -o "./tests/build/coverage_html"
cat "./tests/build/coverage.info"
bash <(curl -s https://codecov.io/bash) -f "./tests/build/coverage.info"
echo "# Coverage" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "[](https://codecov.io/github/$GITHUB_REPOSITORY/commit/$GITHUB_SHA)" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "Commit: [](https://codecov.io/github/$GITHUB_REPOSITORY/commit/$GITHUB_SHA)" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "Branch: [](https://codecov.io/github/$GITHUB_REPOSITORY/branch/$GITHUB_REF_NAME)" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
docs:
needs: build
if: ${{ github.event_name == 'push' && (contains(fromJSON('["master", "develop"]'), github.ref_name) || startsWith(github.ref, 'refs/tags/')) }}
defaults:
run:
shell: bash
name: Docs and Release
runs-on: ubuntu-22.04
timeout-minutes: 120
permissions:
contents: write
steps:
- name: Clone cpp-actions
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4.0.2
with:
node-version: '20'
- name: Generate site
working-directory: docs
run: |
npm install
npx antora antora-playbook.yml
- name: Publish to GitHub Pages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docs/build/site
- name: Changelog
uses: ./create-changelog
with:
output-path: CHANGELOG.md
thank-non-regular: ${{ startsWith(github.ref, 'refs/tags/') }}
github-token: ${{ secrets.GITHUB_TOKEN }}
# if ref_name is develop, it only goes to the summary, so we explicitly link commits
link-commits: ${{ github.ref_name == 'develop' }}
trace-commands: true
- name: Create Release
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v1
with:
files: LICENSE
name: ${{ github.ref_name || github.ref }}
tag_name: ${{ github.ref_name || github.ref }}
body_path: CHANGELOG.md
prerelease: false
draft: false
token: ${{ github.token }}