Repository navigation
98 lines (98 loc) · 3.84 KB
/
Copy pathcode_coverage.yml
File metadata and controls
98 lines (98 loc) · 3.84 KB
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
86
87
88
89
90
91
92
93
94
95
96
97
98
name: Code Coverage
# on:
# workflow_call:
# inputs:
# skip_tests:
# type: boolean
# default: false
# required: false
# DO NOT CHANGE NAME OF WORKFLOW, USED IN OTHER WORKFLOWS KEEP "Rust Tests"
jobs:
code-coverage:
if: ${{ !inputs.skip_tests }}
name: Code Coverage
runs-on: ubuntu-latest
env:
RUSTC_WRAPPER: sccache
SCCACHE_CACHE_SIZE: 2G
SCCACHE_DIR: /home/runner/.cache/sccache
SCCACHE_PATH: /home/runner/.cache/sccache
steps:
- uses: actions/checkout@v7
name: Checkout
with:
ref: ${{ github.head_ref }}
- name: Cache sccache
uses: actions/cache@v6
with:
path: /home/runner/.cache/sccache
key: codecov-${{ runner.os }}-sccache-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
codecov-${{ runner.os }}-sccache-
- name: Set up cargo cache
uses: actions/cache@v6
continue-on-error: false
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/debug
target/release
key: codecov-${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}-coverage
restore-keys: codecov-${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}-coverage
- uses: actions-rs/toolchain@v1
name: Setup Rust
with:
toolchain: nightly
override: true
components: rustfmt, clippy
- name: Install sccache (Ubuntu)
run: |
curl -L https://github.com/mozilla/sccache/releases/download/v0.5.4/sccache-v0.5.4-x86_64-unknown-linux-musl.tar.gz | tar xz
sudo mv sccache-v0.5.4-x86_64-unknown-linux-musl/sccache /usr/local/bin/
- name: Start sccache server
run: sccache --start-server
- name: Setup Python
uses: actions/setup-python@v7
with:
python-version: "3.11"
cache: "pip"
- name: Run Maturin develop
uses: PyO3/maturin-action@v1
with:
working-directory: ./python
command: build
sccache: true
- name: Install Python dependencies
run: |
python -m pip install -q pytest networkx numpy seaborn pandas nbmake pytest-xdist matplotlib pyvis pytest-cov coverage
python -m pip install target/wheels/raphtory-*.whl
- name: Run tests (rust)
run: cargo test --workspace --all-features --profile build-fast
env:
CARGO_INCREMENTAL: "0"
RUSTFLAGS: "-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests"
RUSTDOCFLAGS: "-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests"
- name: Run tests (python)
run: cargo test -p raphtory-pymodule --all-features
env:
CARGO_INCREMENTAL: "0"
RUSTFLAGS: "-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests"
RUSTDOCFLAGS: "-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests"
- id: coveragerust
name: Run rust tests (rust-grcov) and collect coverage
uses: actions-rs/grcov@v0.1.5
- name: Run python tests and collect coverage
run: cd python/tests && pytest --cov=./ --cov-report=xml
- name: Codecov
uses: codecov/codecov-action@v7.0.0
with:
verbose: true
fail_ci_if_error: false
files: ./coverage.xml, ${{ steps.coveragerust.outputs.report }}
- name: Print sccache stats
run: sccache --show-stats
- name: Stop sccache server
run: sccache --stop-server || true