ci: add clippy/rustfmt checks
Signed-off-by: seth <getchoo@tuta.io>
This commit is contained in:
parent
e928eb67df
commit
65fc5d5ed7
2 changed files with 68 additions and 25 deletions
68
.github/workflows/check.yml
vendored
Normal file
68
.github/workflows/check.yml
vendored
Normal file
|
@ -0,0 +1,68 @@
|
|||
name: Check
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: ['main']
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
rustfmt:
|
||||
name: Run rustfmt
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Install Rust
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
toolchain: stable
|
||||
components: rustfmt
|
||||
|
||||
- name: Setup Rust cache
|
||||
uses: Swatinem/rust-cache@v2
|
||||
|
||||
- name: Run rustfmt
|
||||
run: cargo fmt --all -- --check
|
||||
|
||||
clippy:
|
||||
name: Run Clippy scan
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
permissions:
|
||||
security-events: write
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Install Rust
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
toolchain: stable
|
||||
components: clippy
|
||||
|
||||
- name: Setup Rust cache
|
||||
uses: Swatinem/rust-cache@v2
|
||||
|
||||
- name: Install SARIF tools
|
||||
run: cargo install clippy-sarif sarif-fmt
|
||||
|
||||
- name: Fetch Cargo deps
|
||||
run: cargo fetch --locked
|
||||
|
||||
- name: Run Clippy
|
||||
continue-on-error: true
|
||||
run: |
|
||||
set -euxo pipefail
|
||||
|
||||
cargo clippy \
|
||||
--all-features \
|
||||
--all-targets \
|
||||
--message-format=json \
|
||||
| clippy-sarif | tee /tmp/clippy.sarif | sarif-fmt
|
||||
|
||||
- name: Upload results
|
||||
uses: github/codeql-action/upload-sarif@v2
|
||||
with:
|
||||
sarif_file: /tmp/clippy.sarif
|
||||
wait-for-processing: true
|
25
.github/workflows/lint.yml
vendored
25
.github/workflows/lint.yml
vendored
|
@ -1,25 +0,0 @@
|
|||
name: Lint
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: ['main']
|
||||
pull_request:
|
||||
branches: ['main']
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
|
||||
- name: Install Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20
|
||||
- name: Install pnpm
|
||||
uses: pnpm/action-setup@v2
|
||||
|
||||
- name: Install dependencies
|
||||
run: pnpm install
|
||||
- name: Lint
|
||||
run: pnpm run lint
|
Loading…
Add table
Add a link
Reference in a new issue