-
Notifications
You must be signed in to change notification settings - Fork 1
51 lines (48 loc) · 1.5 KB
/
Copy pathcodecov.yml
File metadata and controls
51 lines (48 loc) · 1.5 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
name: codecov
on: [push, pull_request]
permissions:
contents: read
id-token: write # Required for Codecov tokenless uploads (public repos)
jobs:
build:
runs-on: ubuntu-latest
name: Test python API
defaults:
run:
working-directory: .
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.9'
cache: 'pip'
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: llvm-tools-preview
- uses: Swatinem/rust-cache@v2
with:
workspaces: "src/core -> src/core/target"
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: Install requirements
run: |
pip install pytest pytest-cov pytest-asyncio && pip install -e .
- name: Run tests and collect coverage
run: |
cd src/core/
source <(cargo llvm-cov show-env --export-prefix)
export CARGO_TARGET_DIR=$CARGO_LLVM_COV_TARGET_DIR
export CARGO_INCREMENTAL=1
cargo llvm-cov clean --workspace
cargo test
cd ../..
pytest --cov=./ --cov-report=xml
cd src/core/
cargo llvm-cov --no-run --lcov --output-path ../../coverage.lcov
- name: Upload coverage reports to Codecov with GitHub Action
uses: codecov/codecov-action@v5
with:
files: coverage.lcov,coverage.xml
token: ${{ secrets.CODECOV_TOKEN || secrets.CODECOV }}
fail_ci_if_error: true