Merge pull request #403 from clEsperanto/dependabot/github_actions/co… #1380
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: Tests | |
on: | |
push: | |
branches: [master] | |
pull_request: | |
branches: [master] | |
jobs: | |
build: | |
name: ${{ matrix.os }}-${{ matrix.buildtype }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
max-parallel: 1 | |
matrix: | |
buildtype: [Debug] | |
os: [macos-13] #, macos-latest] | |
cxx: [clang++] | |
cc: [clang] | |
packages: [lcov gcovr] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install packages | |
shell: bash | |
run: | | |
brew install ${{ matrix.packages }} | |
- name: Cmake configure | |
shell: bash | |
run: | | |
cmake -S ${{ github.workspace }} -B ${{ runner.workspace }}/build -DCMAKE_BUILD_TYPE=${{ matrix.buildtype }} -DBUILD_COVERAGE=ON -DBUILD_BENCHMARK=OFF | |
- name: Cmake build | |
shell: bash | |
run: | | |
cmake --build "${{ runner.workspace }}/build" --parallel 10 --config ${{ matrix.buildtype }} | |
- name: Generate coverage | |
shell: bash | |
run: | | |
cd ${{ runner.workspace }}/build && ctest -C ${{ matrix.buildtype }} --output-on-failure | |
- name: Format coverage | |
shell: bash | |
run: | | |
cd ${{ runner.workspace }}/build | |
gcovr -r . --filter='.*/clic/src/.*' --exclude-throw-branches --exclude-unreachable-branches --xml -o coverage.xml | |
# lcov --base-directory . --directory . --capture --output-file coverage.info | |
# lcov --remove coverage.info '/usr/*' "${HOME}"'/.cache/*' ''*/deps_/*' --output-file coverage.info | |
# lcov --list coverage.info | |
- name: Upload coverage report | |
if: github.actor != 'dependabot[bot]' && github.actor != 'dependabot-preview[bot]' | |
uses: codecov/[email protected] | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos | |
files: ${{ runner.workspace }}/build/coverage.xml | |
fail_ci_if_error: true # optional (default = false) |