Repository navigation
358 lines (351 loc) · 14.2 KB
/
Copy pathci.yml
File metadata and controls
358 lines (351 loc) · 14.2 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
name: CI
on:
push:
branches: [main]
pull_request:
workflow_dispatch:
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true"
CMAKE_BUILD_PARALLEL_LEVEL: "2"
URING_UARCH_SHA: 9bb51fa7ef3ce69745f076595e3ccc1eb31e50d3
jobs:
cli-and-lint:
name: CLI, format, and tidy
runs-on: ubuntu-24.04
timeout-minutes: 90
env:
URING_CLANG_TIDY_BIN: clang-tidy-23
steps:
- name: Checkout sources
uses: actions/checkout@v5
with:
persist-credentials: false
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential ca-certificates ccache curl git gnupg ninja-build pkg-config python3 xz-utils
curl -fsSL https://apt.llvm.org/llvm-snapshot.gpg.key | sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc >/dev/null
echo "deb http://apt.llvm.org/noble/ llvm-toolchain-noble-23 main" | sudo tee /etc/apt/sources.list.d/llvm.list >/dev/null
sudo apt-get update
sudo apt-get install -y clang-tidy-23
- name: Install CMake 4.0+
uses: lukka/get-cmake@latest
with:
cmakeVersion: latest
- name: Install uv
uses: astral-sh/setup-uv@v6
with:
enable-cache: true
- name: Cache prebuilt toolchains
uses: actions/cache@v4
with:
path: ~/.local/toolchain
key: uring-toolchain-v0.0.1-ubuntu22-${{ runner.os }}
restore-keys: |
uring-toolchain-v0.0.1-ubuntu22-${{ runner.os }}
- name: Fetch uarch
run: |
set -euo pipefail
rm -rf "${RUNNER_TEMP}/uarch"
git init -q "${RUNNER_TEMP}/uarch"
git -C "${RUNNER_TEMP}/uarch" remote add origin https://github.com/trunkszi/uarch.git
git -C "${RUNNER_TEMP}/uarch" fetch --depth 1 origin "${URING_UARCH_SHA}"
git -C "${RUNNER_TEMP}/uarch" checkout --detach FETCH_HEAD
- name: Provision toolchains
run: |
set -euo pipefail
for sdk in clang-glibc gcc-glibc; do
cmake -S . -B "${{ runner.temp }}/provision-${sdk}" -G Ninja \
-DURING_TOOLCHAIN_NAME="${sdk}" \
-DURING_UARCH_SOURCE_DIR="${RUNNER_TEMP}/uarch" \
-DURING_BUILD_TESTS=OFF \
-DURING_BUILD_EXAMPLES=OFF \
-DURING_BUILD_TOOLS=OFF \
-DURING_BUILD_BENCHES=OFF \
-DCMAKE_BUILD_TYPE=Release
done
- name: Install uarch
run: |
set -euo pipefail
prefix="${RUNNER_TEMP}/uarch-prefix"
compiler="${HOME}/.local/toolchain/clang-glibc/bin/clang++"
test -x "${compiler}"
cmake -S "${RUNNER_TEMP}/uarch" -B "${RUNNER_TEMP}/uarch-build" -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_CXX_COMPILER="${compiler}" \
-DCMAKE_INSTALL_PREFIX="${prefix}" \
-DUARCH_BUILD_TESTS=OFF \
-DUARCH_BUILD_EXAMPLES=OFF \
-DUARCH_BUILD_TOOLS=OFF \
-DUARCH_BUILD_BENCHES=OFF \
-DUARCH_AUTO_DOWNLOAD_TOOLCHAIN=OFF
cmake --build "${RUNNER_TEMP}/uarch-build" --target uarch_detect --parallel 2
cmake --install "${RUNNER_TEMP}/uarch-build"
echo "CMAKE_PREFIX_PATH=${prefix}" >> "${GITHUB_ENV}"
- name: Sync the CLI environment
run: uv sync --locked --directory scripts/cli
- name: CLI unit tests
run: python3 -m unittest discover -s scripts/cli/tests
- name: Check formatting
run: ./uring format --check
- name: Clang-tidy
run: |
clang-tidy-23 --version
clang-tidy-23 --verify-config
./uring tidy --preset clang-glibc-release
release-and-verify:
name: release ${{ matrix.toolchain }}
runs-on: ubuntu-24.04
timeout-minutes: 120
strategy:
fail-fast: false
matrix:
toolchain: [clang-glibc, gcc-glibc, clang-musl, gcc-musl]
steps:
- name: Checkout sources
uses: actions/checkout@v5
with:
persist-credentials: false
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential ccache git ninja-build pkg-config python3 xz-utils
- name: Install CMake 4.0+
uses: lukka/get-cmake@latest
with:
cmakeVersion: latest
- name: Install uv
uses: astral-sh/setup-uv@v6
with:
enable-cache: true
- name: Cache prebuilt toolchains
uses: actions/cache@v4
with:
path: ~/.local/toolchain
key: uring-toolchain-v0.0.1-ubuntu22-${{ runner.os }}-${{ matrix.toolchain }}
restore-keys: |
uring-toolchain-v0.0.1-ubuntu22-${{ runner.os }}-
- name: Fetch uarch
run: |
set -euo pipefail
rm -rf "${RUNNER_TEMP}/uarch"
git init -q "${RUNNER_TEMP}/uarch"
git -C "${RUNNER_TEMP}/uarch" remote add origin https://github.com/trunkszi/uarch.git
git -C "${RUNNER_TEMP}/uarch" fetch --depth 1 origin "${URING_UARCH_SHA}"
git -C "${RUNNER_TEMP}/uarch" checkout --detach FETCH_HEAD
- name: Provision toolchains
run: |
set -euo pipefail
seen=""
for sdk in clang-glibc gcc-glibc ${{ matrix.toolchain }}; do
case " ${seen} " in
*" ${sdk} "*) continue ;;
esac
seen="${seen} ${sdk}"
cmake -S . -B "${{ runner.temp }}/provision-${sdk}" -G Ninja \
-DURING_TOOLCHAIN_NAME="${sdk}" \
-DURING_UARCH_SOURCE_DIR="${RUNNER_TEMP}/uarch" \
-DURING_BUILD_TESTS=OFF \
-DURING_BUILD_EXAMPLES=OFF \
-DURING_BUILD_TOOLS=OFF \
-DURING_BUILD_BENCHES=OFF \
-DCMAKE_BUILD_TYPE=Release
done
- name: Install uarch
run: |
set -euo pipefail
prefix="${RUNNER_TEMP}/uarch-prefix"
case "${{ matrix.toolchain }}" in
clang-glibc) compiler="${HOME}/.local/toolchain/clang-glibc/bin/clang++" ;;
gcc-glibc) compiler="${HOME}/.local/toolchain/gcc-glibc/bin/x86_64-unknown-linux-gnu-g++" ;;
clang-musl) compiler="${HOME}/.local/toolchain/clang-musl/bin/x86_64-unknown-linux-musl-clang++" ;;
gcc-musl) compiler="${HOME}/.local/toolchain/gcc-musl/bin/x86_64-unknown-linux-musl-g++" ;;
esac
test -x "${compiler}"
cmake -S "${RUNNER_TEMP}/uarch" -B "${RUNNER_TEMP}/uarch-build" -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_CXX_COMPILER="${compiler}" \
-DCMAKE_INSTALL_PREFIX="${prefix}" \
-DUARCH_BUILD_TESTS=OFF \
-DUARCH_BUILD_EXAMPLES=OFF \
-DUARCH_BUILD_TOOLS=OFF \
-DUARCH_BUILD_BENCHES=OFF \
-DUARCH_AUTO_DOWNLOAD_TOOLCHAIN=OFF
cmake --build "${RUNNER_TEMP}/uarch-build" --target uarch_detect --parallel 2
cmake --install "${RUNNER_TEMP}/uarch-build"
echo "CMAKE_PREFIX_PATH=${prefix}" >> "${GITHUB_ENV}"
- name: Sync the CLI environment
run: uv sync --locked --directory scripts/cli
- name: Release tests and verify
run: |
if [[ -r /proc/sys/kernel/io_uring_disabled && "$(cat /proc/sys/kernel/io_uring_disabled)" != "0" ]]; then
sudo sysctl -w kernel.io_uring_disabled=0
fi
ulimit -l unlimited 2>/dev/null || true
./uring test --preset "${{ matrix.toolchain }}-release"
./uring verify all --preset "${{ matrix.toolchain }}-release"
- name: Verify installed CMake package consumer
run: |
set -euo pipefail
preset="${{ matrix.toolchain }}-release"
prefix="${RUNNER_TEMP}/uring-prefix"
compiler="$(sed -n 's/^CMAKE_CXX_COMPILER:[^=]*=//p' "build/${preset}/CMakeCache.txt")"
test -n "${compiler}" && test -x "${compiler}"
cmake --install "build/${preset}" --prefix "${prefix}"
consumer="${RUNNER_TEMP}/uring-consumer"
mkdir -p "${consumer}"
cat > "${consumer}/CMakeLists.txt" <<'EOF'
cmake_minimum_required(VERSION 3.30)
project(uring_consumer LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 26)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
find_package(uring CONFIG REQUIRED)
add_executable(consumer main.cc)
target_link_libraries(consumer PRIVATE uring::uring)
uarch_configure_runtime(consumer)
EOF
cat > "${consumer}/main.cc" <<'EOF'
#include <uring/uring.hpp>
int main() {
uring::ring::ScriptedRing ring(8);
return ring.Params().sq_entries == 8U ? 0 : 1;
}
EOF
cmake -S "${consumer}" -B "${consumer}/build" -G Ninja \
-DCMAKE_CXX_COMPILER="${compiler}" \
-DCMAKE_PREFIX_PATH="${prefix};${CMAKE_PREFIX_PATH}" \
-DCMAKE_BUILD_TYPE=Release
cmake --build "${consumer}/build"
"${consumer}/build/consumer"
sanitizers:
name: ${{ matrix.preset }}
runs-on: ubuntu-24.04
timeout-minutes: 120
strategy:
fail-fast: false
matrix:
include:
- preset: clang-glibc-asan-ubsan
compiler: clang-glibc
- preset: gcc-glibc-asan-ubsan
compiler: gcc-glibc
steps:
- name: Checkout sources
uses: actions/checkout@v5
with:
persist-credentials: false
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential ccache git ninja-build pkg-config python3 xz-utils
- name: Install CMake 4.0+
uses: lukka/get-cmake@latest
with:
cmakeVersion: latest
- name: Install uv
uses: astral-sh/setup-uv@v6
with:
enable-cache: true
- name: Cache prebuilt toolchains
uses: actions/cache@v4
with:
path: ~/.local/toolchain
key: uring-toolchain-v0.0.1-ubuntu22-${{ runner.os }}
restore-keys: |
uring-toolchain-v0.0.1-ubuntu22-${{ runner.os }}
- name: Fetch uarch
run: |
set -euo pipefail
rm -rf "${RUNNER_TEMP}/uarch"
git init -q "${RUNNER_TEMP}/uarch"
git -C "${RUNNER_TEMP}/uarch" remote add origin https://github.com/trunkszi/uarch.git
git -C "${RUNNER_TEMP}/uarch" fetch --depth 1 origin "${URING_UARCH_SHA}"
git -C "${RUNNER_TEMP}/uarch" checkout --detach FETCH_HEAD
- name: Provision toolchains
run: |
set -euo pipefail
seen=""
for sdk in clang-glibc gcc-glibc ${{ matrix.compiler }}; do
case " ${seen} " in
*" ${sdk} "*) continue ;;
esac
seen="${seen} ${sdk}"
cmake -S . -B "${{ runner.temp }}/provision-${sdk}" -G Ninja \
-DURING_TOOLCHAIN_NAME="${sdk}" \
-DURING_UARCH_SOURCE_DIR="${RUNNER_TEMP}/uarch" \
-DURING_BUILD_TESTS=OFF \
-DURING_BUILD_EXAMPLES=OFF \
-DURING_BUILD_TOOLS=OFF \
-DURING_BUILD_BENCHES=OFF \
-DCMAKE_BUILD_TYPE=Release
done
- name: Install uarch
run: |
set -euo pipefail
prefix="${RUNNER_TEMP}/uarch-prefix"
case "${{ matrix.compiler }}" in
clang-glibc) compiler="${HOME}/.local/toolchain/clang-glibc/bin/clang++" ;;
gcc-glibc) compiler="${HOME}/.local/toolchain/gcc-glibc/bin/x86_64-unknown-linux-gnu-g++" ;;
esac
test -x "${compiler}"
cmake -S "${RUNNER_TEMP}/uarch" -B "${RUNNER_TEMP}/uarch-build" -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_CXX_COMPILER="${compiler}" \
-DCMAKE_INSTALL_PREFIX="${prefix}" \
-DUARCH_BUILD_TESTS=OFF \
-DUARCH_BUILD_EXAMPLES=OFF \
-DUARCH_BUILD_TOOLS=OFF \
-DUARCH_BUILD_BENCHES=OFF \
-DUARCH_AUTO_DOWNLOAD_TOOLCHAIN=OFF
cmake --build "${RUNNER_TEMP}/uarch-build" --target uarch_detect --parallel 2
cmake --install "${RUNNER_TEMP}/uarch-build"
echo "CMAKE_PREFIX_PATH=${prefix}" >> "${GITHUB_ENV}"
- name: Sync the CLI environment
run: uv sync --locked --directory scripts/cli
- name: Sanitizer tests
run: |
if [[ -r /proc/sys/kernel/io_uring_disabled && "$(cat /proc/sys/kernel/io_uring_disabled)" != "0" ]]; then
sudo sysctl -w kernel.io_uring_disabled=0
fi
ulimit -l unlimited 2>/dev/null || true
./uring test --preset "${{ matrix.preset }}"
- name: Verify installed CMake package consumer
run: |
set -euo pipefail
preset="${{ matrix.preset }}"
prefix="${RUNNER_TEMP}/uring-prefix"
compiler="$(sed -n 's/^CMAKE_CXX_COMPILER:[^=]*=//p' "build/${preset}/CMakeCache.txt")"
test -n "${compiler}" && test -x "${compiler}"
cmake --install "build/${preset}" --prefix "${prefix}"
consumer="${RUNNER_TEMP}/uring-consumer"
mkdir -p "${consumer}"
cat > "${consumer}/CMakeLists.txt" <<'EOF'
cmake_minimum_required(VERSION 3.30)
project(uring_consumer LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 26)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
find_package(uring CONFIG REQUIRED)
add_executable(consumer main.cc)
target_link_libraries(consumer PRIVATE uring::uring)
uarch_configure_runtime(consumer)
EOF
cat > "${consumer}/main.cc" <<'EOF'
#include <uring/uring.hpp>
int main() {
uring::ring::ScriptedRing ring(8);
return ring.Params().sq_entries == 8U ? 0 : 1;
}
EOF
cmake -S "${consumer}" -B "${consumer}/build" -G Ninja \
-DCMAKE_CXX_COMPILER="${compiler}" \
-DCMAKE_PREFIX_PATH="${prefix};${CMAKE_PREFIX_PATH}" \
-DCMAKE_BUILD_TYPE=Release
cmake --build "${consumer}/build"
"${consumer}/build/consumer"