2020-03-13 22:42:15 +01:00
|
|
|
# Syntax reference https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions
|
|
|
|
# Environment reference https://help.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners
|
|
|
|
name: Coverage
|
|
|
|
|
2021-02-25 20:14:50 +01:00
|
|
|
on: [push, pull_request]
|
2020-03-13 22:42:15 +01:00
|
|
|
|
2022-08-26 23:25:07 +02:00
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
|
2020-03-13 22:42:15 +01:00
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
|
2022-05-31 19:55:57 +02:00
|
|
|
runs-on: ubuntu-22.04
|
2020-03-13 22:42:15 +01:00
|
|
|
|
|
|
|
steps:
|
2022-10-11 19:50:59 +02:00
|
|
|
- uses: actions/checkout@v3
|
2020-03-13 22:42:15 +01:00
|
|
|
|
2022-09-03 21:21:24 +02:00
|
|
|
- name: ccache
|
|
|
|
uses: hendrikmuhs/ccache-action@v1.2
|
|
|
|
with:
|
|
|
|
key: ${{ github.workflow }}-${{ runner.os }}
|
|
|
|
|
2020-03-13 22:42:15 +01:00
|
|
|
- name: Install missing software on ubuntu
|
|
|
|
run: |
|
2020-04-07 20:23:54 +02:00
|
|
|
sudo apt-get update
|
2022-09-04 10:25:59 +02:00
|
|
|
sudo apt-get install libxml2-utils lcov
|
|
|
|
|
|
|
|
- name: Install missing Python packages on ubuntu
|
|
|
|
run: |
|
2021-02-20 13:26:28 +01:00
|
|
|
python -m pip install pip --upgrade
|
|
|
|
python -m pip install lcov_cobertura
|
2020-03-13 22:42:15 +01:00
|
|
|
|
|
|
|
- name: Compile instrumented
|
|
|
|
run: |
|
2022-09-03 21:21:24 +02:00
|
|
|
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
|
2022-09-04 10:25:59 +02:00
|
|
|
make -j$(nproc) all CXXFLAGS="-g -fprofile-arcs -ftest-coverage" HAVE_RULES=yes
|
|
|
|
|
|
|
|
- name: Run instrumented tests
|
2020-03-13 22:42:15 +01:00
|
|
|
run: |
|
|
|
|
./testrunner
|
|
|
|
test/cfg/runtests.sh
|
2022-09-04 10:25:59 +02:00
|
|
|
|
|
|
|
- name: Generate coverage report
|
|
|
|
run: |
|
2020-03-13 22:42:15 +01:00
|
|
|
gcov lib/*.cpp -o lib/
|
|
|
|
lcov --directory ./ --capture --output-file lcov_tmp.info -b ./
|
|
|
|
lcov --extract lcov_tmp.info "$(pwd)/*" --output-file lcov.info
|
|
|
|
genhtml lcov.info -o coverage_report --frame --legend --demangle-cpp
|
|
|
|
|
2022-10-11 19:50:59 +02:00
|
|
|
- uses: actions/upload-artifact@v3
|
2020-03-13 22:42:15 +01:00
|
|
|
with:
|
|
|
|
name: Coverage results
|
|
|
|
path: coverage_report
|
|
|
|
|
2022-09-24 08:21:51 +02:00
|
|
|
- uses: codecov/codecov-action@v3
|
2020-03-13 22:42:15 +01:00
|
|
|
with:
|
2020-04-19 11:04:02 +02:00
|
|
|
# token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos
|
2020-03-13 22:42:15 +01:00
|
|
|
# file: ./coverage.xml # optional
|
|
|
|
flags: unittests # optional
|
|
|
|
name: ${{ github.repository }} # optional
|
|
|
|
fail_ci_if_error: true # optional (default = false):
|