Proposal: add more thorough coverage of the crate to CI #6
Workflow file for this run
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: Rust | |
| on: | |
| push: | |
| branches: [ "master" ] | |
| pull_request: | |
| branches: [ "master" ] | |
| env: | |
| CARGO_TERM_COLOR: always | |
| # Abort a run of CI jobs if a newer run is triggered | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
| cancel-in-progress: true | |
| jobs: | |
| format: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| - name: Check formatting | |
| run: cargo fmt --check | |
| check: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| - name: Check | |
| run: cargo check --verbose | |
| clippy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| components: clippy | |
| - name: Clippy | |
| run: cargo clippy --verbose -- -D warnings | |
| # Emulates building the documentation on docs.rs and fails if there are any errors or warnings. | |
| doc: | |
| runs-on: ubuntu-latest | |
| env: | |
| RUSTFLAGS: -D warnings | |
| RUSTDOCFLAGS: --cfg docsrs | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@nightly | |
| - name: Generate documentation | |
| run: cargo +nightly doc --no-deps | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| - name: Build | |
| run: cargo build --verbose | |
| # Tests the crate on both stable and beta toolchains. | |
| # This lets us catch potential issues on the beta toolchain before they are released. | |
| test: | |
| strategy: | |
| matrix: | |
| toolchain: [stable, beta] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@master | |
| with: | |
| toolchain: ${{ matrix.toolchain }} | |
| - name: Test | |
| run: cargo test --verbose | |
| # Verify that we have not broken semver in the API. | |
| semver-checks: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| - uses: taiki-e/install-action@v2 | |
| with: | |
| tool: cargo-semver-checks | |
| - name: Verify semver compatibility | |
| run: cargo semver-checks |