Add Github action workflow #19
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-22.04, ubuntu-24.04, macos-latest] | |
compiler: [gcc, clang] | |
generator: [Ninja, Unix Makefiles] | |
cmake_version: [default] | |
exclude: | |
- os: macos-latest | |
compiler: gcc | |
include: | |
- os: ubuntu-22.04 | |
cmake_version: [3.28.3] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Install lcov, compilers on Linux | |
if: runner.os == 'Linux' | |
run: | | |
sudo apt-get update | |
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 | |
https://github.com/Kitware/CMake/releases/download/v${{ matrix.cmake_version }}/cmake-${{ matrix.cmake_version }}-linux-x86_64.tar.gz | |
wget https://cmake.org/files/v${{ matrix.cmake_version }}/cmake-${{ matrix.cmake_version }}-Linux-x86_64.tar.gz | |
tar -xzf cmake-${{ matrix.cmake_version }}-Linux-x86_64.tar.gz | |
sudo cp -r cmake-${{ matrix.cmake_version }}-Linux-x86_64/* /usr/local/ | |
- name: Install CMake, lcov on macOS | |
if: runner.os == 'macOS' | |
run: | | |
brew update | |
brew install cmake lcov | |
- name: Configure and build | |
run: | | |
mkdir build | |
cmake -S . -B build -DCMAKE_C_COMPILER="${{ matrix.compiler }}" -G "${{ matrix.generator }}" -DENABLE_COVERAGE=On | |
cmake --build build | |
cmake --build build --target test | |
cmake --build build --target gcov | |
cmake --build build --target lcov | |
# - name: Codecov upload | |
# uses: codecov/codecov-action@v5 | |
# with: | |
# name: codecov-coverage | |
# token: ${{ secrets.CODECOV_TOKEN }} | |
# fail_ci_if_error: true |