|
| 1 | +# Adapted from https://github.com/jonhoo/inferno/blob/main/.github/workflows/check.yml |
| 2 | +--- |
| 3 | +permissions: |
| 4 | + contents: read |
| 5 | +on: |
| 6 | + push: |
| 7 | + branches: [main] |
| 8 | + pull_request: |
| 9 | +# If new code is pushed to a PR branch, then cancel in progress workflows for that PR. |
| 10 | +concurrency: |
| 11 | + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} |
| 12 | + cancel-in-progress: true |
| 13 | +name: check |
| 14 | +jobs: |
| 15 | + fmt: |
| 16 | + runs-on: ubuntu-latest |
| 17 | + name: stable / fmt |
| 18 | + steps: |
| 19 | + - uses: actions/checkout@v4 |
| 20 | + with: |
| 21 | + submodules: true |
| 22 | + - name: Install stable |
| 23 | + uses: dtolnay/rust-toolchain@stable |
| 24 | + with: |
| 25 | + components: rustfmt |
| 26 | + - name: cargo fmt --check |
| 27 | + run: cargo fmt --check |
| 28 | + clippy: |
| 29 | + runs-on: ubuntu-latest |
| 30 | + name: ${{ matrix.toolchain }} / clippy |
| 31 | + permissions: |
| 32 | + contents: read |
| 33 | + checks: write |
| 34 | + strategy: |
| 35 | + fail-fast: false |
| 36 | + matrix: |
| 37 | + # Get early warning of new lints which are regularly introduced in beta channels. |
| 38 | + toolchain: [stable, beta] |
| 39 | + steps: |
| 40 | + - uses: actions/checkout@v4 |
| 41 | + with: |
| 42 | + submodules: true |
| 43 | + - name: Install ${{ matrix.toolchain }} |
| 44 | + uses: dtolnay/rust-toolchain@master |
| 45 | + with: |
| 46 | + toolchain: ${{ matrix.toolchain }} |
| 47 | + components: clippy |
| 48 | + - name: cargo clippy |
| 49 | + uses: giraffate/clippy-action@v1 |
| 50 | + with: |
| 51 | + reporter: 'github-pr-check' |
| 52 | + github_token: ${{ secrets.GITHUB_TOKEN }} |
| 53 | + doc: |
| 54 | + # run docs generation on nightly rather than stable. This enables features like |
| 55 | + # https://doc.rust-lang.org/beta/unstable-book/language-features/doc-cfg.html which allows an |
| 56 | + # API be documented as only available in some specific platforms. |
| 57 | + runs-on: ubuntu-latest |
| 58 | + name: nightly / doc |
| 59 | + steps: |
| 60 | + - uses: actions/checkout@v4 |
| 61 | + with: |
| 62 | + submodules: true |
| 63 | + - name: Install nightly |
| 64 | + uses: dtolnay/rust-toolchain@nightly |
| 65 | + - name: Install cargo-docs-rs |
| 66 | + uses: dtolnay/install@cargo-docs-rs |
| 67 | + - name: cargo docs-rs |
| 68 | + run: cargo docs-rs |
0 commit comments