|
| 1 | +name: check |
| 2 | +# This workflow runs whenever a PR is opened or updated, or a commit is pushed |
| 3 | +# to main. It runs several checks: |
| 4 | +# - fmt: checks that the code is formatted according to `rustfmt`. |
| 5 | +# - clippy: checks that the code does not contain any `clippy` warnings. |
| 6 | +# - doc: checks that the code can be documented without errors. |
| 7 | +# - typos: checks for typos across the repo. |
| 8 | +permissions: |
| 9 | + contents: read |
| 10 | +# This configuration allows maintainers of this repo to create a branch and |
| 11 | +# pull request based on the new branch. Restricting the push trigger to the |
| 12 | +# main branch ensures that the PR only gets built once. |
| 13 | +on: |
| 14 | + push: |
| 15 | + branches: [main, v*] |
| 16 | + pull_request: |
| 17 | +# If new code is pushed to a PR branch, then cancel in progress workflows for |
| 18 | +# that PR. Ensures that we don't waste CI time, and returns results quicker. |
| 19 | +# https://github.com/jonhoo/rust-ci-conf/pull/5 |
| 20 | +concurrency: |
| 21 | + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} |
| 22 | + cancel-in-progress: true |
| 23 | +env: |
| 24 | + CARGO_TERM_COLOR: always |
| 25 | + |
| 26 | +jobs: |
| 27 | + cargo-build: |
| 28 | + name: Cargo Build |
| 29 | + runs-on: ubuntu-latest |
| 30 | + |
| 31 | + steps: |
| 32 | + - name: Fetch Repository |
| 33 | + uses: actions/checkout@v5 |
| 34 | + |
| 35 | + - name: Install stable toolchain |
| 36 | + uses: actions-rust-lang/setup-rust-toolchain@v1 |
| 37 | + |
| 38 | + - name: cargo build |
| 39 | + run: cargo b --locked --all-targets --all-features |
| 40 | + |
| 41 | + cargo-fmt: |
| 42 | + name: Cargo fmt |
| 43 | + runs-on: ubuntu-latest |
| 44 | + |
| 45 | + steps: |
| 46 | + - name: Fetch Repository |
| 47 | + uses: actions/checkout@v5 |
| 48 | + |
| 49 | + - name: Install stable toolchain |
| 50 | + uses: actions-rust-lang/setup-rust-toolchain@v1 |
| 51 | + with: |
| 52 | + components: rustfmt |
| 53 | + toolchain: nightly |
| 54 | + |
| 55 | + - name: Rustfmt Check |
| 56 | + run: cargo fmt --all --check |
| 57 | + |
| 58 | + cargo-clippy: |
| 59 | + name: Cargo clippy |
| 60 | + runs-on: ubuntu-latest |
| 61 | + |
| 62 | + steps: |
| 63 | + - name: Fetch Repository |
| 64 | + uses: actions/checkout@v5 |
| 65 | + |
| 66 | + - name: Install stable toolchain |
| 67 | + uses: actions-rust-lang/setup-rust-toolchain@v1 |
| 68 | + with: |
| 69 | + components: clippy |
| 70 | + |
| 71 | + - name: Clippy Check |
| 72 | + uses: giraffate/clippy-action@v1 |
| 73 | + with: |
| 74 | + reporter: "github-pr-check" |
| 75 | + github_token: ${{ secrets.GITHUB_TOKEN }} |
| 76 | + clippy_flags: --all-targets --all-features -- -D warnings -D clippy::pedantic |
| 77 | + |
| 78 | + typos-cli: |
| 79 | + name: typos |
| 80 | + runs-on: ubuntu-latest |
| 81 | + |
| 82 | + steps: |
| 83 | + - name: Fetch Repository |
| 84 | + uses: actions/checkout@v5 |
| 85 | + |
| 86 | + - name: Check spelling of files in the workspace |
| 87 | + uses: crate-ci/typos@v1 |
0 commit comments