Skip to content

Update cmake.yml

Update cmake.yml #164

Workflow file for this run

name: CMake
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release
jobs:
build:
# The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac.
# You can convert this to a matrix build if you need cross-platform coverage.
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
persist-credentials: false
- uses: actions/setup-node@v4
- uses: mpi4py/setup-mpi@v1
- name: Install libtclap-dev
run: sudo apt-get install -y libtclap-dev catch2
- name: Configure CMake
run: cmake -DCMAKE_CXX_FLAGS="--coverage -g" -DMATOOLS_TESTING=ON -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
- name: Build
# Build your program with the given configuration
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
- name: Test
working-directory: ${{github.workspace}}/build
run: ctest -C --rerun-failed --output-on-failure ${{env.BUILD_TYPE}}
- name: Configure CMake no MPI
run: cmake -DCMAKE_CXX_FLAGS="--coverage -g" -DMATOOLS_MPI=OFF -DMATOOLS_TESTING=ON -B ${{github.workspace}}/build-no-mpi -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
- name: Build no MPI
# Build your program with the given configuration
run: cmake --build ${{github.workspace}}/build-no-mpi --config ${{env.BUILD_TYPE}}
- name: Test no MPI
working-directory: ${{github.workspace}}/build-no-mpi
run: ctest -C --rerun-failed --output-on-failure ${{env.BUILD_TYPE}}
- name: Generate a code coverage report
uses: threeal/gcovr-action@v1.0.0
with:
root: ${{github.workspace}}
- name: Code Coverage Report
uses: irongut/CodeCoverageSummary@v1.3.0
with:
filename: coverage.xml
badge: true
fail_below_min: true
format: markdown
hide_branch_rate: false
hide_complexity: true
indicators: true
output: both
thresholds: '60 80'
- name: Generate a code coverage report
run: gcovr --html-details coverage.html && gcovr --html-nested coverage.html