Demystify default Auto setting #141
This file contains 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
name: 'coverage' | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
skip_duplicate: | |
name: 'Skip Job?' | |
continue-on-error: true | |
runs-on: ubuntu-latest | |
steps: | |
- id: skip_check | |
uses: fkirc/skip-duplicate-actions@master | |
with: | |
paths: '["src/adiar/**", "test/**"]' | |
outputs: | |
should_skip: ${{ github.event_name == 'pull_request' && steps.skip_check.outputs.should_skip == 'true' }} | |
test: | |
name: 'Build + Test (incl. code coverage)' | |
runs-on: ubuntu-latest | |
needs: skip_duplicate | |
if: ${{ needs.skip_duplicate.outputs.should_skip != 'true' && (github.event.type != 'PullRequestEvent' || github.event.pull_request.draft != true) }} | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
submodules: 'recursive' | |
- name: Apt | install boost aptitude graphviz lcov | |
run: | | |
sudo apt update | |
sudo apt install libboost-all-dev graphviz lcov | |
- name: CMake | mkdir build | |
run: cmake -E make_directory ${{runner.workspace}}/build | |
- name: CMake | configure | |
working-directory: ${{runner.workspace}}/build | |
env: | |
C_FLAGS: "-g -O0 -Wall -fprofile-arcs -ftest-coverage" | |
EXE_LINKER_FLAGS: "-fprofile-arcs -ftest-coverage" | |
run: cmake $GITHUB_WORKSPACE -D CMAKE_BUILD_TYPE=DEBUG -D CMAKE_C_FLAGS="${C_FLAGS}" -D CMAKE_CXX_FLAGS="${C_FLAGS}" -D CMAKE_EXE_LINKER_FLAGS="${EXE_LINKER_FLAGS}" -D ADIAR_STATS=ON .. | |
- name: CMake | build unit tests | |
working-directory: ${{runner.workspace}}/build | |
run: cmake --build . --target test-adiar | |
- name: Run unit tests | |
working-directory: ${{runner.workspace}}/build | |
run: ./test/test-adiar --reporter=info --colorizer=light | |
- name: Generate code coverage report | |
working-directory: ${{runner.workspace}} | |
if: always() | |
run: | | |
lcov -c -d build/ -o ./coverage.info | |
lcov --remove coverage.info --output-file coverage.info "/usr/*" "*/external/*" "./test/*" | |
- name: Upload report to Codecov.io | |
working-directory: ${{runner.workspace}} | |
if: always() | |
run: bash <(curl -s https://codecov.io/bash) -f coverage.info -t ${{ secrets.CODECOV_TOKEN }} || echo "Codecov did not collect coverage reports" | |
test_dummy: | |
name: 'Unit test (incl. code coverage)' | |
runs-on: ubuntu-latest | |
needs: skip_duplicate | |
if: ${{ needs.skip_duplicate.outputs.should_skip == 'true' || (github.event.type == 'PullRequestEvent' && github.event.pull_request.draft == true) }} | |
steps: | |
- name: Echo skip | |
run: | | |
echo "Running unit tests is skipped" |