|
| 1 | +# SPDX-FileCopyrightText: 2006-2024 Knut Reinert & Freie Universität Berlin |
| 2 | +# SPDX-FileCopyrightText: 2016-2024 Knut Reinert & MPI für molekulare Genetik |
| 3 | +# SPDX-License-Identifier: CC0-1.0 |
| 4 | + |
| 5 | +name: Coverage |
| 6 | + |
| 7 | +on: |
| 8 | + push: |
| 9 | + branches: |
| 10 | + - 'main' |
| 11 | + pull_request: |
| 12 | + types: |
| 13 | + - unlabeled |
| 14 | + workflow_dispatch: |
| 15 | + |
| 16 | +concurrency: |
| 17 | + group: coverage-${{ github.event.pull_request.number || github.ref }} |
| 18 | + cancel-in-progress: ${{ github.event_name != 'push' }} |
| 19 | + |
| 20 | +env: |
| 21 | + SEQAN3_NO_VERSION_CHECK: 1 |
| 22 | + TZ: Europe/Berlin |
| 23 | + |
| 24 | +defaults: |
| 25 | + run: |
| 26 | + shell: bash -Eeuxo pipefail {0} |
| 27 | + |
| 28 | +jobs: |
| 29 | + build: |
| 30 | + runs-on: ubuntu-latest |
| 31 | + name: ${{ matrix.compiler }} |
| 32 | + if: github.repository_owner == 'seqan' || github.event_name == 'workflow_dispatch' || github.event.label.name == 'lint' |
| 33 | + strategy: |
| 34 | + fail-fast: false |
| 35 | + matrix: |
| 36 | + compiler: ["gcc-14"] |
| 37 | + container: |
| 38 | + image: ghcr.io/seqan/${{ matrix.compiler }} |
| 39 | + volumes: |
| 40 | + - /home/runner:/home/runner |
| 41 | + steps: |
| 42 | + - name: Checkout |
| 43 | + uses: actions/checkout@v4 |
| 44 | + with: |
| 45 | + fetch-depth: 0 |
| 46 | + |
| 47 | + - name: Load ccache |
| 48 | + uses: actions/cache@v4 |
| 49 | + with: |
| 50 | + path: /home/runner/.ccache |
| 51 | + save-always: true |
| 52 | + key: ccache-${{ runner.os }}-${{ github.workflow }}-${{ matrix.compiler }}-${{ github.ref }} |
| 53 | + |
| 54 | + - name: Configure tests |
| 55 | + run: | |
| 56 | + mkdir build && cd build |
| 57 | + cmake .. -DCMAKE_BUILD_TYPE=Coverage |
| 58 | + make gtest_main |
| 59 | +
|
| 60 | + - name: Build tests |
| 61 | + working-directory: build |
| 62 | + run: | |
| 63 | + ccache -z |
| 64 | + make -k tests |
| 65 | + ccache -svvx |
| 66 | +
|
| 67 | + - name: Run tests |
| 68 | + working-directory: build |
| 69 | + run: ctest . -j --output-on-failure |
| 70 | + |
| 71 | + - name: Generate coverage report |
| 72 | + run: | |
| 73 | + gcovr --root ${GITHUB_WORKSPACE} \ |
| 74 | + ${GITHUB_WORKSPACE}/build \ |
| 75 | + --filter ${GITHUB_WORKSPACE}/include \ |
| 76 | + --filter ${GITHUB_WORKSPACE}/src \ |
| 77 | + --exclude-lines-by-pattern '^\s*$' \ |
| 78 | + --exclude-lines-by-pattern '^\s*};$' \ |
| 79 | + --exclude-lines-by-pattern '^\s*\.[^\s]* = .*[\n,]$' \ |
| 80 | + --exclude-lines-by-pattern '^\s*\.[^\s]* = .*}\);$' \ |
| 81 | + --exclude-lines-by-pattern '^\s*\.[^\s]* =(\s+\".*\")+' \ |
| 82 | + --exclude-unreachable-branches \ |
| 83 | + --exclude-throw-branches \ |
| 84 | + --exclude-noncode-lines \ |
| 85 | + -j \ |
| 86 | + --cobertura \ |
| 87 | + --output ${GITHUB_WORKSPACE}/build/coverage_report.xml |
| 88 | +
|
| 89 | + - name: Submit coverage report |
| 90 | + |
| 91 | + with: |
| 92 | + files: build/coverage_report.xml |
| 93 | + fail_ci_if_error: false |
0 commit comments