Skip to content

Commit 1f9ba4a

Browse files
committed
Add codecov step
1 parent 6415219 commit 1f9ba4a

File tree

1 file changed

+71
-14
lines changed

1 file changed

+71
-14
lines changed

.github/workflows/ci.yml

Lines changed: 71 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,39 +19,96 @@ jobs:
1919
build:
2020
runs-on: ${{ matrix.os }}
2121
strategy:
22+
fail-fast: false
2223
matrix:
23-
os: [ubuntu-22.04, ubuntu-24.04, macos-latest]
24+
cmake_version: [4.0.1, 3.31.7, 3.28.6, 3.26.6, 3.21.7, 3.20.6, 3.16.9, 3.12.4, 3.10.3]
2425
compiler: [gcc, clang]
26+
generator: [Ninja, Unix Makefiles]
27+
os: [ubuntu-24.04]
28+
# CMake-Codecov relies on compiling with absolute paths, but CMake uses absolute paths
29+
# with Ninja only starting with 3.21, so exclude older (non-supported) versions
2530
exclude:
26-
- os: macos-latest
31+
- cmake_version: 3.20.6
32+
generator: Ninja
33+
- cmake_version: 3.16.9
34+
generator: Ninja
35+
- cmake_version: 3.12.4
36+
generator: Ninja
37+
- cmake_version: 3.10.3
38+
generator: Ninja
39+
# Additionally test Ubuntu and macOS with default packages
40+
include:
41+
- os: ubuntu-22.04
42+
cmake_version: default
43+
generator: Unix Makefiles
44+
compiler: gcc
45+
- os: ubuntu-22.04
46+
cmake_version: default
47+
generator: Unix Makefiles
48+
compiler: clang
49+
- os: ubuntu-22.04
50+
cmake_version: default
51+
generator: Ninja
2752
compiler: gcc
28-
53+
- os: ubuntu-22.04
54+
cmake_version: default
55+
generator: Ninja
56+
compiler: clang
57+
- os: macos-latest
58+
compiler: clang
59+
cmake_version: default
60+
generator: Unix Makefiles
61+
- os: macos-latest
62+
compiler: clang
63+
cmake_version: default
64+
generator: Ninja
65+
2966
steps:
3067
- name: Checkout code
3168
uses: actions/checkout@v4
3269

33-
- name: Install CMake, lcov, gfortran on Linux
70+
- name: Install lcov, compilers on Linux
3471
if: runner.os == 'Linux'
3572
run: |
3673
sudo apt-get update
37-
sudo apt-get install -y cmake lcov gfortran
74+
sudo apt-get install -y lcov gfortran ${{ matrix.compiler }}
75+
76+
- name: Install default CMake
77+
if: runner.os == 'Linux' && matrix.cmake_version == 'default'
78+
run: |
79+
sudo apt-get update
80+
sudo apt-get install -y cmake
81+
82+
- name: Install specific CMake version
83+
if: runner.os == 'Linux' && matrix.cmake_version != 'default'
84+
run: |
85+
sudo apt-get update
86+
sudo apt-get install -y wget
87+
wget https://github.com/Kitware/CMake/releases/download/v${{ matrix.cmake_version }}/cmake-${{ matrix.cmake_version }}-linux-x86_64.tar.gz
88+
tar -xzf cmake-${{ matrix.cmake_version }}-linux-x86_64.tar.gz --strip-components=1 -C cmake
89+
sudo cp -r cmake/* /usr/local/
3890
3991
- name: Install CMake, lcov on macOS
4092
if: runner.os == 'macOS'
4193
run: |
4294
brew update
4395
brew install cmake lcov
4496
97+
- name: Print CMake version
98+
run: cmake --version
99+
45100
- name: Configure and build
46101
run: |
47102
mkdir build && cd build
48-
cmake .. -DENABLE_COVERAGE=On
49-
make
50-
make gcov lcov test
51-
52-
- name: lcov report
53-
uses: actions/upload-artifact@v4
54-
with:
55-
name: code-coverage-report
56-
path: ./build/lcov
103+
cmake .. -DCMAKE_C_COMPILER="${{ matrix.compiler }}" -G "${{ matrix.generator }}" -DENABLE_COVERAGE=On
104+
cmake --build .
105+
cmake --build . --target test
106+
cmake --build . --target gcov
107+
cmake --build . --target lcov
57108
109+
# - name: Codecov upload
110+
# uses: codecov/codecov-action@v5
111+
# with:
112+
# name: codecov-coverage
113+
# token: ${{ secrets.CODECOV_TOKEN }}
114+
# fail_ci_if_error: true

0 commit comments

Comments
 (0)