From f7c2beff67ec1e59a51c81b2c3337546a5f57434 Mon Sep 17 00:00:00 2001 From: Simon Schwitanski Date: Sat, 3 May 2025 10:49:43 +0200 Subject: [PATCH 1/6] Add Github action workflow --- .github/workflows/ci.yml | 50 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) 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..4857525 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,50 @@ +# This file is part of CMake-codecov. +# +# Copyright (c) +# 2015-2020 RWTH Aachen University, Federal Republic of Germany +# +# See the LICENSE file in the package base directory for details +# +# Written by Alexander Haase, alexander.haase@rwth-aachen.de +# + +name: CMake-codecov CI +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + build: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-20.04, ubuntu-22.04, macos-latest] + compiler: [gcc, clang] + exclude: + - os: macos-latest + compiler: gcc + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Install CMake, lcov, gfortran on Linux + if: runner.os == 'Linux' + run: | + sudo apt-get update + sudo apt-get install -y cmake lcov gfortran + + - name: Install CMake, lcov on macOS + if: runner.os == 'macOS' + run: | + brew update + brew install cmake lcov gfortran + + - name: Configure and build + run: | + mkdir build && cd build + cmake .. -DENABLE_COVERAGE=On + make + make gcov lcov test From b7c08784040b399ca7951e8d9f4e12f216469307 Mon Sep 17 00:00:00 2001 From: Simon Schwitanski Date: Sat, 3 May 2025 10:51:58 +0200 Subject: [PATCH 2/6] Remove travis CI config --- .travis.yml | 63 ----------------------------------------------------- 1 file changed, 63 deletions(-) delete mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 1a81ea8..0000000 --- a/.travis.yml +++ /dev/null @@ -1,63 +0,0 @@ -# This file is part of CMake-codecov. -# -# Copyright (c) -# 2015-2020 RWTH Aachen University, Federal Republic of Germany -# -# See the LICENSE file in the package base directory for details -# -# Written by Alexander Haase, alexander.haase@rwth-aachen.de -# - -language: c - -matrix: - include: - - os: linux - dist: xenial - compiler: gcc - - os: linux - dist: xenial - compiler: clang - - - os: linux - dist: bionic - compiler: gcc - - os: linux - dist: bionic - compiler: clang - - - os: osx - compiler: clang - - -addons: - apt: - packages: - - cmake - - lcov - - gfortran - - -before_install: - - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; - then - brew update --quiet >& /dev/null; - fi - # The following solution was inspired by http://stackoverflow.com/a/20802381 - - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; - then - for pkg in gcc cmake lcov; do - if brew list -1 | grep -q "^${pkg}\$"; then - brew outdated $pkg || brew upgrade $pkg; - else - brew install $pkg; - fi - done - fi - -script: - - mkdir build && cd build - - cmake .. -DENABLE_COVERAGE=On && make && make test gcov lcov - -after_success: - - bash <(curl -s https://codecov.io/bash) -X gcov From 0fc1c9bf16d5caaa8def290a7fbdc1dcdec61436 Mon Sep 17 00:00:00 2001 From: Simon Schwitanski Date: Sat, 3 May 2025 10:53:00 +0200 Subject: [PATCH 3/6] Update Ubuntu versions --- .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 4857525..bf646f4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,7 +20,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ubuntu-20.04, ubuntu-22.04, macos-latest] + os: [ubuntu-22.04, ubuntu-24.04, macos-latest] compiler: [gcc, clang] exclude: - os: macos-latest From 0e35320542ca245d88dbf8d518fb34a0a14c0204 Mon Sep 17 00:00:00 2001 From: Simon Schwitanski Date: Sat, 3 May 2025 11:07:20 +0200 Subject: [PATCH 4/6] Remov gfortran from Mac build --- .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 bf646f4..ce3589f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -40,7 +40,7 @@ jobs: if: runner.os == 'macOS' run: | brew update - brew install cmake lcov gfortran + brew install cmake lcov - name: Configure and build run: | From 64152194843184b47b55929e6f1b3b34dbd9ab35 Mon Sep 17 00:00:00 2001 From: Simon Schwitanski Date: Sat, 3 May 2025 17:29:43 +0200 Subject: [PATCH 5/6] Upload lcov report --- .github/workflows/ci.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ce3589f..d18c632 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -48,3 +48,10 @@ jobs: cmake .. -DENABLE_COVERAGE=On make make gcov lcov test + + - name: lcov report + uses: actions/upload-artifact@v4 + with: + name: code-coverage-report + path: ./build/lcov + From 1f9ba4a9859a46274781f158bd95aa346a8fb6fa Mon Sep 17 00:00:00 2001 From: Simon Schwitanski Date: Sat, 3 May 2025 18:13:13 +0200 Subject: [PATCH 6/6] Add codecov step --- .github/workflows/ci.yml | 85 +++++++++++++++++++++++++++++++++------- 1 file changed, 71 insertions(+), 14 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d18c632..7e36538 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,22 +19,74 @@ jobs: build: runs-on: ${{ matrix.os }} strategy: + fail-fast: false matrix: - os: [ubuntu-22.04, ubuntu-24.04, macos-latest] + 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] compiler: [gcc, clang] + generator: [Ninja, Unix Makefiles] + os: [ubuntu-24.04] + # CMake-Codecov relies on compiling with absolute paths, but CMake uses absolute paths + # with Ninja only starting with 3.21, so exclude older (non-supported) versions exclude: - - os: macos-latest + - cmake_version: 3.20.6 + generator: Ninja + - cmake_version: 3.16.9 + generator: Ninja + - cmake_version: 3.12.4 + generator: Ninja + - cmake_version: 3.10.3 + generator: Ninja + # Additionally test Ubuntu and macOS with default packages + include: + - os: ubuntu-22.04 + cmake_version: default + generator: Unix Makefiles + compiler: gcc + - os: ubuntu-22.04 + cmake_version: default + generator: Unix Makefiles + compiler: clang + - os: ubuntu-22.04 + cmake_version: default + generator: Ninja compiler: gcc - + - os: ubuntu-22.04 + cmake_version: default + generator: Ninja + compiler: clang + - os: macos-latest + compiler: clang + cmake_version: default + generator: Unix Makefiles + - os: macos-latest + compiler: clang + cmake_version: default + generator: Ninja + steps: - name: Checkout code uses: actions/checkout@v4 - - name: Install CMake, lcov, gfortran on Linux + - name: Install lcov, compilers on Linux if: runner.os == 'Linux' run: | sudo apt-get update - sudo apt-get install -y cmake lcov gfortran + sudo apt-get install -y lcov gfortran ${{ matrix.compiler }} + + - name: Install default CMake + if: runner.os == 'Linux' && matrix.cmake_version == 'default' + run: | + sudo apt-get update + sudo apt-get install -y cmake + + - name: Install specific CMake version + if: runner.os == 'Linux' && matrix.cmake_version != 'default' + run: | + sudo apt-get update + sudo apt-get install -y wget + wget https://github.com/Kitware/CMake/releases/download/v${{ matrix.cmake_version }}/cmake-${{ matrix.cmake_version }}-linux-x86_64.tar.gz + tar -xzf cmake-${{ matrix.cmake_version }}-linux-x86_64.tar.gz --strip-components=1 -C cmake + sudo cp -r cmake/* /usr/local/ - name: Install CMake, lcov on macOS if: runner.os == 'macOS' @@ -42,16 +94,21 @@ jobs: brew update brew install cmake lcov + - name: Print CMake version + run: cmake --version + - name: Configure and build run: | mkdir build && cd build - cmake .. -DENABLE_COVERAGE=On - make - make gcov lcov test - - - name: lcov report - uses: actions/upload-artifact@v4 - with: - name: code-coverage-report - path: ./build/lcov + cmake .. -DCMAKE_C_COMPILER="${{ matrix.compiler }}" -G "${{ matrix.generator }}" -DENABLE_COVERAGE=On + cmake --build . + cmake --build . --target test + cmake --build . --target gcov + cmake --build . --target lcov + # - name: Codecov upload + # uses: codecov/codecov-action@v5 + # with: + # name: codecov-coverage + # token: ${{ secrets.CODECOV_TOKEN }} + # fail_ci_if_error: true \ No newline at end of file