Skip to content

Commit 8190072

Browse files
committed
Optimize ci and fix ci on macOS
1 parent e89a558 commit 8190072

4 files changed

Lines changed: 107 additions & 187 deletions

File tree

.github/workflows/ci-meson.yml

Lines changed: 0 additions & 49 deletions
This file was deleted.

.github/workflows/ci.yml

Lines changed: 105 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Makefile Continuous Integrations
1+
name: Continuous Integrations
22

33
on:
44
push:
@@ -8,45 +8,131 @@ on:
88
- '**.h'
99
- '**.cc'
1010
- Makefile
11+
- 'meson*'
12+
- '**/CMakeLists.txt'
1113
- .github/workflows/ci.yml
1214
pull_request:
13-
branches: [ master ]
15+
branches: [ master]
1416
paths:
1517
- '!**'
1618
- '**.h'
1719
- '**.cc'
1820
- Makefile
21+
- 'meson*'
22+
- '**/CMakeLists.txt'
1923
- .github/workflows/ci.yml
2024

2125
jobs:
22-
unit-test:
26+
ci-linux:
2327
strategy:
2428
fail-fast: false
2529
matrix:
26-
toolset: [gcc, clang]
2730
os: [ubuntu-22.04, ubuntu-24.04, ubuntu-22.04-arm, ubuntu-24.04-arm]
31+
compiler:
32+
- {c: gcc, cpp: g++}
33+
- {c: clang, cpp: clang++}
34+
sanitize: [address, undefined, thread]
35+
build_system: [cmake, meson]
36+
37+
runs-on: ${{ matrix.os }}
38+
39+
steps:
40+
- name: Checkout code
41+
uses: actions/checkout@v6
2842

43+
- name: Install dependencies
44+
run: |
45+
sudo apt-get update
46+
sudo apt-get install --yes -qq meson libboost-all-dev
47+
48+
- name: Build and test with CMake
49+
if: matrix.build_system == 'cmake'
50+
env:
51+
CC: ${{ matrix.compiler.c }}
52+
CXX: ${{ matrix.compiler.cpp }}
53+
run: |
54+
cmake -S . -G Ninja -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS_INIT="-fsanitize=${{ matrix.sanitize }}" -DCMAKE_CXX_FLAGS_INIT="-fsanitize=${{ matrix.sanitize }}" -DCMAKE_EXE_LINKER_FLAGS_INIT="-fsanitize=${{ matrix.sanitize }}" -DATOMIC_QUEUE_BUILD_TESTS=ON -DATOMIC_QUEUE_BUILD_EXAMPLES=ON
55+
cmake --build build --target all
56+
ctest --test-dir build --output-on-failure
57+
58+
- name: Build and test with Meson
59+
if: matrix.build_system == 'meson'
60+
env:
61+
CC: ${{ matrix.compiler.c }}
62+
CXX: ${{ matrix.compiler.cpp }}
63+
run: |
64+
meson setup build -Dwerror=true -Dwarning_level=3 -Db_sanitize=${{ matrix.sanitize }}
65+
meson compile -C build
66+
meson test -C build --print-errorlogs
67+
68+
ci-macos:
69+
strategy:
70+
fail-fast: false
71+
matrix:
72+
os: [macos-latest]
73+
compiler:
74+
- {c: clang, cpp: clang++}
75+
sanitize: [address, undefined, thread]
76+
build_system: [cmake, meson]
77+
2978
runs-on: ${{ matrix.os }}
3079

3180
steps:
32-
- uses: actions/checkout@v6
81+
- name: Checkout code
82+
uses: actions/checkout@v6
3383

