-
Notifications
You must be signed in to change notification settings - Fork 14
78 lines (63 loc) · 2.3 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
name: Coverage
on:
push:
branches: [master]
pull_request:
# Check all PR
concurrency:
group: coverage-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}
jobs:
coverage:
runs-on: ubuntu-22.04
name: collect code coverage
steps:
- name: free disk space
run: sudo rm -rf /usr/share/dotnet /usr/local/lib/android || true
- uses: actions/checkout@v3
- name: setup Python
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: setup rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
- name: install cargo tarpaulin
uses: taiki-e/install-action@v2
with:
tool: cargo-tarpaulin
- name: install python dependencies
run: |
python -m pip install --upgrade pip
python -m pip install tox
- name: install lcov
run: sudo apt install -y lcov
- name: cache tox environments
uses: actions/cache@v3
with:
path: .tox
key: tox-${{ matrix.os }}-${{ hashFiles('pyproject.toml', 'setup.cfg', 'tox.ini') }}
- name: Setup sccache
uses: mozilla-actions/[email protected]
- name: Setup sccache environnement variables
run: |
echo "SCCACHE_GHA_ENABLED=true" >> $GITHUB_ENV
echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV
echo "CMAKE_C_COMPILER_LAUNCHER=sccache" >> $GITHUB_ENV
echo "CMAKE_CXX_COMPILER_LAUNCHER=sccache" >> $GITHUB_ENV
- name: collect rust and C/C++ coverage
env:
RASCALINE_TEST_WITH_STATIC_LIB: "1"
run: |
cargo tarpaulin --all-features --workspace --engine=llvm --out=xml --output-dir=target/tarpaulin --objects target/debug/librascaline.so
# cleanup C/C++ coverage
lcov --directory . --capture --output-file coverage.info
lcov --remove coverage.info '/usr/*' "$(pwd)/rascaline-c-api/tests/*" "$(pwd)/rascaline-c-api/examples/*" --output-file coverage.info
- name: collect Python coverage
run: tox -e all-deps
- name: upload to codecov.io
uses: codecov/codecov-action@v3
with:
fail_ci_if_error: true
files: target/tarpaulin/cobertura.xml,.tox/coverage.xml,coverage.info