Skip to content

Commit b9fd482

Browse files
committed
fixup! add ci config
1 parent be12df1 commit b9fd482

4 files changed

Lines changed: 91 additions & 21 deletions

File tree

‎.github/workflows/ci-main.yml‎

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,65 +2,67 @@ name: CI (Main)
22

33
on:
44
push:
5-
branches: ["master"]
5+
branches: [ "master" ]
66
paths-ignore:
77
- "docs/**"
88
- "**.md"
99
pull_request:
10-
branches: ["master"]
10+
branches: [ "master" ]
1111
paths-ignore:
1212
- "docs/**"
1313
- "**.md"
1414

1515
jobs:
1616
build-and-test:
1717
runs-on: ubuntu-26.04
18-
timeout-minutes: 20
18+
timeout-minutes: 30
1919

2020
strategy:
2121
fail-fast: false
2222
matrix:
2323
compiler:
2424
- { cc: clang, cxx: clang++ }
2525
- { cc: gcc, cxx: g++ }
26-
generator:
27-
- Ninja
28-
- Unix Makefiles
29-
build-type:
30-
- Debug
31-
- Release
26+
sanitizer: [ tsan, asan ]
3227

3328
steps:
3429
- name: Checkout Repository
3530
uses: actions/checkout@v4
3631
with:
3732
submodules: recursive # condy lives in third_party/condy
3833

34+
- name: Load ublk Driver
35+
run: |
36+
sudo modprobe ublk_drv 2>/dev/null || true
37+
if [ ! -e /dev/ublk-control ]; then
38+
echo "::error:: /dev/ublk-control is not available on this runner"
39+
exit 1
40+
fi
41+
3942
- name: Configure CMake
4043
run: |
4144
COMPILER=$(${{matrix.compiler.cc}} --version | head -n 1)
4245
echo "Using compiler: $COMPILER"
46+
SANITIZER_FLAG=""
47+
if [ "${{ matrix.sanitizer }}" = "tsan" ]; then
48+
SANITIZER_FLAG="-DUBLKCPP_TESTS_TSAN=ON"
49+
elif [ "${{ matrix.sanitizer }}" = "asan" ]; then
50+
SANITIZER_FLAG="-DUBLKCPP_TESTS_ASAN=ON"
51+
fi
4352
cmake -B ${{github.workspace}}/build \
44-
-G "${{ matrix.generator }}" \
53+
-G Ninja \
4554
-DUBLKCPP_BUILD_TESTS=ON \
4655
-DUBLKCPP_BUILD_UBLKCTL=ON \
47-
-DUBLKCPP_TESTS_ASAN=ON \
56+
-DUBLKCPP_EXECUTION_BACKEND=stdexec \
57+
$SANITIZER_FLAG \
4858
-DCMAKE_C_COMPILER=${{matrix.compiler.cc}} \
4959
-DCMAKE_CXX_COMPILER=${{matrix.compiler.cxx}} \
50-
-DCMAKE_BUILD_TYPE=${{ matrix.build-type }}
60+
-DCMAKE_BUILD_TYPE=RelWithDebInfo
5161
5262
- name: Build
5363
run: cmake --build ${{github.workspace}}/build -j$(nproc)
5464

55-
- name: Load ublk Driver
56-
run: |
57-
sudo modprobe ublk_drv 2>/dev/null || true
58-
if [ ! -e /dev/ublk-control ]; then
59-
echo "::error:: /dev/ublk-control is not available on this runner"
60-
exit 1
61-
fi
62-
6365
- name: Run Tests
64-
timeout-minutes: 10
66+
timeout-minutes: 15
6567
working-directory: ${{github.workspace}}/build
6668
run: sudo ./tests/tests

‎.github/workflows/ci-toolchain.yml‎

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: CI (Toolchain)
2+
3+
on:
4+
push:
5+
branches: [ "master" ]
6+
paths-ignore:
7+
- "docs/**"
8+
- "**.md"
9+
pull_request:
10+
branches: [ "master" ]
11+
paths-ignore:
12+
- "docs/**"
13+
- "**.md"
14+
15+
jobs:
16+
build-and-test:
17+
runs-on: ubuntu-26.04
18+
timeout-minutes: 20
19+
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
backend: [ "stdexec", "beman" ]
24+
compiler:
25+
- { cc: gcc, cxx: g++ }
26+
- { cc: clang, cxx: clang++ }
27+
generator: [ "Ninja", "Unix Makefiles" ]
28+
29+
steps:
30+
- name: Checkout Repository
31+
uses: actions/checkout@v4
32+
with:
33+
submodules: recursive # condy lives in third_party/condy
34+
35+
- name: Load ublk Driver
36+
run: |
37+
sudo modprobe ublk_drv 2>/dev/null || true
38+
if [ ! -e /dev/ublk-control ]; then
39+
echo "::error:: /dev/ublk-control is not available on this runner"
40+
exit 1
41+
fi
42+
43+
- name: Configure CMake
44+
run: |
45+
COMPILER=$(${{matrix.compiler.cc}} --version | head -n 1)
46+
echo "Using compiler: $COMPILER"
47+
cmake -B ${{github.workspace}}/build \
48+
-G "${{ matrix.generator }}" \
49+
-DUBLKCPP_BUILD_TESTS=ON \
50+
-DUBLKCPP_BUILD_UBLKCTL=ON \
51+
-DUBLKCPP_BUILD_EXAMPLES=ON \
52+
-DUBLKCPP_EXECUTION_BACKEND=${{ matrix.backend }} \
53+
-DCMAKE_C_COMPILER=${{matrix.compiler.cc}} \
54+
-DCMAKE_CXX_COMPILER=${{matrix.compiler.cxx}} \
55+
-DCMAKE_BUILD_TYPE=Debug
56+
57+
- name: Build
58+
run: cmake --build ${{github.workspace}}/build -j$(nproc)
59+
60+
- name: Run Tests
61+
timeout-minutes: 10
62+
working-directory: ${{github.workspace}}/build
63+
run: sudo ./tests/tests

‎CMakeLists.txt‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ option(UBLKCPP_BUILD_DOCS "Build Doxygen documentation" OFF)
1919
option(UBLKCPP_USE_URING_CMD128 "Use IORING_OP_URING_CMD128 for control commands" ON)
2020
option(UBLKCPP_TESTS_STATIC_LINK "Use static linking for tests" OFF)
2121
option(UBLKCPP_TESTS_ASAN "Enable address and undefined behavior sanitizers for tests" OFF)
22+
option(UBLKCPP_TESTS_TSAN "Enable thread sanitizer for tests" OFF)
2223
set(UBLKCPP_EXECUTION_BACKEND "stdexec" CACHE STRING
2324
"std::execution implementation used via Condy: stdexec (default) or beman")
2425

‎tests/CMakeLists.txt‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ elseif (UBLKCPP_TESTS_ASAN)
1313
message(STATUS "Configuring tests with address and undefined behavior sanitizers")
1414
target_compile_options(tests PRIVATE -fsanitize=address,undefined)
1515
target_link_options(tests PRIVATE -fsanitize=address,undefined)
16+
elseif (UBLKCPP_TESTS_TSAN)
17+
message(STATUS "Configuring tests with thread sanitizer")
18+
target_compile_options(tests PRIVATE -fsanitize=thread)
19+
target_link_options(tests PRIVATE -fsanitize=thread)
1620
endif()
1721

1822
add_test(NAME tests COMMAND tests)

0 commit comments

Comments
 (0)