Skip to content

Commit 9082c96

Browse files
authored
Merge pull request #38 from ricab/update-ci
Update CI and Catch
2 parents 4126c26 + 9911e5b commit 9082c96

4 files changed

Lines changed: 56 additions & 31 deletions

File tree

.github/workflows/test.yml

Lines changed: 49 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ name: Test
33
on:
44
workflow_dispatch:
55
pull_request:
6+
types: [opened, synchronize, reopened, ready_for_review]
67
push:
78
branches: [ "main" ]
89

@@ -14,36 +15,49 @@ jobs:
1415
strategy:
1516
matrix:
1617
include:
17-
- os: ubuntu-20.04
18-
compiler: g++-7
19-
install: g++-7
20-
- os: ubuntu-latest
18+
# GCC on Ubuntu 22.04 (older GCC versions)
19+
- os: ubuntu-22.04
2120
compiler: g++-10
22-
- os: ubuntu-latest
21+
- os: ubuntu-22.04
2322
compiler: g++-11
24-
install: g++-11
23+
- os: ubuntu-22.04
24+
compiler: g++-12
25+
# GCC on Ubuntu 24.04 (newer GCC versions)
26+
- os: ubuntu-24.04
27+
compiler: g++-13
28+
- os: ubuntu-24.04
29+
compiler: g++-14
30+
gcov: gcov-14
2531
extra_build_flags: -DENABLE_COVERAGE:BOOL=ON # coverage build
26-
- os: ubuntu-20.04
27-
compiler: clang++-7
28-
install: clang-7
29-
- os: ubuntu-latest
30-
compiler: clang++-12
31-
- os: ubuntu-latest
32+
# Clang on Ubuntu 22.04 (older Clang versions)
33+
- os: ubuntu-22.04
3234
compiler: clang++-13
33-
- os: ubuntu-latest
35+
- os: ubuntu-22.04
3436
compiler: clang++-14
35-
- os: macos-11
36-
compiler: g++-10
37-
- os: macos-latest
38-
compiler: g++-12
39-
- os: macos-latest
40-
comp: AppleClang # unused: this is the default compiler and not obvious to specify
41-
# explicitly, but we still want to see the compiler string in the
42-
# GH UI, so use a different var altogether
37+
- os: ubuntu-22.04
38+
compiler: clang++-15
39+
# Clang on Ubuntu 24.04 (newer Clang versions)
40+
- os: ubuntu-24.04
41+
compiler: clang++-16
42+
- os: ubuntu-24.04
43+
compiler: clang++-17
44+
- os: ubuntu-24.04
45+
compiler: clang++-18
46+
- os: ubuntu-24.04
47+
compiler: clang++-19
48+
install: clang-19
49+
# GCC on macOS
50+
- os: macos-15
51+
compiler: g++-13
52+
- os: macos-15
53+
compiler: g++-15
54+
# AppleClang on macOS
55+
- os: macos-15
56+
comp: AppleClang # default compiler, unused var to show in GH UI
4357

4458
runs-on: ${{matrix.os}}
4559
steps:
46-
- uses: actions/checkout@v3
60+
- uses: actions/checkout@v6
4761
with:
4862
fetch-depth: 2 # Codecov requests >1
4963

@@ -79,16 +93,24 @@ jobs:
7993
ARGS=-j$((${num_cpus} * 2)) # don't pass --parallel, which would affect compilation tests,
8094
# but do run twice as many compilation tests as the number of
8195
# available threads
82-
83-
- name: Codecov
96+
97+
- name: Produce coverage reports
8498
if: contains(matrix.extra_build_flags, 'coverage')
8599
working-directory: ${{github.workspace}}/build
86100
run: |
87101
echo "Producing coverage reports..."
88-
find . -name catch_tests.cpp.gcno -exec gcov -pb {} +
102+
find . -name catch_tests.cpp.gcno -exec "${{matrix.gcov}}" -p {} +
89103
90104
echo "Finding relevant report..."
91105
cov_report=$(find . -name "*scope_guard.hpp.gcov" -exec readlink -e {} +)
106+
echo "COV_REPORT=$cov_report" >> $GITHUB_ENV
92107
93-
echo "The report is ${cov_report}. Uploading to codecov..."
94-
bash <(curl -s https://codecov.io/bash) -f $cov_report
108+
- name: Codecov
109+
if: contains(matrix.extra_build_flags, 'coverage')
110+
uses: codecov/codecov-action@v5
111+
with:
112+
token: ${{ secrets.CODECOV_TOKEN }}
113+
files: ${{ env.COV_REPORT }}
114+
disable_search: true
115+
flags: unittests
116+
fail_ci_if_error: 'true'

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Include(FetchContent)
1111
FetchContent_Declare(
1212
Catch2
1313
GIT_REPOSITORY https://github.com/catchorg/Catch2.git
14-
GIT_TAG v2.13.6
14+
GIT_TAG v3.12.0
1515
)
1616

1717
FetchContent_MakeAvailable(Catch2)
@@ -133,7 +133,7 @@ function(add_catch_tests_batch exe_ret src cxx17 require_noexcept)
133133
derive_common_test_strings(tst exe ftr # out params
134134
"catch_batch" TRUE ${cxx17} ${require_noexcept}) # in params
135135
add_test_exe(${exe} ${src} ${ftr} ${require_noexcept})
136-
target_link_libraries(${exe} PRIVATE Catch2::Catch2)
136+
target_link_libraries(${exe} PRIVATE Catch2::Catch2WithMain)
137137

138138
add_test(NAME ${tst} COMMAND ${exe} "--order" "lex")
139139

catch_tests.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55

66
#include "scope_guard.hpp"
77

8-
#define CATCH_CONFIG_MAIN // This tells Catch to provide a main()
9-
#include "catch2/catch.hpp"
8+
#include <catch2/catch_test_macros.hpp>
109

1110
#include <functional>
1211
#include <list>

codecov.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
coverage:
2+
ignore:
3+
- "_deps/**"
4+
- "build/_deps/**"

0 commit comments

Comments
 (0)