name: Testing

on:
  push:
  pull_request:

jobs:
  build:
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [ubuntu-latest, macos-latest, windows-latest]

    steps:
    - uses: actions/checkout@v2

    - name: Configure
      run: |
        cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Debug

    - name: Build
      run: |
        cmake --build build --config Debug

    - name: Test
      run: |
        cd build
        ctest -C Debug --output-on-failure --verbose

        echo ">>> Run coverage analysis"
        if [ "${{ matrix.os }}" == "ubuntu-latest" ]; then
           ctest -T coverage
        fi


    - name: Upload code coverage to coveralls
      if: contains(matrix.os, 'ubuntu')
      uses: coverallsapp/github-action@master
      with:
        github-token: ${{ secrets.GITHUB_TOKEN }}
        path-to-lcov: ./build/coverage.info

name: Testing

on:
  push:
  pull_request:

jobs:
  build:
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [ubuntu-latest, macos-latest, windows-latest]
    defaults:
      run:
        shell: bash -l {0}

    steps:
    - uses: actions/checkout@v2

    - name: Configure
      run: |
        cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Debug

    - name: Build
      run: |
        cmake --build build --config Debug

    - name: Test
      run: |
        cd build
        ctest -C Debug --output-on-failure --verbose

    - name: Setup python
      uses: actions/setup-python@v2
      with:
        python-version: 3.8

    - name: Upload code coverage to coveralls
      if: contains(matrix.os, 'ubuntu')
      run: |
        python -m venv foo
        source foo/bin/activate
        pip install --upgrade pip setuptools cpp-coveralls
        coveralls --root . -E ".*CMakeFiles.*" -E ".*test/.*.cpp.*"

Set bash as default shell
Set bash as default shell
