This repository was archived by the owner on Sep 23, 2026. It is now read-only.
Repository navigation
162 lines (130 loc) · 5.39 KB
/
Copy pathci.yml
File metadata and controls
162 lines (130 loc) · 5.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
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
# The gates, in the same order and with the same flags as the local commands in the README, so a
# green check here means what a clean local run means. Nothing in this file asserts a latency
# number. A hosted runner is a shared machine and any threshold enforced on one would be either so
# loose it asserts nothing or so tight it fails on a busy neighbour. The numbers come off the Mac,
# and BENCHMARK.md says how.
name: CI
on:
push:
branches: [main]
pull_request:
workflow_dispatch:
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
env:
CLANG_FORMAT_VERSION: 23.1.0
CLANG_TIDY_VERSION: 22.1.8
jobs:
build:
name: build · ${{ matrix.os }}
runs-on: ${{ matrix.os }}
timeout-minutes: 20
strategy:
# Without this a Linux failure cancels the in-flight macOS job, so you fix Linux, push, and
# only then find out macOS was broken too.
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
steps:
- uses: actions/checkout@v7
- name: Install ninja, SQLite and OpenSSL (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends ninja-build libsqlite3-dev libssl-dev
# openssl@3 is on the image already; naming it keeps the configure from depending on
# that staying true, and the root CMakeLists reads its prefix out of brew.
- name: Install ninja and OpenSSL (macOS)
if: runner.os == 'macOS'
run: brew install ninja openssl@3
- name: Report toolchain
run: |
cmake --version
"${CXX:-c++}" --version
- name: Cache Catch2 clone
uses: actions/cache@v6
with:
path: ${{ github.workspace }}/.deps
key: deps-${{ matrix.os }}-${{ hashFiles('CMakeLists.txt') }}
restore-keys: deps-${{ matrix.os }}-
- name: Configure
run: cmake --preset dev -DFETCHCONTENT_BASE_DIR="${{ github.workspace }}/.deps"
- name: Build
run: cmake --build --preset dev
# ctest exits 0 when discovery finds nothing, so without --no-tests=error a broken test
# registration reports success and the gate passes on no tests.
- name: Test
run: ctest --preset dev --no-tests=error
sanitize:
name: asan+ubsan · ubuntu-latest
runs-on: ubuntu-latest
timeout-minutes: 30
env:
CC: clang
CXX: clang++
ASAN_OPTIONS: halt_on_error=1:detect_leaks=1:detect_stack_use_after_return=1:check_initialization_order=1:strict_init_order=1
UBSAN_OPTIONS: halt_on_error=1:print_stacktrace=1
steps:
- uses: actions/checkout@v7
- name: Install toolchain
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends ninja-build clang llvm libsqlite3-dev libssl-dev
- name: Locate llvm-symbolizer
run: echo "ASAN_SYMBOLIZER_PATH=$(command -v llvm-symbolizer)" >> "$GITHUB_ENV"
- name: Cache Catch2 clone
uses: actions/cache@v6
with:
path: ${{ github.workspace }}/.deps
key: deps-asan-${{ hashFiles('CMakeLists.txt') }}
restore-keys: deps-asan-
- name: Configure
run: cmake --preset asan-ubsan -DFETCHCONTENT_BASE_DIR="${{ github.workspace }}/.deps"
- name: Build
run: cmake --build --preset asan-ubsan
- name: Test
run: ctest --preset asan-ubsan --no-tests=error
lint:
name: clang-format · clang-tidy
runs-on: ubuntu-latest
timeout-minutes: 15
# clang, not the runner's default gcc. clang-tidy replays the command line it finds in
# compile_commands.json, so a database generated by gcc hands it -Wduplicated-cond and the two
# other GNU-only flags from CompilerWarnings.cmake, and clang rejects them as unknown warning
# options before it analyses anything.
env:
CC: clang
CXX: clang++
steps:
- uses: actions/checkout@v7
- name: Install ninja, SQLite and OpenSSL
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends ninja-build libsqlite3-dev libssl-dev
- uses: actions/setup-python@v7
with:
python-version: '3.12'
# Pinned wheels rather than the distribution packages. Ubuntu ships clang-format 18 and this
# machine has 23; they disagree on output for an identical config, so an unpinned lint job
# fails on files the author just formatted.
- name: Install pinned linters
run: pip install "clang-format==${CLANG_FORMAT_VERSION}" "clang-tidy==${CLANG_TIDY_VERSION}"
- name: Format
run: |
find src include tests bench -type f \( -name '*.cpp' -o -name '*.hpp' \) -print0 \
| xargs -0 --no-run-if-empty clang-format --dry-run --Werror
- name: Cache Catch2 clone
uses: actions/cache@v6
with:
path: ${{ github.workspace }}/.deps
key: deps-lint-${{ hashFiles('CMakeLists.txt') }}
restore-keys: deps-lint-
- name: Configure for the compilation database
run: cmake --preset dev -DFETCHCONTENT_BASE_DIR="${{ github.workspace }}/.deps"
- name: Tidy
run: |
find src include tests bench -type f -name '*.cpp' -print0 \
| xargs -0 --no-run-if-empty clang-tidy -p build/dev --warnings-as-errors='*'