|
1 | | - name: Code Coverage |
| 1 | +name: Code Coverage |
2 | 2 | # on: |
3 | 3 | # workflow_call: |
4 | 4 | # inputs: |
5 | 5 | # skip_tests: |
6 | 6 | # type: boolean |
7 | 7 | # default: false |
8 | 8 | # required: false |
9 | | - # DO NOT CHANGE NAME OF WORKFLOW, USED IN OTHER WORKFLOWS KEEP "Rust Tests" |
10 | | - jobs: |
11 | | - code-coverage: |
12 | | - if: ${{ !inputs.skip_tests }} |
13 | | - name: Code Coverage |
14 | | - runs-on: ubuntu-latest |
15 | | - env: |
16 | | - RUSTC_WRAPPER: sccache |
17 | | - SCCACHE_CACHE_SIZE: 2G |
18 | | - SCCACHE_DIR: /home/runner/.cache/sccache |
19 | | - SCCACHE_PATH: /home/runner/.cache/sccache |
20 | | - steps: |
21 | | - - uses: actions/checkout@v7 |
22 | | - name: Checkout |
23 | | - with: |
24 | | - ref: ${{ github.head_ref }} |
25 | | - - name: Cache sccache |
26 | | - uses: actions/cache@v6 |
27 | | - with: |
28 | | - path: /home/runner/.cache/sccache |
29 | | - key: codecov-${{ runner.os }}-sccache-${{ hashFiles('**/Cargo.lock') }} |
30 | | - restore-keys: | |
31 | | - codecov-${{ runner.os }}-sccache- |
32 | | - - name: Set up cargo cache |
33 | | - uses: actions/cache@v6 |
34 | | - continue-on-error: false |
35 | | - with: |
36 | | - path: | |
37 | | - ~/.cargo/bin/ |
38 | | - ~/.cargo/registry/index/ |
39 | | - ~/.cargo/registry/cache/ |
40 | | - ~/.cargo/git/db/ |
41 | | - target/debug |
42 | | - target/release |
43 | | - key: codecov-${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}-coverage |
44 | | - restore-keys: codecov-${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}-coverage |
45 | | - - uses: actions-rs/toolchain@v1 |
46 | | - name: Setup Rust |
47 | | - with: |
48 | | - toolchain: nightly |
49 | | - override: true |
50 | | - components: rustfmt, clippy |
51 | | - - name: Install sccache (Ubuntu) |
52 | | - run: | |
53 | | - 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 |
54 | | - sudo mv sccache-v0.5.4-x86_64-unknown-linux-musl/sccache /usr/local/bin/ |
55 | | - - name: Start sccache server |
56 | | - run: sccache --start-server |
57 | | - - name: Setup Python |
58 | | - uses: actions/setup-python@v7 |
59 | | - with: |
60 | | - python-version: "3.11" |
61 | | - cache: 'pip' |
62 | | - - name: Run Maturin develop |
63 | | - uses: PyO3/maturin-action@v1 |
64 | | - with: |
65 | | - working-directory: ./python |
66 | | - command: build |
67 | | - sccache: true |
68 | | - - name: Install Python dependencies |
69 | | - run: | |
70 | | - python -m pip install -q pytest networkx numpy seaborn pandas nbmake pytest-xdist matplotlib pyvis pytest-cov coverage |
71 | | - python -m pip install target/wheels/raphtory-*.whl |
72 | | - - name: Run tests (rust) |
73 | | - run: cargo test -p raphtory --features "io python" |
74 | | - env: |
75 | | - CARGO_INCREMENTAL: '0' |
76 | | - RUSTFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests' |
77 | | - RUSTDOCFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests' |
78 | | - - name: Run tests (python) |
79 | | - run: cargo test -p raphtory-pymodule --no-default-features |
80 | | - env: |
81 | | - CARGO_INCREMENTAL: '0' |
82 | | - RUSTFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests' |
83 | | - RUSTDOCFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests' |
84 | | - - id: coveragerust |
85 | | - name: Run rust tests (rust-grcov) and collect coverage |
86 | | - uses: actions-rs/grcov@v0.1.5 |
87 | | - - name: Run python tests and collect coverage |
88 | | - run: cd python/tests && pytest --cov=./ --cov-report=xml |
89 | | - - name: Codecov |
90 | | - uses: codecov/codecov-action@v7.0.0 |
91 | | - with: |
92 | | - verbose: true |
93 | | - fail_ci_if_error: false |
94 | | - files: ./coverage.xml, ${{ steps.coveragerust.outputs.report }} |
95 | | - - name: Print sccache stats |
96 | | - run: sccache --show-stats |
97 | | - - name: Stop sccache server |
98 | | - run: sccache --stop-server || true |
| 9 | +# DO NOT CHANGE NAME OF WORKFLOW, USED IN OTHER WORKFLOWS KEEP "Rust Tests" |
| 10 | +jobs: |
| 11 | + code-coverage: |
| 12 | + if: ${{ !inputs.skip_tests }} |
| 13 | + name: Code Coverage |
| 14 | + runs-on: ubuntu-latest |
| 15 | + env: |
| 16 | + RUSTC_WRAPPER: sccache |
| 17 | + SCCACHE_CACHE_SIZE: 2G |
| 18 | + SCCACHE_DIR: /home/runner/.cache/sccache |
| 19 | + SCCACHE_PATH: /home/runner/.cache/sccache |
| 20 | + steps: |
| 21 | + - uses: actions/checkout@v7 |
| 22 | + name: Checkout |
| 23 | + with: |
| 24 | + ref: ${{ github.head_ref }} |
| 25 | + - name: Cache sccache |
| 26 | + uses: actions/cache@v6 |
| 27 | + with: |
| 28 | + path: /home/runner/.cache/sccache |
| 29 | + key: codecov-${{ runner.os }}-sccache-${{ hashFiles('**/Cargo.lock') }} |
| 30 | + restore-keys: | |
| 31 | + codecov-${{ runner.os }}-sccache- |
| 32 | + - name: Set up cargo cache |
| 33 | + uses: actions/cache@v6 |
| 34 | + continue-on-error: false |
| 35 | + with: |
| 36 | + path: | |
| 37 | + ~/.cargo/bin/ |
| 38 | + ~/.cargo/registry/index/ |
| 39 | + ~/.cargo/registry/cache/ |
| 40 | + ~/.cargo/git/db/ |
| 41 | + target/debug |
| 42 | + target/release |
| 43 | + key: codecov-${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}-coverage |
| 44 | + restore-keys: codecov-${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}-coverage |
| 45 | + - uses: actions-rs/toolchain@v1 |
| 46 | + name: Setup Rust |
| 47 | + with: |
| 48 | + toolchain: nightly |
| 49 | + override: true |
| 50 | + components: rustfmt, clippy |
| 51 | + - name: Install sccache (Ubuntu) |
| 52 | + run: | |
| 53 | + 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 |
| 54 | + sudo mv sccache-v0.5.4-x86_64-unknown-linux-musl/sccache /usr/local/bin/ |
| 55 | + - name: Start sccache server |
| 56 | + run: sccache --start-server |
| 57 | + - name: Setup Python |
| 58 | + uses: actions/setup-python@v7 |
| 59 | + with: |
| 60 | + python-version: "3.11" |
| 61 | + cache: 'pip' |
| 62 | + - name: Run Maturin develop |
| 63 | + uses: PyO3/maturin-action@v1 |
| 64 | + with: |
| 65 | + working-directory: ./python |
| 66 | + command: build |
| 67 | + sccache: true |
| 68 | + - name: Install Python dependencies |
| 69 | + run: | |
| 70 | + python -m pip install -q pytest networkx numpy seaborn pandas nbmake pytest-xdist matplotlib pyvis pytest-cov coverage |
| 71 | + python -m pip install target/wheels/raphtory-*.whl |
| 72 | + - name: Run tests (rust) |
| 73 | + run: cargo test -p raphtory --all-features |
| 74 | + env: |
| 75 | + CARGO_INCREMENTAL: '0' |
| 76 | + RUSTFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests' |
| 77 | + RUSTDOCFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests' |
| 78 | + - name: Run tests (python) |
| 79 | + run: cargo test -p raphtory-pymodule --all-features |
| 80 | + env: |
| 81 | + CARGO_INCREMENTAL: '0' |
| 82 | + RUSTFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests' |
| 83 | + RUSTDOCFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests' |
| 84 | + - id: coveragerust |
| 85 | + name: Run rust tests (rust-grcov) and collect coverage |
| 86 | + uses: actions-rs/grcov@v0.1.5 |
| 87 | + - name: Run python tests and collect coverage |
| 88 | + run: cd python/tests && pytest --cov=./ --cov-report=xml |
| 89 | + - name: Codecov |
| 90 | + uses: codecov/codecov-action@v7.0.0 |
| 91 | + with: |
| 92 | + verbose: true |
| 93 | + fail_ci_if_error: false |
| 94 | + files: ./coverage.xml, ${{ steps.coveragerust.outputs.report }} |
| 95 | + - name: Print sccache stats |
| 96 | + run: sccache --show-stats |
| 97 | + - name: Stop sccache server |
| 98 | + run: sccache --stop-server || true |
99 | 99 |
|
0 commit comments