|
| 1 | +name: Cargo Lint |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + - dev |
| 8 | + pull_request: |
| 9 | + types: [ready_for_review, opened, synchronize, reopened] |
| 10 | + paths: |
| 11 | + - '**.rs' |
| 12 | + - '**/Cargo.toml' |
| 13 | + workflow_dispatch: |
| 14 | + |
| 15 | +jobs: |
| 16 | + cargo-check: |
| 17 | + runs-on: ubuntu-latest |
| 18 | + |
| 19 | + steps: |
| 20 | + - name: Checkout |
| 21 | + uses: actions/checkout@v2 |
| 22 | + |
| 23 | + - name: Install latest nightly |
| 24 | + uses: actions-rs/toolchain@v1 |
| 25 | + with: |
| 26 | + toolchain: stable |
| 27 | + override: true |
| 28 | + components: rustfmt, clippy |
| 29 | + |
| 30 | + # `cargo check` command here will use installed `nightly` |
| 31 | + # as it is set as an "override" for current directory |
| 32 | + - name: deal with rust cache |
| 33 | + uses: Swatinem/rust-cache@v1 |
| 34 | + |
| 35 | + - name: cargo check |
| 36 | + run: cargo check --all-targets --workspace |
| 37 | + |
| 38 | + cargo-build: |
| 39 | + runs-on: ubuntu-latest |
| 40 | + |
| 41 | + steps: |
| 42 | + - name: Checkout |
| 43 | + uses: actions/checkout@v2 |
| 44 | + |
| 45 | + - name: Install latest nightly |
| 46 | + uses: actions-rs/toolchain@v1 |
| 47 | + with: |
| 48 | + toolchain: stable |
| 49 | + override: true |
| 50 | + components: rustfmt, clippy |
| 51 | + |
| 52 | + # `cargo check` command here will use installed `nightly` |
| 53 | + # as it is set as an "override" for current directory |
| 54 | + - name: deal with rust cache |
| 55 | + uses: Swatinem/rust-cache@v1 |
| 56 | + |
| 57 | + - name: cargo build |
| 58 | + run: cargo build --workspace |
| 59 | + |
| 60 | + cargo-clippy: |
| 61 | + runs-on: ubuntu-latest |
| 62 | + |
| 63 | + steps: |
| 64 | + - name: Checkout |
| 65 | + uses: actions/checkout@v2 |
| 66 | + |
| 67 | + - name: Install latest nightly |
| 68 | + uses: actions-rs/toolchain@v1 |
| 69 | + with: |
| 70 | + toolchain: stable |
| 71 | + override: true |
| 72 | + components: rustfmt, clippy |
| 73 | + |
| 74 | + # `cargo check` command here will use installed `nightly` |
| 75 | + # as it is set as an "override" for current directory |
| 76 | + - name: deal with rust cache |
| 77 | + uses: Swatinem/rust-cache@v1 |
| 78 | + |
| 79 | + # temporarily change to a self-maintained workflow |
| 80 | + # see https://github.com/actions-rs/clippy-check/pull/158 |
| 81 | + - name: cargo clippy |
| 82 | + uses: BobAnkh/clippy-check@master |
| 83 | + with: |
| 84 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 85 | + args: --all-features --workspace |
| 86 | + |
| 87 | + cargo-fmt: |
| 88 | + runs-on: ubuntu-latest |
| 89 | + |
| 90 | + steps: |
| 91 | + - name: Checkout |
| 92 | + uses: actions/checkout@v2 |
| 93 | + |
| 94 | + - name: Install latest nightly |
| 95 | + uses: actions-rs/toolchain@v1 |
| 96 | + with: |
| 97 | + toolchain: stable |
| 98 | + override: true |
| 99 | + components: rustfmt, clippy |
| 100 | + |
| 101 | + # `cargo check` command here will use installed `nightly` |
| 102 | + # as it is set as an "override" for current directory |
| 103 | + - name: deal with rust cache |
| 104 | + uses: Swatinem/rust-cache@v1 |
| 105 | + |
| 106 | + - name: cargo fmt |
| 107 | + run: cargo fmt --all -- --check |
0 commit comments