From a6e359796df3ba651892ad45740010c76119cda3 Mon Sep 17 00:00:00 2001 From: caped-doshi Date: Mon, 15 Dec 2025 13:45:34 -0500 Subject: [PATCH 1/2] github workflow for spsc queue --- .github/workflows/ci.yml | 35 +++++++++++++++++++++++++++++++++++ tests/CMakeLists.txt | 28 ++++++++++++++++++++++------ tests/spsc_test.cc | 2 +- 3 files changed, 58 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..66a3961 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,35 @@ +name: C++ + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + unit-tests: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Install dependencies + run: | + sudo apt-get update + sudo-apt-get install -y cmake g++ + + - name: Configure + run: | + cmake -S . -B build \ + -DNSQUEUE_BUILD_TESTS=ON \ + -DNSQUEUE_BUILD_BENCHMARKS=OFF \ + -DCMAKE_BUILD_TYPE=Release + + - name: Build + run: | + cmake --build build --config Release + + - name: Run unit tests + run: | + ctest --test-dir build -L unit --output-on-failure diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 1c40323..a2ce6d0 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -8,15 +8,31 @@ FetchContent_Declare( FetchContent_MakeAvailable(Catch2) -add_executable(spsc_test +add_executable(spsc_unit_tests spsc_test.cc ) -target_link_libraries(spsc_test - PRIVATE - nsqueue - Catch2::Catch2WithMain +target_link_libraries(spsc_unit_tests + PRIVATE nsqueue Catch2::Catch2WithMain ) include(Catch) -catch_discover_tests(spsc_test) +catch_discover_tests( + spsc_unit_tests + TEST_SPEC "[unit]" + PROPERTIES LABELS unit +) + +add_executable(spsc_stress_tests + spsc_test.cc +) + +target_link_libraries(spsc_stress_tests + PRIVATE nsqueue Catch2::Catch2WithMain +) + +catch_discover_tests( + spsc_stress_tests + TEST_SPEC "[stress]" + PROPERTIES LABELS stress +) diff --git a/tests/spsc_test.cc b/tests/spsc_test.cc index 0e199a0..3de3143 100644 --- a/tests/spsc_test.cc +++ b/tests/spsc_test.cc @@ -113,7 +113,7 @@ TEST_CASE("wrap around", "[unit]"){ REQUIRE(q.empty()); }; -TEST_CASE("stress", "[unit]"){ +TEST_CASE("stress", "[stress]"){ constexpr int N = 200'000; nsqueue::spsc_queue q; From 41807ceff398a9d16946033f1d429694b5f0b84f Mon Sep 17 00:00:00 2001 From: caped-doshi Date: Mon, 15 Dec 2025 14:49:23 -0500 Subject: [PATCH 2/2] modified workflow --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 66a3961..f072b9f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,7 +17,7 @@ jobs: - name: Install dependencies run: | sudo apt-get update - sudo-apt-get install -y cmake g++ + sudo apt-get install -y cmake g++ - name: Configure run: |