Repository navigation
90 lines (78 loc) · 3.39 KB
/
Copy pathci.yml
File metadata and controls
90 lines (78 loc) · 3.39 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
# Run by hand before a release (Actions → ci → Run workflow): both CLIs built
# and tested with CMake, then every npm package built and tested against those
# CLIs, on macOS, Linux (x64, and arm64 when the repository is public) and
# Windows. release.yml tests the CLIs it ships but
# not the packages, so this is where npm test runs on every platform. It does
# not run on push, to spend no Actions minutes between releases. The tests
# need git (lap's branch and merge tests skip without it, and a skip passes),
# which every GitHub runner has.
name: ci
on:
workflow_dispatch:
permissions:
contents: read
jobs:
# Both CLIs' suites under AddressSanitizer and UndefinedBehaviorSanitizer,
# every report fatal: undefined behaviour can pass every test at one
# optimisation level and crash at another, on one compiler. One Linux job
# is enough; the other jobs build what ships.
sanitizers:
name: sanitizers (ubuntu-latest)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Build the CLIs with ASan and UBSan
run: |
cmake -B build -DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_C_FLAGS="-fsanitize=address,undefined -fno-sanitize-recover=all -fno-omit-frame-pointer -g"
cmake --build build --parallel
- name: Test the CLIs
env:
# lap and kb are short-lived and leave their arenas to exit, so
# LeakSanitizer would report every run; memory errors stay fatal.
ASAN_OPTIONS: detect_leaks=0
UBSAN_OPTIONS: halt_on_error=1:print_stacktrace=1
run: ctest --test-dir build --output-on-failure
test:
name: test (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
# Linux arm64 as well, where gcc -O3 once miscompiled what every other
# target built fine; GitHub gives arm64 runners to public repositories
# only, so a private one runs without it, as release.yml does.
os: ${{ fromJSON(github.event.repository.private && '["ubuntu-latest", "macos-latest", "windows-latest"]' || '["ubuntu-latest", "ubuntu-24.04-arm", "macos-latest", "windows-latest"]') }}
steps:
- uses: actions/checkout@v7
- name: Build the CLIs
run: |
cmake -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build --config Release --parallel
- name: Test the CLIs
run: ctest --test-dir build -C Release --output-on-failure
- uses: actions/setup-node@v7
with:
node-version: 22
cache: npm
- name: Build and test the packages
shell: bash
run: |
npm ci
npm run build
npm test 2>&1 | tee test.log
# npm's own error lands in the middle of the test output, far from the
# failure; this prints every failing test, with its error, at the end.
- name: Show the failing tests
if: failure()
shell: bash
run: |
if [[ -f test.log ]] && grep -qE '^\s*not ok' test.log; then
echo "$(grep -cE '^\s*not ok' test.log) failing, each with the file it is in:"
grep -A8 -E '^\s*not ok' test.log | grep -E "^\s*not ok|location:" | sed -E 's/^ +//'
echo
echo "In detail:"
grep -nE -A30 '^\s*not ok' test.log
else
echo "No test reported 'not ok': the failure is in an earlier step or outside a test."
fi