Continuous integration #312
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" | |
jobs: | |
check: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install stable toolchain | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
components: rustfmt, clippy | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
prefix-key: v0 | |
- name: Check formatting | |
run: cargo fmt -- --check | |
- name: Run clippy | |
run: cargo clippy --all-targets -- -D warnings | |
- name: Build docs | |
run: cargo doc --no-deps --all-features | |
env: | |
RUSTDOCFLAGS: "-Dwarnings" | |
tests: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
rust: ['1.75', 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.75' | |
isMerge: true | |
- rust: beta | |
isMerge: true | |
name: tests (Rust ${{ matrix.rust }}) | |
steps: | |
- uses: actions/checkout@v4 | |
- 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: Swatinem/rust-cache@v2 | |
with: | |
prefix-key: v0-rust-${{ matrix.rust }} | |
- name: Build with no features | |
run: cargo build --verbose --no-default-features | |
- name: Build with all features | |
run: cargo build --verbose --all-features | |
- name: Tests with no features | |
run: cargo test --verbose --no-default-features | |
- name: Tests with all features | |
run: cargo test --verbose --all-features | |
rs-semver-checks: | |
needs: [check] | |
if: ${{ github.event_name == 'pull_request' }} | |
uses: CQCL/hugrverse-actions/.github/workflows/rs-semver-checks.yml@main | |
secrets: | |
GITHUB_PAT: ${{ secrets.HUGRBOT_PAT }} |