Skip to content

Commit d12c6e3

Browse files
authored
chore: Add a daily coverage run (#1437)
* Add a coverage workflow to dragonfly. * Try and make the testing permissive * Apply suggestions from code review Signed-off-by: Roy Jacobson <[email protected]> * Remove redundant parts --------- Signed-off-by: Roy Jacobson <[email protected]>
1 parent 898061d commit d12c6e3

File tree

1 file changed

+85
-0
lines changed

1 file changed

+85
-0
lines changed

.github/workflows/cov.yml

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
name: Daily Coverage
2+
3+
on:
4+
schedule:
5+
- cron: '0 6 * * *' # run at 6 AM UTC
6+
workflow_dispatch:
7+
8+
jobs:
9+
build:
10+
# The CMake configure and build commands are platform agnostic and should work equally
11+
# well on Windows or Mac. You can convert this to a matrix build if you need
12+
# cross-platform coverage.
13+
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
14+
runs-on: ubuntu-latest
15+
strategy:
16+
matrix:
17+
include:
18+
- container: "ubuntu-dev:20"
19+
build-type: Release
20+
compiler: {cxx: g++, c: gcc}
21+
cxx_flags: "-fprofile-arcs -ftest-coverage"
22+
timeout-minutes: 60
23+
container:
24+
image: ghcr.io/romange/${{ matrix.container }}
25+
credentials:
26+
username: ${{ github.repository_owner }}
27+
password: ${{ secrets.GITHUB_TOKEN }}
28+
29+
steps:
30+
- uses: actions/checkout@v3
31+
with:
32+
submodules: true
33+
- name: Install dependencies
34+
run: |
35+
uname -a
36+
cmake --version
37+
mkdir -p ${{github.workspace}}/build
38+
apt update && apt install -y lcov pip
39+
- name: Cache build deps
40+
id: cache-deps
41+
uses: actions/cache@v3
42+
with:
43+
path: |
44+
~/.ccache
45+
${{github.workspace}}/build/_deps
46+
key: ${{ runner.os }}-deps-${{ github.base_ref }}-${{ github.sha }}
47+
restore-keys: |
48+
${{ runner.os }}-deps-${{ github.base_ref }}-
49+
50+
- name: Configure CMake
51+
run: |
52+
pip install -r tests/dragonfly/requirements.txt
53+
cmake -B build \
54+
-DCMAKE_BUILD_TYPE=${{matrix.build-type}} \
55+
-GNinja \
56+
-DCMAKE_C_COMPILER="${{matrix.compiler.c}}" \
57+
-DCMAKE_CXX_COMPILER="${{matrix.compiler.cxx}}" \
58+
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
59+
-DCMAKE_CXX_FLAGS="${{matrix.cxx_flags}}" \
60+
-L
61+
pwd
62+
cd build && pwd
63+
- name: Build & Test Coverage
64+
run: |
65+
cd $GITHUB_WORKSPACE/build
66+
ninja
67+
68+
# Be permissive with errors, we hit compiler bugs from time to time.
69+
ninja test || true
70+
71+
export DRAGONFLY_PATH=`pwd`/dragonfly
72+
pytest ../tests/dragonfly/ || true
73+
74+
lcov -c -d . -o main_coverage.info
75+
lcov --remove main_coverage.info -o main_coverage.info '/usr/*' '*/_deps/*' '*/third_party/*'
76+
genhtml main_coverage.info --ignore-errors source --output-directory covout -p $GITHUB_WORKSPACE
77+
ls ./
78+
echo ls covout
79+
ls covout/
80+
- name: Upload coverage
81+
uses: actions/upload-artifact@v3
82+
with:
83+
name: coverage-report
84+
path: build/covout/
85+
if-no-files-found: error

0 commit comments

Comments
 (0)