34-
- name: Install Boost.Test
35-
run: |
36-
sudo apt-get update
37-
sudo apt-get install --yes -qq libboost-test-dev
84+
- name: Install dependencies
85+
run: |
86+
brew install meson boost
3887
39-
- name: Environment variables
40-
run: make -r TOOLSET=${{ matrix.toolset }} env
88+
- name: Build and test with CMake
89+
if: matrix.build_system == 'cmake'
90+
env:
91+
CC: ${{ matrix.compiler.c }}
92+
CXX: ${{ matrix.compiler.cpp }}
93+
run: |
94+
cmake -S . -G Ninja -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS_INIT="-fsanitize=${{ matrix.sanitize }}" -DCMAKE_CXX_FLAGS_INIT="-fsanitize=${{ matrix.sanitize }}" -DCMAKE_EXE_LINKER_FLAGS_INIT="-fsanitize=${{ matrix.sanitize }}" -DATOMIC_QUEUE_BUILD_TESTS=ON -DATOMIC_QUEUE_BUILD_EXAMPLES=ON
95+
cmake --build build --target all
96+
ctest --test-dir build --output-on-failure
4197
42-
- name: Toolset versions
43-
run: make -r TOOLSET=${{ matrix.toolset }} versions
98+
- name: Build and test with Meson
99+
if: matrix.build_system == 'meson'
100+
env:
101+
CC: ${{ matrix.compiler.c }}
102+
CXX: ${{ matrix.compiler.cpp }}
103+
run: |
104+
meson setup build -Dwerror=true -Dwarning_level=3 -Db_sanitize=${{ matrix.sanitize }}
105+
meson compile -C build
106+
meson test -C build --print-errorlogs
107+
108+
ci-windows:
109+
strategy:
110+
fail-fast: false
111+
matrix:
112+
os: [windows-latest]
113+
build_system: [cmake]
114+
115+
runs-on: ${{ matrix.os }}
44116

45-
- name: Build and run unit tests
46-
run: make -rj2 TOOLSET=${{ matrix.toolset }} example run_tests
117+
steps:
118+
- name: Checkout code
119+
uses: actions/checkout@v6
47120

48-
- name: Build and run unit tests with address sanitizer
49-
run: make -rj2 TOOLSET=${{ matrix.toolset }} BUILD=sanitize2 run_tests
121+
- name: Install meson
122+
run: |
123+
pip install meson
124+
125+
- name: Install boost
126+
uses: MarkusJx/install-boost@v2.6.0
127+
id: install-boost-windows
128+
with:
129+
boost_version: 1.89.0
130+
platform_version: 2022
131+
toolset: msvc
50132

51-
- name: Build and run unit tests with thread sanitizer
52-
run: make -rj2 TOOLSET=${{ matrix.toolset }} BUILD=sanitize run_tests
133+
- name: Build and test with CMake
134+
if: matrix.build_system == 'cmake'
135+
run: |
136+
cmake -S . -G Ninja -B build -DCMAKE_BUILD_TYPE=Release -DBOOST_ROOT="${{steps.install-boost-windows.outputs.BOOST_ROOT}}" -DATOMIC_QUEUE_BUILD_TESTS=ON -DATOMIC_QUEUE_BUILD_EXAMPLES=ON
137+
cmake --build build --target all
138+
ctest --test-dir build --output-on-failure

.github/workflows/cmake-gcc-clang.yml

Lines changed: 0 additions & 118 deletions
This file was deleted.

src/tests.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,8 +272,9 @@ BOOST_AUTO_TEST_CASE(try_push_pop) {
272272
}
273273

274274
BOOST_AUTO_TEST_CASE(size) {
275+
constexpr unsigned CAPACITY = CACHE_LINE_SIZE * CACHE_LINE_SIZE;
275276
atomic_queue::RetryDecorator<atomic_queue::AtomicQueueB2<float>> q(10);
276-
BOOST_CHECK_EQUAL(q.capacity(), CACHE_LINE_SIZE * CACHE_LINE_SIZE);
277+
BOOST_CHECK_EQUAL(q.capacity(), CAPACITY);
277278
BOOST_CHECK(q.was_empty());
278279
BOOST_CHECK(!q.was_full());
279280
}

0 commit comments

Comments
 (0)