initialize maturin package #103
Workflow file for this run
This file contains 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: codecov-rs CI | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
jobs: | |
lint: | |
name: Lint Rust (rustfmt + clippy) | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@nightly | |
with: | |
toolchain: nightly | |
components: clippy, rustfmt | |
- name: Run lint | |
run: | | |
cargo fmt --all --check | |
cargo clippy | |
lint-python: | |
name: Lint Python (ruff, mypy) | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- uses: actions/setup-python@v3 | |
with: | |
python-version: '3.12' | |
- name: Build and run lint | |
run: | | |
python3 -m venv .venv | |
source .venv/bin/activate | |
pip install -r requirements.dev.txt | |
maturin develop | |
ruff check | |
ruff format | |
mypy | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@nightly | |
with: | |
toolchain: nightly | |
- name: Run build | |
run: | | |
cargo build | |
- uses: actions/setup-python@v3 | |
with: | |
python-version: '3.12' | |
- name: Install Python requirements | |
run: pip install -r requirements.dev.txt | |
- name: Build Python bindings | |
run: maturin build | |
test: | |
name: Test | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@nightly | |
with: | |
toolchain: nightly | |
- name: Run Rust tests | |
run: | | |
cargo test | |
- uses: actions/setup-python@v3 | |
with: | |
python-version: '3.12' | |
- name: Run Python tests | |
run: | | |
python3 -m venv .venv | |
source .venv/bin/activate | |
pip install -r requirements.dev.txt | |
maturin develop | |
pytest | |
# This job runs tests, generates coverage data, and generates JUnit test | |
# results in a single test invocation and then uploads it all to Codecov. | |
# However, it doesn't print test results to stdout. If Codecov's failed test | |
# reporting is solid and we never need to see the results in the CI logs, we | |
# can delete the "normal" test step and just use this. | |
test-for-codecov: | |
name: Test (Upload to Codecov) | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@nightly | |
with: | |
toolchain: nightly | |
- name: Install `cargo llvm-cov` | |
uses: taiki-e/install-action@cargo-llvm-cov | |
- name: Run tests | |
run: | | |
cargo install cargo2junit | |
cargo llvm-cov --lcov --output-path lcov.info -- -Z unstable-options --format json --report-time | cargo2junit > results.xml | |
- uses: actions/setup-python@v3 | |
with: | |
python-version: '3.12' | |
- name: Run Python tests | |
run: | | |
python3 -m venv .venv | |
source .venv/bin/activate | |
pip install -r requirements.dev.txt | |
maturin develop | |
pytest --cov --junitxml=junit.xml | |
- name: Upload coverage data to Codecov | |
if: ${{ !cancelled() }} | |
uses: codecov/codecov-action@v4 | |
with: | |
token: ${{ secrets.CODECOV_ORG_TOKEN }} | |
- name: Upload test results to Codecov | |
if: ${{ !cancelled() }} | |
uses: codecov/test-results-action@v1 | |
with: | |
files: ./results.xml,./junit.xml | |
token: ${{ secrets.CODECOV_ORG_TOKEN }} | |
verbose: true |