.github/workflows/build.yml

Summary

Maintainability
Test Coverage
name: build

on: [push, pull_request]

jobs:
  build:

    strategy:
      fail-fast: false
      matrix:
        include:
        - os: ubuntu-latest
          python-version: 3.9
          install: ''
          flags: '--coverage'
          tests: RMF
          build: Debug
        - os: ubuntu-latest
          python-version: 3.9
          install: ''
          flags: '--coverage'
          tests: RMF
          build: Release
        - os: ubuntu-latest
          python-version: 3.9
          install: 'libhdf5-dev liblog4cxx-dev'
          flags: '--coverage'
          tests: RMF
          build: Debug
        - os: macos-latest
          python-version: 3.9
          install: ''
          flags: '--coverage'
          tests: RMF
          build: Release
    runs-on: ${{ matrix.os }}

    steps:
    - uses: actions/checkout@v4
    - name: Set up Python ${{ matrix.python-version }}
      uses: actions/setup-python@v5
      with:
        python-version: ${{ matrix.python-version }}
    - name: Install dependencies (Linux)
      if: matrix.os == 'ubuntu-latest'
      run: |
        sudo apt-get update -qq
        sudo apt-get install -qq libboost-all-dev swig libc-dbg ${{ matrix.install }}
        pip install coverage
    - name: Install dependencies (Mac)
      if: matrix.os == 'macos-latest'
      run: |
        brew install swig boost log4cxx ${{ matrix.install }}
        pip install coverage numpy
    - name: Build and test
      run: |
        mkdir build
        cd build
        ../tools/coverage/setup.py
        PYTHONPATH=`pwd`/coverage cmake .. -DCMAKE_BUILD_TYPE="${{ matrix.build }}" -DCMAKE_CXX_FLAGS="${{ matrix.flags }}" -DCMAKE_EXE_LINKER_FLAGS="${{ matrix.flags }}" -DCMAKE_MODULE_LINKER_FLAGS="${{ matrix.flags }}" -DCMAKE_SHARED_LINKER_FLAGS="${{ matrix.flags }}"
        make -j 2
        ctest -j 2 --output-on-failure -L ${{ matrix.tests }}
    - name: Combine coverage
      run: |
        cd build/coverage
        coverage combine && mv .coverage ../..
    - uses: codecov/codecov-action@v1