update Workflow Actions, badge URLs, and codecov token #12
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
pull_request: | |
jobs: | |
coverage: | |
name: Coverage for ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: ["ubuntu"] | |
runs-on: ${{ matrix.os }}-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.10" | |
cache: "pip" | |
- name: Rust setup | |
run: rustup toolchain install stable --profile minimal | |
- name: Install cargo-llvm-cov | |
uses: taiki-e/install-action@cargo-llvm-cov | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
key: coverage-cargo-${{ matrix.os }} | |
continue-on-error: true | |
- name: Setup virtual environment | |
run: | | |
python -m venv venv | |
source venv/bin/activate | |
pip install -r requirements.txt | |
- name: Run coverage | |
run: | | |
source venv/bin/activate | |
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 | |
maturin develop | |
pytest tests --cov=foobar --cov-report lcov:python-coverage.lcov | |
cargo llvm-cov report --lcov --output-path rust-coverage.lcov | |
- name: Upload results to Codecov | |
uses: codecov/codecov-action@v4 | |
with: | |
files: python-coverage.lcov,rust-coverage.lcov | |
name: ${{ matrix.os }} | |
token: ${{ secrets.CODECOV_TOKEN }} | |