Refactor GitHub workflow files for improved concurrency handling #195
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: CodeCov | |
on: [push, pull_request, workflow_dispatch] | |
concurrency: | |
# Documentation suggests ${{ github.head_ref }}, but that's only available on pull_request/pull_request_target triggers, so using ${{ github.ref }}. | |
# On master, we want all builds to complete even if merging happens faster to make it easier to discover at which point something broke. | |
group: ${{ github.ref == 'refs/heads/master' && format('ci-master-{0}', github.sha) || format('ci-{0}', github.ref) }} | |
jobs: | |
codecov: | |
name: CodeCov | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Setup | |
run: | | |
sudo apt update | |
sudo apt upgrade | |
sudo apt-get install build-essential automake autoconf autoconf-archive texinfo libtool-bin yasm ninja-build ccache | |
- name: Setup GCC | |
uses: pkgxdev/setup@v1 | |
with: | |
+: gcc@13 | |
- run: gcc --version | |
- name: Restore artifacts or setup vcpkg | |
uses: lukka/run-vcpkg@v11 | |
with: | |
vcpkgGitCommitId: 01acfdfde3ed99280d3883a8fccd5fa4408f5214 | |
- name: Configure | |
run: cmake -G Ninja -D CMAKE_BUILD_TYPE=RelWithDebInfo -D ENABLE_TESTING:BOOL=TRUE -D ENABLE_COVERAGE:BOOL=TRUE -S . -B build | |
- name: Build | |
run: cmake --build build -j 2 | |
- name: Test | |
working-directory: build | |
continue-on-error: true | |
run: ctest --rerun-failed --output-on-failure -j 2 | |
# - name: collect code coverage | |
# run: bash <(curl -s https://codecov.io/bash) || echo "Codecov did not collect coverage reports" | |
- name: Generate coverage info | |
working-directory: build | |
continue-on-error: true | |
run: | | |
mkdir gcov-reports | |
pushd gcov-reports | |
for f in `find ../tests/CMakeFiles/CDT_test.dir -name '*.o'`; do | |
echo "Processing $f file..." | |
gcov -o ${f} x | |
done | |
ls | wc -l | |
popd | |
- name: Submit to codecov.io | |
uses: codecov/codecov-action@v3 | |
with: | |
# directory: build/gcov-reports | |
fail_ci_if_error: false | |
verbose: true | |
gcov: true |