chore: update hugr dep #772
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: Continuous integration | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
merge_group: | |
types: [checks_requested] | |
workflow_dispatch: {} | |
env: | |
CARGO_TERM_COLOR: always | |
CARGO_INCREMENTAL: 0 | |
RUSTFLAGS: "--cfg=ci_run" | |
MIRIFLAGS: '-Zmiri-permissive-provenance' # Required due to warnings in bitvec 1.0.1 | |
SCCACHE_GHA_ENABLED: "true" | |
RUSTC_WRAPPER: "sccache" | |
jobs: | |
check: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install stable toolchain | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
components: rustfmt, clippy | |
- uses: mozilla-actions/[email protected] | |
- name: Check rust formatting | |
run: cargo fmt -- --check | |
- name: Check python formatting | |
uses: chartboost/ruff-action@v1 | |
with: | |
args: format --check | |
- name: Run clippy | |
run: cargo clippy --all-targets --all-features --workspace -- -D warnings | |
- name: Build docs | |
run: cargo doc --no-deps --all-features | |
env: | |
RUSTDOCFLAGS: "-Dwarnings" | |
- name: Python lints | |
uses: chartboost/ruff-action@v1 | |
with: | |
args: check | |
benches: | |
# Not required, we can ignore it for the merge queue check. | |
if: github.event_name != 'merge_group' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install stable toolchain | |
uses: dtolnay/rust-toolchain@stable | |
- uses: mozilla-actions/[email protected] | |
- name: Build benchmarks with no features | |
run: cargo bench --verbose --no-run --no-default-features | |
- name: Build benchmarks with all features | |
run: cargo bench --verbose --no-run --all-features | |
tests: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
rust: ['1.70', stable, beta] | |
# workaround to ignore non-stable tests when running the merge queue checks | |
# see: https://github.community/t/how-to-conditionally-include-exclude-items-in-matrix-eg-based-on-branch/16853/6 | |
isMerge: | |
- ${{ github.event_name == 'merge_group' }} | |
exclude: | |
- rust: '1.70' | |
isMerge: true | |
- rust: beta | |
isMerge: true | |
name: tests (Rust ${{ matrix.rust }}) | |
steps: | |
- uses: actions/checkout@v3 | |
- id: toolchain | |
uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: ${{ matrix.rust }} | |
- name: Configure default rust toolchain | |
run: rustup override set ${{steps.toolchain.outputs.name}} | |
- uses: mozilla-actions/[email protected] | |
- name: Build with no features | |
run: cargo test --verbose --no-default-features --no-run | |
- name: Tests with no features | |
run: cargo test --verbose --no-default-features | |
- name: Build with all features | |
run: cargo test --verbose --all-features --no-run | |
- name: Tests with all features | |
run: cargo test --verbose --all-features | |
py-tests: | |
# Not required, we can ignore it for the merge queue check. | |
if: github.event_name != 'merge_group' | |
runs-on: ubuntu-latest | |
name: "python bindings" | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: mozilla-actions/[email protected] | |
- name: Install stable toolchain | |
uses: dtolnay/rust-toolchain@stable | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11' | |
cache: 'pip' | |
- name: Build pyo3 bindings | |
run: | | |
pip install -r dev-requirements.txt | |
maturin build | |
pip install target/wheels/*.whl | |
- name: Test pyo3 bindings | |
run: pytest | |
coverage: | |
if: github.event_name != 'merge_group' | |
needs: [tests, check] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: mozilla-actions/[email protected] | |
- uses: dtolnay/rust-toolchain@nightly | |
with: | |
components: llvm-tools-preview | |
- name: Install cargo-llvm-cov | |
uses: taiki-e/install-action@cargo-llvm-cov | |
- name: Run tests with coverage instrumentation | |
run: | | |
cargo llvm-cov clean --workspace | |
cargo llvm-cov --doctests --all-features | |
cargo llvm-cov report --codecov --output-path coverage.json | |
- name: Upload rust coverage to codecov.io | |
uses: codecov/codecov-action@v3 | |
with: | |
files: coverage.json | |
name: rust | |
token: ${{ secrets.CODECOV_TOKEN }} | |
py-coverage: | |
if: github.event_name != 'merge_group' | |
needs: [py-tests, check] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: mozilla-actions/[email protected] | |
- name: Install stable toolchain | |
uses: dtolnay/rust-toolchain@stable | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11' | |
cache: 'pip' | |
- name: Build pyo3 bindings | |
run: | | |
pip install -r dev-requirements.txt | |
pip install pytest-cov | |
maturin build | |
pip install target/wheels/*.whl | |
- name: Run python tests with coverage instrumentation | |
run: pytest --cov=./ --cov-report=xml | |
- name: Upload python coverage to codecov.io | |
uses: codecov/codecov-action@v3 | |
with: | |
files: coverage.xml | |
name: python | |
token: ${{ secrets.CODECOV_TOKEN }} |