1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
|
name: Coverage
concurrency:
group: ${{ github.workflow }}#${{ github.ref }}
cancel-in-progress: true
on:
push:
branches:
- master
- live-debug*
- release/**
pull_request:
branches:
- master
- release/**
env:
CMAKE_BUILD_PARALLEL_LEVEL: 3
CTEST_PARALLEL_LEVEL: 1
DESIRED_CMAKE_VERSION: 3.15.0
PYTHON_VERSION: 3.8
jobs:
coverage:
runs-on: ubuntu-20.04
name: "Coverage Test"
steps:
- name: Setup cmake
uses: jwlawson/actions-setup-cmake@v1
with:
cmake-version: ${{ env.DESIRED_CMAKE_VERSION }}
- name: Install packages
run: |
sudo apt-get install bison ccache flex lcov libfl-dev ninja-build \
python3-dev python3-pip
shell: bash
- name: Set up Python3
uses: actions/setup-python@v3
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install Python3 dependencies
run: |
pip3 install -U pip setuptools scikit-build Jinja2 PyYAML pytest sympy
- uses: actions/checkout@v3
with:
fetch-depth: 2
- name: Restore compiler cache
uses: actions/cache@v3
with:
path: |
${{runner.workspace}}/ccache
key: cov-${{github.ref}}-${{github.sha}}
restore-keys: |
cov-${{github.ref}}-
cov-
- name: Build and Test for Coverage
id: codecov
shell: bash
working-directory: ${{runner.workspace}}/nmodl
run: |
mkdir build && cd build
cmake .. -G Ninja \
-DPYTHON_EXECUTABLE=$(which python3) \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_CXX_FLAGS="-coverage" \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache
ccache -z
ccache -s
cmake --build .
ccache -s
(cd ..; lcov --capture --initial --directory . --no-external --output-file build/coverage-base.info)
ctest --output-on-failure
(cd ..; lcov --capture --directory . --no-external --output-file build/coverage-run.info)
lcov --add-tracefile coverage-base.info --add-tracefile coverage-run.info --output-file coverage-full.info
lcov --remove coverage-full.info --output-file coverage.info "*/ext/*"
lcov --list coverage.info
env:
CCACHE_DIR: ${{runner.workspace}}/ccache
- uses: codecov/codecov-action@v3
with:
files: ./build/coverage.info
fail_ci_if_error: true
verbose: true
token: ${{ secrets.CODECOV_TOKEN }}
|