Optimize save_report_lines
a bit
#225
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: | |
env: | |
RUSTFLAGS: -Dwarnings | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
jobs: | |
lint: | |
name: Lint (rustfmt + clippy) | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- run: rustup toolchain install nightly --profile minimal --component rustfmt --component clippy --no-self-update | |
- run: cargo fmt --all -- --check | |
- run: cargo clippy --all-features --workspace --tests --examples -- -D clippy::all | |
lint-python: | |
name: Lint Python (ruff, mypy) | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
- run: make ci.setup_venv | |
- run: | | |
maturin develop | |
make lint.python | |
doctest: | |
name: Documentation (and Tests) | |
runs-on: ubuntu-latest | |
env: | |
RUSTDOCFLAGS: -Dwarnings | |
steps: | |
- uses: actions/checkout@v4 | |
- run: rustup toolchain install nightly --profile minimal --no-self-update | |
- run: cargo test --workspace --all-features --doc | |
- run: cargo doc --workspace --all-features --document-private-items --no-deps | |
test: | |
name: Test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- run: rustup toolchain install nightly --profile minimal --no-self-update | |
- uses: taiki-e/install-action@cargo-llvm-cov | |
- uses: taiki-e/install-action@nextest | |
# FIXME(swatinem): We should pass `--all-targets` to also compile and tests benchmarks | |
# Though currently `divan` does not support all CLI arguments as used by `nextest`, | |
# and benchmarks are unbearably slow anyway, so its not feasible to run in debug builds. | |
- run: cargo llvm-cov nextest --lcov --output-path core.lcov --workspace --all-features | |
- run: mv target/nextest/default/core-test-results.xml . | |
- uses: actions/setup-python@v5 | |
- run: make ci.setup_venv | |
- name: Run Python tests | |
run: | | |
# Clear prior profile data | |
cargo llvm-cov clean --workspace | |
# Set env vars so maturin will build our Rust code with coverage instrumentation | |
source <(cargo llvm-cov show-env --export-prefix) | |
maturin develop | |
# Run Python tests. Any Rust code exercised by these tests will emit coverage data | |
pytest --cov --junitxml=python-test-results.xml | |
# Turn the Rust coverage data into an lcov file | |
cargo llvm-cov --no-run --lcov --output-path bindings.lcov | |
- name: Upload coverage data to Codecov | |
if: ${{ !cancelled() }} | |
uses: codecov/codecov-action@v4 | |
with: | |
files: ./core.lcov,./bindings.lcov,./.coverage | |
token: ${{ secrets.CODECOV_ORG_TOKEN }} | |
- name: Upload test results to Codecov | |
if: ${{ !cancelled() }} | |
uses: codecov/test-results-action@v1 | |
with: | |
files: ./core-test-results.xml,./python-test-results.xml | |
token: ${{ secrets.CODECOV_ORG_TOKEN }} | |
verbose: true |