From 2c3fcde41727c9180143fe5416e1911ff136c26b Mon Sep 17 00:00:00 2001 From: Ricardo Abreu Date: Tue, 6 Jan 2026 18:57:16 +0000 Subject: [PATCH 01/13] [ci] Bring test matrix back to the future --- .github/workflows/test.yml | 51 ++++++++++++++++++++++---------------- 1 file changed, 30 insertions(+), 21 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 075e50c..6ecd591 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -14,32 +14,41 @@ jobs: strategy: matrix: include: - - os: ubuntu-20.04 - compiler: g++-7 - install: g++-7 - - os: ubuntu-latest + # GCC on Ubuntu 22.04 (older GCC versions) + - os: ubuntu-22.04 compiler: g++-10 - - os: ubuntu-latest + - os: ubuntu-22.04 compiler: g++-11 - install: g++-11 + - os: ubuntu-22.04 + compiler: g++-12 + # GCC on Ubuntu 24.04 (newer GCC versions) + - os: ubuntu-24.04 + compiler: g++-13 + - os: ubuntu-24.04 + compiler: g++-14 extra_build_flags: -DENABLE_COVERAGE:BOOL=ON # coverage build - - os: ubuntu-20.04 - compiler: clang++-7 - install: clang-7 - - os: ubuntu-latest - compiler: clang++-12 - - os: ubuntu-latest + # Clang on Ubuntu 22.04 (older Clang versions) + - os: ubuntu-22.04 compiler: clang++-13 - - os: ubuntu-latest + - os: ubuntu-22.04 compiler: clang++-14 - - os: macos-11 - compiler: g++-10 - - os: macos-latest - compiler: g++-12 - - os: macos-latest - comp: AppleClang # unused: this is the default compiler and not obvious to specify - # explicitly, but we still want to see the compiler string in the - # GH UI, so use a different var altogether + - os: ubuntu-22.04 + compiler: clang++-15 + # Clang on Ubuntu 24.04 (newer Clang versions) + - os: ubuntu-24.04 + compiler: clang++-16 + - os: ubuntu-24.04 + compiler: clang++-17 + - os: ubuntu-24.04 + compiler: clang++-18 + # GCC on macOS + - os: macos-15 + compiler: g++-13 + - os: macos-15 + compiler: g++-15 + # AppleClang on macOS + - os: macos-15 + comp: AppleClang # default compiler, unused var to show in GH UI runs-on: ${{matrix.os}} steps: From 0212642f41c515f57d8e80088a2e6c54421390fd Mon Sep 17 00:00:00 2001 From: Ricardo Abreu Date: Tue, 6 Jan 2026 17:58:16 +0000 Subject: [PATCH 02/13] [ci] Update checkout version --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6ecd591..23263e6 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -52,7 +52,7 @@ jobs: runs-on: ${{matrix.os}} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v6 with: fetch-depth: 2 # Codecov requests >1 From bc8f86c1c71111722e76c79588991b11e8b248b8 Mon Sep 17 00:00:00 2001 From: Ricardo Abreu Date: Tue, 6 Jan 2026 18:03:30 +0000 Subject: [PATCH 03/13] [cmake] Update Catch --- CMakeLists.txt | 4 ++-- catch_tests.cpp | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c849825..d1a42a2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,7 +11,7 @@ Include(FetchContent) FetchContent_Declare( Catch2 GIT_REPOSITORY https://github.com/catchorg/Catch2.git - GIT_TAG v2.13.6 + GIT_TAG v3.12.0 ) FetchContent_MakeAvailable(Catch2) @@ -133,7 +133,7 @@ function(add_catch_tests_batch exe_ret src cxx17 require_noexcept) derive_common_test_strings(tst exe ftr # out params "catch_batch" TRUE ${cxx17} ${require_noexcept}) # in params add_test_exe(${exe} ${src} ${ftr} ${require_noexcept}) - target_link_libraries(${exe} PRIVATE Catch2::Catch2) + target_link_libraries(${exe} PRIVATE Catch2::Catch2WithMain) add_test(NAME ${tst} COMMAND ${exe} "--order" "lex") diff --git a/catch_tests.cpp b/catch_tests.cpp index 1e02d65..308a93a 100644 --- a/catch_tests.cpp +++ b/catch_tests.cpp @@ -5,8 +5,7 @@ #include "scope_guard.hpp" -#define CATCH_CONFIG_MAIN // This tells Catch to provide a main() -#include "catch2/catch.hpp" +#include #include #include From f9b5ffcb749f60eca4e4896b69e27a46e83bc00b Mon Sep 17 00:00:00 2001 From: Ricardo Abreu Date: Wed, 7 Jan 2026 00:40:19 +0000 Subject: [PATCH 04/13] [ci] Use codecov action --- .github/workflows/test.yml | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 23263e6..0b51e8c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -88,16 +88,10 @@ jobs: ARGS=-j$((${num_cpus} * 2)) # don't pass --parallel, which would affect compilation tests, # but do run twice as many compilation tests as the number of # available threads - + - name: Codecov if: contains(matrix.extra_build_flags, 'coverage') - working-directory: ${{github.workspace}}/build - run: | - echo "Producing coverage reports..." - find . -name catch_tests.cpp.gcno -exec gcov -pb {} + - - echo "Finding relevant report..." - cov_report=$(find . -name "*scope_guard.hpp.gcov" -exec readlink -e {} +) - - echo "The report is ${cov_report}. Uploading to codecov..." - bash <(curl -s https://codecov.io/bash) -f $cov_report + uses: codecov/codecov-action@v5 + with: + token: ${{ secrets.CODECOV_TOKEN }} + flags: unittests From 62fed389133f00b47aa1b1faf5c24c4c68210404 Mon Sep 17 00:00:00 2001 From: Ricardo Abreu Date: Tue, 6 Jan 2026 18:31:49 +0000 Subject: [PATCH 05/13] [ci] Run CI on further PR events --- .github/workflows/test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0b51e8c..1f38c37 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -3,6 +3,7 @@ name: Test on: workflow_dispatch: pull_request: + types: [opened, synchronize, reopened, ready_for_review] push: branches: [ "main" ] From a0209374c98d2ef8dcaa74f62bea3e57c2208c1a Mon Sep 17 00:00:00 2001 From: Ricardo Abreu Date: Tue, 6 Jan 2026 18:53:35 +0000 Subject: [PATCH 06/13] [ci] Add a test with clang-19 --- .github/workflows/test.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1f38c37..b6b397a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -42,6 +42,9 @@ jobs: compiler: clang++-17 - os: ubuntu-24.04 compiler: clang++-18 + - os: ubuntu-24.04 + compiler: clang++-19 + install: clang-19 # GCC on macOS - os: macos-15 compiler: g++-13 From c8773579dd3e54727dac542900b180cb8fb2e0f3 Mon Sep 17 00:00:00 2001 From: Ricardo Abreu Date: Wed, 7 Jan 2026 00:26:19 +0000 Subject: [PATCH 07/13] [ci] Fail CI on codecov upload errors --- .github/workflows/test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b6b397a..db40d11 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -99,3 +99,4 @@ jobs: with: token: ${{ secrets.CODECOV_TOKEN }} flags: unittests + fail_ci_if_error: 'true' From ca3e46f7458e314b05346a4d60d1224fde195650 Mon Sep 17 00:00:00 2001 From: Ricardo Abreu Date: Wed, 7 Jan 2026 00:52:36 +0000 Subject: [PATCH 08/13] [codecov] Ignore dependencies --- codecov.yml | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 codecov.yml diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 0000000..940559e --- /dev/null +++ b/codecov.yml @@ -0,0 +1,4 @@ +coverage: + ignore: + - "_deps/**" + - "build/_deps/**" From 50091958fc0a6929f5c14c92bd671444a697de69 Mon Sep 17 00:00:00 2001 From: Ricardo Abreu Date: Wed, 7 Jan 2026 01:09:19 +0000 Subject: [PATCH 09/13] [codecov] Go back to manual gcov --- .github/workflows/test.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index db40d11..f1d392f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -93,10 +93,22 @@ jobs: # but do run twice as many compilation tests as the number of # available threads + - name: Produce coverage reports + if: contains(matrix.extra_build_flags, 'coverage') + working-directory: ${{github.workspace}}/build + run: | + echo "Producing coverage reports..." + find . -name catch_tests.cpp.gcno -exec gcov -pb {} + + + echo "Finding relevant report..." + cov_report=$(find . -name "*scope_guard.hpp.gcov" -exec readlink -e {} +) + echo "COV_REPORT=$cov_report" >> $GITHUB_ENV + - name: Codecov if: contains(matrix.extra_build_flags, 'coverage') uses: codecov/codecov-action@v5 with: token: ${{ secrets.CODECOV_TOKEN }} + files: ${{ env.COV_REPORT }} flags: unittests fail_ci_if_error: 'true' From f21a4a1b58f9087e9f2d32e6cf14a3c3b92613ac Mon Sep 17 00:00:00 2001 From: Ricardo Abreu Date: Wed, 7 Jan 2026 01:20:40 +0000 Subject: [PATCH 10/13] [codecov] Try compatible gcov version --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f1d392f..6fd67c9 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -98,7 +98,7 @@ jobs: working-directory: ${{github.workspace}}/build run: | echo "Producing coverage reports..." - find . -name catch_tests.cpp.gcno -exec gcov -pb {} + + find . -name catch_tests.cpp.gcno -exec gcov-14 -pb {} + echo "Finding relevant report..." cov_report=$(find . -name "*scope_guard.hpp.gcov" -exec readlink -e {} +) From 927bdb0b4d2d2a60e1a7a369b9e7dfb877583dfa Mon Sep 17 00:00:00 2001 From: Ricardo Abreu Date: Wed, 7 Jan 2026 01:26:18 +0000 Subject: [PATCH 11/13] [codecov] Avoid uploading piecemeal coverage files --- .github/workflows/test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6fd67c9..98240f7 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -110,5 +110,6 @@ jobs: with: token: ${{ secrets.CODECOV_TOKEN }} files: ${{ env.COV_REPORT }} + disable_search: true flags: unittests fail_ci_if_error: 'true' From 0a81d7832c67f9bf0cf61ac5953aa78d287be44c Mon Sep 17 00:00:00 2001 From: Ricardo Abreu Date: Wed, 7 Jan 2026 01:41:47 +0000 Subject: [PATCH 12/13] [codecov] Remove branch probabilities --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 98240f7..9143855 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -98,7 +98,7 @@ jobs: working-directory: ${{github.workspace}}/build run: | echo "Producing coverage reports..." - find . -name catch_tests.cpp.gcno -exec gcov-14 -pb {} + + find . -name catch_tests.cpp.gcno -exec gcov-14 -p {} + echo "Finding relevant report..." cov_report=$(find . -name "*scope_guard.hpp.gcov" -exec readlink -e {} +) From 9911e5b1ba9ddeace3e32854df7aaef2f6ca7ca3 Mon Sep 17 00:00:00 2001 From: Ricardo Abreu Date: Wed, 7 Jan 2026 02:02:26 +0000 Subject: [PATCH 13/13] [codecov] Avoid hardcoding gcov version --- .github/workflows/test.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9143855..e876982 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -27,6 +27,7 @@ jobs: compiler: g++-13 - os: ubuntu-24.04 compiler: g++-14 + gcov: gcov-14 extra_build_flags: -DENABLE_COVERAGE:BOOL=ON # coverage build # Clang on Ubuntu 22.04 (older Clang versions) - os: ubuntu-22.04 @@ -98,7 +99,7 @@ jobs: working-directory: ${{github.workspace}}/build run: | echo "Producing coverage reports..." - find . -name catch_tests.cpp.gcno -exec gcov-14 -p {} + + find . -name catch_tests.cpp.gcno -exec "${{matrix.gcov}}" -p {} + echo "Finding relevant report..." cov_report=$(find . -name "*scope_guard.hpp.gcov" -exec readlink -e {} +)