-
Notifications
You must be signed in to change notification settings - Fork 2
80 lines (63 loc) · 1.91 KB
/
coverage.yml
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
name: Code Coverage
on:
push:
tags-ignore:
- '**'
branches:
- '**'
pull_request:
env:
RUST_BACKTRACE: 1
CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: 0
jobs:
generate_coverage:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3
- name: Install dependencies
run: |
sudo apt update -y
sudo apt install -y \
tzdata \
build-essential \
pkg-config \
git \
lcov \
;
env:
DEBIAN_FRONTEND: noninteractive
- name: Install stable minimal toolchain
uses: dtolnay/rust-toolchain@v1
with:
toolchain: stable
components: llvm-tools
- name: Install cargo-llvm-cov
run: cargo install cargo-llvm-cov
- name: Set up latest Python3 stable version
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Generate test lcov coverage into coverage/ dir
run: |
pip3 install --upgrade pip
python3 -m venv env
source env/bin/activate
pip3 install maturin pytest pytest-cov
mkdir -p coverage
cargo llvm-cov clean --workspace
# Run rust tests to generate test data
cargo test --all-features
# build python
maturin develop --all-features
# Coverage for python tests
pytest tests --cov=mwalib --cov-report xml:coverage/coverage.xml tests
# Coverage for rust tests
cargo llvm-cov --all-features --lcov --output-path coverage/coverage.lcov
# this uses the result of the previous run to generate a text summary
cargo llvm-cov report
- name: Upload reports to codecov.io. Codecov should automatically merge the python and rust coverage
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}