name: Upload CodeCov Report

on:
  pull_request_target:
    branches:
      - master
      - cpp20

jobs:
  build:
  
    runs-on: ubuntu-latest

    steps:
    - name: Checkout Code
      uses: actions/checkout@v2
      with:
        fetch-depth: 2
    
    - name: Configure cmake
      run:  cmake -B${{github.workspace}}/build -DCOVERAGE_TEST=ON -DCINATRA_ENABLE_SSL=OFF -DCMAKE_BUILD_TYPE=Debug

    - name: Build with ${{matrix.compiler}}
      run:  cmake --build ${{github.workspace}}/build --config Debug
      
    - name: Test
      working-directory: ${{github.workspace}}/build
      env:
        CTEST_OUTPUT_ON_FAILURE: 1
      run: ctest -C ${{ matrix.configuration }} -j `nproc` -V
    
    - name: Upload coverage to Codecov
      uses: codecov/codecov-action@v1
