Skip to content

Commit a5cd7e2

Browse files
committed
Add codecov step
1 parent 6415219 commit a5cd7e2

File tree

1 file changed

+72
-14
lines changed

1 file changed

+72
-14
lines changed

.github/workflows/ci.yml

Lines changed: 72 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,39 +19,97 @@ 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]
25+
os: [ubuntu-24.04]
2426
compiler: [gcc, clang]
27+
generator: [Ninja, Unix Makefiles]
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+
40+
# Additionally test Ubuntu and macOS with default packages
41+
include:
42+
- os: ubuntu-22.04
43+
cmake_version: default
44+
generator: Unix Makefiles
2745
compiler: gcc
28-
46+
- os: ubuntu-22.04
47+
cmake_version: default
48+
generator: Unix Makefiles
49+
compiler: clang
50+
- os: ubuntu-22.04
51+
cmake_version: default
52+
generator: Ninja
53+
compiler: gcc
54+
- os: ubuntu-22.04
55+
cmake_version: default
56+
generator: Ninja
57+
compiler: clang
58+
- os: macos-latest
59+
compiler: clang
60+
cmake_version: default
61+
generator: Unix Makefiles
62+
- os: macos-latest
63+
compiler: clang
64+
cmake_version: default
65+
generator: Ninja
66+
2967
steps:
3068
- name: Checkout code
3169
uses: actions/checkout@v4
3270

33-
- name: Install CMake, lcov, gfortran on Linux
71+
- name: Install lcov, compilers on Linux
3472
if: runner.os == 'Linux'
3573
run: |
3674
sudo apt-get update
37-
sudo apt-get install -y cmake lcov gfortran
75+
sudo apt-get install -y lcov gfortran ${{ matrix.compiler }}
76+
77+
- name: Install default CMake
78+
if: runner.os == 'Linux' && matrix.cmake_version == 'default'
79+
run: |
80+
sudo apt-get update
81+
sudo apt-get install -y cmake
82+
83+
- name: Install specific CMake version
84+
if: runner.os == 'Linux' && matrix.cmake_version != 'default'
85+
run: |
86+
sudo apt-get update
87+
sudo apt-get install -y wget
88+
wget https://github.com/Kitware/CMake/releases/download/v${{ matrix.cmake_version }}/cmake-${{ matrix.cmake_version }}-linux-x86_64.tar.gz
89+
tar -xzf cmake-${{ matrix.cmake_version }}-linux-x86_64.tar.gz --strip-components=1 -C cmake
90+
sudo cp -r cmake/* /usr/local/
3891
3992
- name: Install CMake, lcov on macOS
4093
if: runner.os == 'macOS'
4194
run: |
4295
brew update
4396
brew install cmake lcov
4497
98+
- name: Print CMake version
99+
run: cmake --version
100+
45101
- name: Configure and build
46102
run: |
47103
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
104+
cmake .. -DCMAKE_C_COMPILER="${{ matrix.compiler }}" -G "${{ matrix.generator }}" -DENABLE_COVERAGE=On
105+
cmake --build .
106+
cmake --build . --target test
107+
cmake --build . --target gcov
108+
cmake --build . --target lcov
57109
110+
# - name: Codecov upload
111+
# uses: codecov/codecov-action@v5
112+
# with:
113+
# name: codecov-coverage
114+
# token: ${{ secrets.CODECOV_TOKEN }}
115+
# fail_ci_if_error: true

0 commit comments

Comments
 (0)