Skip to content

update coverage ci

update coverage ci #2

name: Tests
on:
push:
branches: [master]
pull_request:
branches: [master]
jobs:
build:
name: ${{ matrix.os }}-${{ matrix.buildtype }}-Test-and-Coverage
runs-on: ${{ matrix.os }}
strategy:
max-parallel: 1
matrix:
buildtype: [Debug]
os: [ubuntu-latest]
cxx: [g++]
cc: [gcc]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: true
- name: Install packages
shell: bash
run: |
sudo apt upgrade && sudo apt update
sudo apt install -y ocl-icd-opencl-dev intel-opencl-icd
- 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
# uses: codecov/codecov-action@v3
# with:
# token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos
# files: ${{ runner.workspace }}/build/coverage.info
# fail_ci_if_error: true # optional (default = false)