Repository navigation
825 lines (754 loc) · 36.8 KB
/
Copy pathlibrary.yml
File metadata and controls
825 lines (754 loc) · 36.8 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
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
# Copyright (c) 2026 WebCpp.org
#
# Distributed under the Boost Software License, Version 1.0. (See
# accompanying file LICENSE_1_0.txt or copy at
# https://www.boost.org/LICENSE_1_0.txt)
# The CI of a webcpp library, which its own .github/workflows/ci.yml calls:
#
# jobs:
# ci:
# uses: webcpporg/webcpp/.github/workflows/library.yml@main
# with:
# library: <name>
#
# and of the superproject, whose ci.yml calls it without a library: then it builds every library
# of libs/ at the commit its submodule points to, and the index page with their pages.
#
# Every job checks out webcpporg/webcpp with its submodules, then, for a library, the library's
# commit into libs/<library> in place of its submodule; it runs from the superproject's root,
# with the b2 and the Boost 1.92.0 of tools/ci/actions/boost. Jobs:
#
# plan runs b2 declared-targets and writes the matrix of lanes (tools/ci/matrix.py):
# a lane per compiler for each target the library declares. The CI never lists a
# library's targets by hand, and a target without a lane fails the plan. It also
# runs b2 declared-lanes and writes the matrix of own lanes, those a library
# declares with webcpp.lane, such as its oracle's, and says whether a library
# needs libraries that webcpp does not build yet (external), which none does
# today: B2 builds OpenSSL, libdatachannel and libsecp256k1 from pinned sources
# with one provider per program.
# lanes one job per lane, which runs the lane command, b2 -a --dump-tests
# --out-xml=<lane>.xml for one toolset, and uploads the XML. With --out-xml, b2
# exits 0 even when a test fails: the report gives the verdict. A wasip2 or
# wasip3 lane installs wasi-sdk, wasmtime, wit-bindgen and the WASI WIT first, the
# emscripten lane emsdk and Node, which runs its programs, and a lane whose entry
# says external the libraries its libraries need, built with the lane's compilers.
# GCC 14 and Clang 18 run their b2 in a container with no network but the loopback,
# whose image is prepared separately and pulled by its immutable digest. A lane, an
# own lane but OpenSSL's upstream suite and the lint restore the OpenSSL and
# libdatachannel configurations they built before, which b2 -a keeps, and save
# those their cache lacks (tools/ci/actions/third-party).
# own-lanes one job per own lane of a library and target it runs on, which runs the lane
# in every directory that declares it there. One that names no target, as an
# oracle, runs on Linux x86-64 with Clang 18, and with Node when it runs the
# original, b2 -a <directory>//<lane>, and its exit status is its verdict. One that
# names a target, as wasi's served tests and examples on wasip2, or a driven test on
# emscripten, is set up as that target's lane is, with Node when it runs the
# original, runs b2 -a --dump-tests --out-xml with its toolset, and uploads the
# XML, which the report reads as a lane's. One whose driver meets a browser has
# the pinned chrome-headless-shell (CHROME), and one whose library needs them the
# external libraries, as its entry says. A library that declares none, as xactor, has no such job.
# docs the library's page, or every page and the index, with MrDocs on Linux x86-64,
# wit-bindgen and the WASI WIT, for a reference that parses a component's
# bindings, and, when a library declares emscripten (the plan's has-emscripten),
# emsdk without its system libraries, for one that parses a header built for
# emscripten alone, and, when a library needs them (the plan's external), the
# external libraries, which a reference of their headers' users parses; the index
# is built with -sWEBCPP_INDEX=site, its links where
# the site serves each page (libs/<name>/), and the pages are the artifact ci.yml
# publishes.
# tools for the superproject only: every tools/**/*_test.py, the tests of the build,
# the oracle, the lint, the report, the documentation, the components and the
# CI's own scripts, with every tool a lane, the docs or the lint uses.
# lint tools/lint/lint.sh in eight shards, each analysing an eighth of the files with
# clang-tidy and running every other rule; with the full history, which the
# banned-word rule reads, and the toolsets and tools of the WASI lanes, whose
# commands it analyses, and of the emscripten lane, without its system libraries,
# when a library declares emscripten; and the external libraries when a library
# needs them.
# actionlint every workflow of the superproject and of the libraries.
# report merges the XML of every lane and every own lane on a target with
# tools/report/report.py into the test matrix. Its exit status is the verdict, and it
# fails too when a lane's job failed or wrote no XML, or when an own lane's job
# failed.
#
# No b2 call passes -j: b2 runs as many jobs as the runner has processors.
name: Library
on:
workflow_call:
inputs:
library:
description: The library of libs/ to build; empty for every library and the index.
type: string
required: false
default: ''
outputs:
docs:
description: Whether the docs job built the pages and uploaded them as the docs artifact.
value: ${{ jobs.docs.outputs.built }}
permissions:
contents: read
defaults:
run:
shell: bash
jobs:
plan:
name: Plan
runs-on: ubuntu-24.04
timeout-minutes: 30
outputs:
matrix: ${{ steps.plan.outputs.matrix }}
own-lanes: ${{ steps.plan.outputs.own-lanes }}
has-own-lanes: ${{ steps.plan.outputs.has-own-lanes }}
has-emscripten: ${{ steps.plan.outputs.has-emscripten }}
external: ${{ steps.plan.outputs.external }}
lint-external: ${{ steps.plan.outputs.lint-external }}
steps:
# The superproject is the caller's commit when it calls this workflow itself, and main
# when a library does, the branch this workflow is called at.
# The superproject's submodules, not theirs: a pinned third-party repository may carry
# submodules of its own (nativejson-benchmark has 45) that no build reads.
- &superproject
name: Check out the superproject
if: inputs.library == ''
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
submodules: true
- &superproject-for-library
name: Check out the superproject
if: inputs.library != ''
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
repository: webcpporg/webcpp
ref: main
submodules: true
- &make-room
name: Make room for the library
if: inputs.library != ''
env:
LIBRARY: ${{ inputs.library }}
run: |
[[ "$LIBRARY" =~ ^[a-z][a-z0-9_]*$ ]] || { echo "not a library name: $LIBRARY"; exit 1; }
rm -rf "libs/$LIBRARY"
# The caller's repository at the commit of its event, a pull request's merge included.
- &library
name: Check out the library
if: inputs.library != ''
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
path: libs/${{ inputs.library }}
# Only these pinned nested sources are needed. Do not fetch the unused
# JSON fixtures or the benchmark repository's unrelated submodules.
- &transport-sources
name: Check out the transport source dependencies
shell: bash
run: |
git -C third_party/libs/libdatachannel submodule update --init \
deps/libjuice deps/libsrtp deps/plog deps/usrsctp
- &boost
uses: ./tools/ci/actions/boost
- name: Plan the lanes
id: plan
env:
LIBRARY: ${{ inputs.library }}
run: |
arguments=()
if [ -n "$LIBRARY" ]; then
arguments=(--library "$LIBRARY")
fi
matrix="$(python3 tools/ci/matrix.py plan "${arguments[@]}")"
python3 -m json.tool <<< "$matrix"
echo "matrix=$matrix" >> "$GITHUB_OUTPUT"
own_lanes="$(python3 tools/ci/matrix.py own-lanes "${arguments[@]}")"
python3 -m json.tool <<< "$own_lanes"
echo "own-lanes=$own_lanes" >> "$GITHUB_OUTPUT"
# A matrix with no entry fails its job, so the own-lanes job runs only when there is one.
if [ "$own_lanes" = '{"include":[]}' ]; then
echo "has-own-lanes=false" >> "$GITHUB_OUTPUT"
else
echo "has-own-lanes=true" >> "$GITHUB_OUTPUT"
fi
# Whether any library declares emscripten, whose headers the docs and the lint read.
has_emscripten="$(python3 tools/ci/matrix.py declares emscripten "${arguments[@]}")"
echo "has-emscripten=$has_emscripten" >> "$GITHUB_OUTPUT"
# Whether the library, or one it uses, needs libraries webcpp does not build, which the
# docs job installs then; and whether any library does, which the lint job, which
# analyses every library, installs them on.
external="$(python3 tools/ci/matrix.py external "${arguments[@]}")"
echo "external=$external" >> "$GITHUB_OUTPUT"
lint_external="$(python3 tools/ci/matrix.py external)"
echo "lint-external=$lint_external" >> "$GITHUB_OUTPUT"
# Only a container lane obtains its prepared image; other lanes do not wait for it.
lanes:
name: ${{ matrix.name }}
needs: plan
runs-on: ${{ matrix.os }}
# Since webcpp::crypto and webcpp::hash joined, an MSVC lane builds OpenSSL in more
# configurations (about 27 minutes each on a runner): on webcpporg/webcpp#24 (run
# 43982348264) MSVC 14.3 took 58 minutes and 90 cancelled MSVC 14.5 at 12,600 of its
# 12,948 targets; the runners' speed varies. Since webcpp::codecs and the formats joined,
# an MSVC lane updates 25,832 targets (16,034 on main's run 44781154690, where MSVC 14.5
# took 64 minutes with its third-party cache). On main's run 46916884991 a new runner image
# and new third-party inputs left both MSVC lanes without that cache, so each built OpenSSL
# in five configurations and libdatachannel in two (150 minutes of its four b2 jobs, about
# 37 of the lane's): MSVC 14.3 took 118 minutes, and 150 cancelled MSVC 14.5 at 25,000 of
# its 25,832 targets, about 156 minutes at its pace. 210 leaves such a run a third more.
timeout-minutes: 210
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.plan.outputs.matrix) }}
steps:
- *superproject
- *superproject-for-library
- *make-room
- *library
- name: Verify Windows driven-test process cleanup
if: runner.os == 'Windows'
timeout-minutes: 5
run: python tools/drive/drive_test.py
- *transport-sources
- *boost
# Ubuntu 26.04's GCC 15.2 crashes on standard coroutine await_suspend
# default arguments (GCC PR121643). Keep the unchanged Cobalt tests and
# install the corrected compiler independently of the runner image.
- if: matrix.id == 'gcc-15'
uses: ./tools/ci/actions/gcc
# What a WASI lane installs, which the own-lanes job installs too, by these anchors, for an
# own lane on wasip2 or wasip3: a step a WASI lane needs is one of them. wit-bindgen and the
# WIT are installed for every library's WASI lane, whether or not it builds a component: it
# takes seconds, and a library that comes to need them never meets a lane without them.
- &wasi-sdk
if: matrix.wasm
uses: ./tools/ci/actions/wasi-sdk
- &wasmtime
if: matrix.wasm
uses: ./tools/ci/actions/wasmtime
- &wit-bindgen
if: matrix.wasm
uses: ./tools/ci/actions/wit-bindgen
- &wasi-wit
if: matrix.wasm
uses: ./tools/ci/actions/wasi-wit
# What the emscripten lane installs, which the own-lanes job installs too, by this anchor,
# for an own lane on emscripten: emsdk, which also gives the later steps EM_CACHE, its
# system libraries built.
- &emsdk
if: matrix.emsdk
uses: ./tools/ci/actions/emsdk
# The CI's Node, for a lane whose entry asks for it: the emscripten lane, whose programs b2's
# toolset runs with it, through the wrapper the emsdk action installs, and every own lane on
# emscripten or of the kind original, which runs the original's language.
- &node
if: matrix.node
uses: ./tools/ci/actions/node
# Only a container lane obtains the separately prepared immutable image.
# No ordinary lane builds images or waits for an image-building job.
- if: matrix.container
uses: ./tools/ci/actions/container
# The configurations of OpenSSL and libdatachannel this lane built before, which its b2 -a
# keeps; it saves those it builds that its cache does not hold.
- name: Restore the third-party builds
uses: ./tools/ci/actions/third-party
with:
step: restore
job: ${{ matrix.id }}
# The lane registers its toolset in .local/user-config.jam, prints its b2 command and runs
# it; Windows's Python is python. Its own limit, below the job's, ends a lane that overruns
# as a failed step, not a cancelled job, so that the third-party builds it finished are
# still saved: a lane the job's limit cancelled saved none, and the next run, without
# them, built them again and overran again.
- name: Lane
id: lane
timeout-minutes: 195
env:
LANE: ${{ toJSON(matrix) }}
PYTHON: ${{ runner.os == 'Windows' && 'python' || 'python3' }}
run: '"$PYTHON" tools/ci/matrix.py lane "$LANE"'
- name: Save the third-party builds
if: ${{ !cancelled() }}
uses: ./tools/ci/actions/third-party
with:
step: save
job: ${{ matrix.id }}
- name: Upload the lane's XML
if: always() && steps.lane.outputs.xml != ''
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: lane-${{ matrix.id }}
path: ${{ steps.lane.outputs.xml }}
if-no-files-found: error
retention-days: 7
# A library's own lane, on one target or on none, run in every directory that declares it
# there. One that names no target, such as an oracle, compiles nothing, but its targets inherit
# the requirements of the library's test project, the library's target among them, and with it
# the Jamroot's check of Boost, so the job has Boost and a toolset, Clang 18, as the docs job
# does. One that names a target, such as wasi's served tests and examples on wasip2, installs
# what that target's lane installs (its entry's wasm and emsdk, as a lane's, select the WASI
# steps and emsdk's, by their anchors), runs with its toolset and uploads its XML as a lane
# does, under its id: wasip2.wasi.http. An own lane of the kind original, which runs the
# original's language (an oracle, a driven test's driver, natively too), has the CI's Node,
# whose npm cache the action keys on every oracle's lock file, and so does one on emscripten,
# as the emscripten lane does; one of the kind programs elsewhere, a served lane, has none (its
# entry's node). The job's name and image are its entry's, which tools/ci/matrix.py writes: Own
# lane (xstate, oracle) and Own lane (wasi, http, wasip2).
own-lanes:
name: ${{ matrix.name }}
needs: plan
if: needs.plan.outputs.has-own-lanes == 'true'
runs-on: ${{ matrix.os }}
# crypto's constant-time lane is followed by dudect's judge, whose reruns of a case under
# wasmtime may last up to 1800 s each: 120 minutes there, 60 elsewhere. Several wasip2 cases each
# needing two reruns could exceed 120 minutes, which cancels the job (rare; the evidence is
# still in the log).
timeout-minutes: ${{ (matrix.library == 'crypto' && matrix.lane == 'constant-time') && 120 || 60 }}
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.plan.outputs.own-lanes) }}
steps:
- *superproject
- *superproject-for-library
- *make-room
- *library
- *transport-sources
- *boost
- *wasi-sdk
- *wasmtime
- *wit-bindgen
- *wasi-wit
- *emsdk
- *node
# The pinned chrome-headless-shell, as CHROME, for a lane whose driver meets a browser
# (its entry's chrome), as trystero's interop does.
- if: matrix.chrome
uses: ./tools/ci/actions/chrome
with:
product: ${{ (matrix.library == 'beast' || matrix.library == 'cobalt') && 'chrome' || 'chrome-headless-shell' }}
# The packages the lane needs from apt (its entry's apt, tools/ci/matrix.py's
# OWN_LANE_PACKAGES): crypto's constant-time lane natively has Valgrind, llvm-18 and
# clang-18's sanitizer runtime. The lane runs on the runner, never in the container, so
# they are installed here. A mirror's transient error is retried, and an index that still
# cannot be fetched fails the step, as in the container's image.
- name: Install the lane's packages
if: runner.os == 'Linux' && join(matrix.apt, ' ') != ''
run: |
sudo apt-get -o Acquire::Retries=5 -o APT::Update::Error-Mode=any update
sudo apt-get -o Acquire::Retries=5 install --yes --no-install-recommends ${{ join(matrix.apt, ' ') }}
- name: Build the native Beast interoperability peer
if: matrix.library == 'beast' && (matrix.lane == 'browser' || matrix.lane == 'browser-node')
shell: bash
run: |
python3 tools/ci/matrix.py register clang-18
b2 --user-config=.local/user-config.jam \
libs/beast/test/browser/peer//native_peer-program \
toolset=clang-18 threading=multi -j2
# webrtc's interop lane on emscripten drives the page against the native
# peer and relay, which its driver finds under bin/ (test/interop/run.mjs).
- name: Build the native webrtc interoperability peer
if: matrix.library == 'webrtc' && matrix.lane == 'interop' && matrix.platform == 'emscripten'
shell: bash
run: |
python3 tools/ci/matrix.py register clang-18
b2 --user-config=.local/user-config.jam \
libs/webrtc/test/interop//native-program \
toolset=clang-18 threading=multi -j2
# This embedding adds a private test CA through Wasmtime's supported host hook.
# Stock Wasmtime uses its bundled public roots and has no CLI test-CA option.
- name: Restore the isolated WASI HTTPS host fixture
if: matrix.library == 'beast' && matrix.lane == 'applications-host-tls'
id: host-tls-cache
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: .local/beast-host-tls
key: beast-host-tls-${{ runner.os }}-${{ runner.arch }}-rust-1.97.1-${{ hashFiles('libs/beast/test/applications/host-tls/Cargo.lock', 'libs/beast/test/applications/host-tls/Cargo.toml', 'libs/beast/test/applications/host-tls/src/**') }}
- name: Build the isolated WASI HTTPS host fixture
if: matrix.library == 'beast' && matrix.lane == 'applications-host-tls'
shell: bash
run: |
rustup toolchain install 1.97.1 --profile minimal
cargo +1.97.1 build --locked --jobs 2 \
--manifest-path libs/beast/test/applications/host-tls/Cargo.toml \
--target-dir .local/beast-host-tls
echo "WEBCPP_WASI_TLS_FIXTURE=$PWD/.local/beast-host-tls/debug/webcpp-beast-host-tls-fixture" >> "$GITHUB_ENV"
- name: Save the isolated WASI HTTPS host fixture
if: matrix.library == 'beast' && matrix.lane == 'applications-host-tls' && steps.host-tls-cache.outputs.cache-hit != 'true'
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: .local/beast-host-tls
key: ${{ steps.host-tls-cache.outputs.cache-primary-key }}
- name: Verify Beast application inventory and HTTP fixtures
if: matrix.library == 'beast' && matrix.lane == 'applications-host-clients' && matrix.platform == 'wasip2'
run: |
python3 libs/beast/test/applications/inventory_test.py
python3 libs/beast/test/applications/driver_test.py
# As a lane's, except where the lane runs OpenSSL's upstream suite, which a configuration
# restored from the cache would not run again.
- name: Restore the third-party builds
if: ${{ !startsWith(matrix.lane, 'openssl-upstream') }}
uses: ./tools/ci/actions/third-party
with:
step: restore
job: own-${{ matrix.id || matrix.name }}
# It registers its toolset in .local/user-config.jam, prints its b2 command and runs it.
# crypto's constant-time lane on wasip2 runs dudect_sodium and dudect_secp256k1 under
# wasmtime for minutes, near or past the launcher's default bound of 600 s, so it gets 1800
# (run.sh rejects an empty value, so the fallback is the default).
- name: Own lane
id: lane
env:
LANE: ${{ toJSON(matrix) }}
WEBCPP_WASIP2_TEST_TIMEOUT: ${{ (matrix.library == 'crypto' && matrix.lane == 'constant-time') && '1800' || '600' }}
run: python3 tools/ci/matrix.py own-lane "$LANE"
# crypto's, secure's and codecs' constant-time lanes, each by its own library's judge: every
# dudect output printed, a warning for every |t| of 10 or more, and on a runner GitHub hosts
# a case over 10 measured again in two fresh processes, failing when two of the three exceed
# 10 (libs/crypto's change api-gaps, D7; secure's judge is a copy of crypto's, and codecs'
# of secure's). The launcher's bound is the lane's, so a run of the judge's own lasts at
# most that, and the judge's subprocess timeout (2400 s) lies beyond it.
- name: Judge dudect
if: ${{ !cancelled() && matrix.lane == 'constant-time' && (matrix.library == 'crypto' || matrix.library == 'secure' || matrix.library == 'codecs') }}
env:
WEBCPP_WASIP2_TEST_TIMEOUT: '1800'
LIBRARY: ${{ matrix.library }}
TARGET: ${{ matrix.platform }}
RERUN: ${{ runner.environment == 'github-hosted' && '--rerun' || '' }}
shell: bash
run: |
# RERUN is empty off the hosted runners, so it is left unquoted to vanish.
# shellcheck disable=SC2086
python3 "libs/$LIBRARY/test/constant_time/dudect_judge.py" --bin bin \
--target "$TARGET" $RERUN --launcher tools/boost/asio-wasip2/run.sh
- name: Save the third-party builds
if: ${{ !cancelled() && !startsWith(matrix.lane, 'openssl-upstream') }}
uses: ./tools/ci/actions/third-party
with:
step: save
job: own-${{ matrix.id || matrix.name }}
- name: Upload the lane's XML
if: always() && steps.lane.outputs.xml != ''
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: lane-${{ matrix.id }}
path: ${{ steps.lane.outputs.xml }}
if-no-files-found: error
retention-days: 7
# The size tables a lane wrote (webcpp.size-table, webcpp.program-sizes, whose JSON a
# library's generator reads), kept beyond the job.
- name: Upload the lane's size tables
if: always()
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: sizes-${{ matrix.id || matrix.name }}
path: |
bin/**/*.sizes.md
bin/**/*.sizes.json
if-no-files-found: ignore
- name: Upload OpenSSL upstream test evidence
if: always() && matrix.library == 'asio' && startsWith(matrix.lane, 'openssl-upstream')
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: openssl-upstream-${{ matrix.id }}
path: |
bin/**/upstream-tests.log
bin/**/upstream-tests.json
bin/**/build.json
if-no-files-found: warn
retention-days: 7
docs:
name: Documentation
needs: plan
runs-on: ubuntu-24.04
timeout-minutes: 60
outputs:
built: ${{ steps.built.outputs.built }}
steps:
- *superproject
- *superproject-for-library
- *make-room
- *library
- *transport-sources
- *boost
- uses: ./tools/ci/actions/node
- uses: ./tools/ci/actions/mrdocs
# A reference that parses a component's bindings, as wasi's, has b2 generate them natively.
- uses: ./tools/ci/actions/wit-bindgen
- uses: ./tools/ci/actions/wasi-wit
# The emsdk in .local/emsdk, whose em++ and clang++ read for Emscripten's target the
# reference of a library with a header built for emscripten alone
# (/webcpp//emscripten-reference), when a library declares emscripten; with the sysroot in
# its cache, and without the system libraries, which no page links.
- if: needs.plan.outputs.has-emscripten == 'true'
uses: ./tools/ci/actions/emsdk
with:
libraries: 'false'
# clang++ reads the headers for tools/doc/doc_comments.py; the Boost check compiles with
# the same Clang. The index links each library's page where the site serves it.
# A page whose library needs external libraries requires them, as a lane does, and is
# given each on b2's command line, where its build.jam reads it.
- name: Documentation
env:
LIBRARY: ${{ inputs.library }}
EXTERNAL: ${{ needs.plan.outputs.external }}
run: |
python3 tools/ci/matrix.py register clang-18
request=(doc -sWEBCPP_INDEX=site)
if [ -n "$LIBRARY" ]; then
request=("libs/$LIBRARY/doc")
fi
if [ "$EXTERNAL" = true ]; then
request=(webcpp-require-external=on "${request[@]}")
fi
env -u CPATH -u CPLUS_INCLUDE_PATH -u C_INCLUDE_PATH \
b2 --user-config=.local/user-config.jam -a -sCLANG=/usr/bin/clang++-18 \
toolset=clang-18 "${request[@]}"
# The pages where b2 doc writes them, which tools/ci/assemble.py lays out as the site.
- name: Upload the pages
if: inputs.library == ''
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: docs
path: |
doc/html
libs/*/doc/html
if-no-files-found: error
retention-days: 7
- name: Upload the page
if: inputs.library != ''
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: docs-${{ inputs.library }}
path: libs/${{ inputs.library }}/doc/html
if-no-files-found: error
retention-days: 7
- name: Built
id: built
run: echo "built=true" >> "$GITHUB_OUTPUT"
lint:
name: Lint (${{ matrix.shard }}/${{ strategy.job-total }})
needs: plan
runs-on: ubuntu-24.04
# Every shard writes the same compilation database, then analyses its slice. With eight
# shards, on main's runs 43883027557, 43991796754, 44060501712 and 44061028543, the
# database took 12 to 15 minutes on most runners and the slice 17 to 25: the slices weigh
# alike, each 1.2 to 1.7 times its own runner's database. A runner one in eight times
# runs at half that speed, the database in 26 minutes, so its shard took 67 to 72 minutes,
# and over 60 cancelled Lint (5/8) and Lint (2/8). Twelve shards cut the slice by a third:
# such a runner's shard takes about 57 minutes, the others 30 to 40; 90 leaves a third
# spare for the slower runner and the files to come.
timeout-minutes: 90
strategy:
fail-fast: false
matrix:
shard: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
steps:
# The whole history, of the superproject and of every library: the banned-word rule reads
# every commit, not only the tree.
- name: Check out the superproject
if: inputs.library == ''
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
submodules: true
fetch-depth: 0
- name: Check out the superproject
if: inputs.library != ''
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
repository: webcpporg/webcpp
ref: main
submodules: true
fetch-depth: 0
- *make-room
- name: Check out the library
if: inputs.library != ''
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
path: libs/${{ inputs.library }}
fetch-depth: 0
- *transport-sources
- *boost
- uses: ./tools/ci/actions/wasi-sdk
- uses: ./tools/ci/actions/wit-bindgen
- uses: ./tools/ci/actions/wasi-wit
- uses: ./tools/ci/actions/node
# emsdk when a library declares emscripten, whose em++ the emscripten dry run names and
# whose cache holds the sysroot an emscripten command is analysed with; without the
# system libraries, which the lint never links.
- if: needs.plan.outputs.has-emscripten == 'true'
uses: ./tools/ci/actions/emsdk
with:
libraries: 'false'
# The own lanes' packages (tools/ci/matrix.py lint-packages): the lint analyses their
# programs natively, which include valgrind/memcheck.h and clang-18's sanitizer/ headers.
- name: Install the own lanes' packages
run: |
packages="$(python3 tools/ci/matrix.py lint-packages)"
sudo apt-get -o Acquire::Retries=5 -o APT::Update::Error-Mode=any update
# shellcheck disable=SC2086
sudo apt-get -o Acquire::Retries=5 install --yes --no-install-recommends $packages
# The compilation database is what b2 compiles with its default toolset, the first that
# user-config.jam registers, Clang 18, and, for what only a WASI target or emscripten
# builds, with the toolset of that target: a WASI dry run generates the bindings its
# commands include, and an emscripten command is analysed with the sysroot of the cache the
# emsdk action restores.
#
# The configured headers of OpenSSL and libdatachannel, which each shard generates for its
# compilation database, come from the lint's cache, which the first shard saves.
- name: Restore the third-party headers
uses: ./tools/ci/actions/third-party
with:
step: restore
job: lint
- name: Lint
env:
SHARD: ${{ matrix.shard }}/${{ strategy.job-total }}
HAS_EMSCRIPTEN: ${{ needs.plan.outputs.has-emscripten }}
run: |
toolsets=(clang-18 wasip2 wasip3)
if [ "$HAS_EMSCRIPTEN" = true ]; then
toolsets+=(emscripten)
fi
python3 tools/ci/matrix.py register "${toolsets[@]}"
tools/lint/lint.sh --clang-format .local/wasi-sdk/bin/clang-format \
--clang-tidy .local/wasi-sdk/bin/clang-tidy --shard "$SHARD"
- name: Save the third-party headers
if: ${{ !cancelled() && matrix.shard == 1 }}
uses: ./tools/ci/actions/third-party
with:
step: save
job: lint
tools:
name: Tests of the tools (${{ matrix.shard }}/${{ strategy.job-total }})
if: inputs.library == ''
runs-on: ubuntu-24.04
timeout-minutes: 90
strategy:
fail-fast: false
matrix:
shard: [1, 2, 3, 4, 5, 6, 7, 8]
steps:
- *superproject
- *transport-sources
- *boost
- uses: ./tools/ci/actions/wasi-sdk
- uses: ./tools/ci/actions/wasmtime
- uses: ./tools/ci/actions/wit-bindgen
- uses: ./tools/ci/actions/wasi-wit
- uses: ./tools/ci/actions/node
- uses: ./tools/ci/actions/mrdocs
- uses: ./tools/ci/actions/emsdk
# The toolsets the tests build with, Clang 18 the default, emscripten among them, which the
# tests of the emscripten target build with (tools/test/emscripten_test.py), sharing the
# cache of system libraries the emsdk action restores (EM_CACHE, tools/test/harness.py),
# and the clang++ that tools/doc/doc_comments.py finds on PATH. The shards split the tests:
# a suite run by harness.run_cases runs its slice of cases in every shard (--shard K/N), and
# every other suite runs whole in one shard, in turn, so the N shards run each case once.
# Each failure is named.
- name: Tests of the tools
env:
SHARD: ${{ matrix.shard }}
SHARDS: ${{ strategy.job-total }}
run: |
python3 tools/ci/matrix.py register clang-18 wasip2 wasip3 emscripten
mkdir -p "$RUNNER_TEMP/bin"
ln -sf /usr/bin/clang++-18 "$RUNNER_TEMP/bin/clang++"
export PATH="$RUNNER_TEMP/bin:$PATH"
failed=()
whole=0
while IFS= read -r test; do
if grep -q 'run_cases(' "$test"; then
args=(--shard "$SHARD/$SHARDS")
else
whole=$((whole + 1))
[ $(((whole - 1) % SHARDS + 1)) -eq "$SHARD" ] || continue
args=()
fi
echo "::group::$test ${args[*]}"
python3 "$test" "${args[@]}" || failed+=("$test")
echo "::endgroup::"
done < <(find tools -name '*_test.py' -not -path '*/node_modules/*' | sort)
if [ "${#failed[@]}" -ne 0 ]; then
printf 'failed: %s\n' "${failed[@]}"
exit 1
fi
actionlint:
name: actionlint
runs-on: ubuntu-24.04
timeout-minutes: 15
steps:
- *superproject
- *superproject-for-library
- *make-room
- *library
# actionlint runs shellcheck, which the image has, on every run: script.
- name: actionlint 1.7.12
env:
ASSET: actionlint_1.7.12_linux_amd64.tar.gz
SHA256: 8aca8db96f1b94770f1b0d72b6dddcb1ebb8123cb3712530b08cc387b349a3d8
run: |
tools/ci/download.sh \
"https://github.com/rhysd/actionlint/releases/download/v1.7.12/$ASSET" \
"$SHA256" "$RUNNER_TEMP/$ASSET"
tar -xzf "$RUNNER_TEMP/$ASSET" -C "$RUNNER_TEMP" actionlint
shopt -s nullglob
"$RUNNER_TEMP/actionlint" -config-file .github/actionlint.yaml \
.github/workflows/*.yml libs/*/.github/workflows/*.yml
report:
name: Report
needs: [plan, lanes, own-lanes]
if: always() && needs.plan.result == 'success'
runs-on: ubuntu-24.04
timeout-minutes: 15
steps:
- *superproject
- *superproject-for-library
- *make-room
- *library
- name: Download the lanes' XML
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
pattern: lane-*
path: bin/lanes
# The lanes' XML and the own lanes', each artifact lane-<id>.
- name: Report
env:
MATRIX: ${{ needs.plan.outputs.matrix }}
OWN_LANES: ${{ needs.plan.outputs.own-lanes }}
run: |
python3 tools/ci/matrix.py report --plan "$MATRIX" --own-lanes "$OWN_LANES" \
--lanes bin/lanes --out bin/report
- name: Upload the report
if: always()
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: report
path: bin/report
if-no-files-found: error
retention-days: 7
# A lane whose job failed after b2 wrote its XML, which the report may read as whole; and an
# own lane, whose job is its verdict when it writes no XML: skipped only when the plan found
# none.
- name: Every lane's job succeeded
if: ${{ !cancelled() }}
env:
LANES: ${{ needs.lanes.result }}
OWN_LANES: ${{ needs.own-lanes.result }}
HAS_OWN_LANES: ${{ needs.plan.outputs.has-own-lanes }}
run: |
status=0
if [ "$LANES" != success ]; then
echo "a lane's job did not succeed: $LANES"
status=1
fi
expected=skipped
if [ "$HAS_OWN_LANES" = true ]; then
expected=success
fi
if [ "$OWN_LANES" != "$expected" ]; then
echo "an own lane's job is $OWN_LANES, where $expected was expected"
status=1
fi
exit "$status"