diff --git a/.github/workflows/rust-lint.yml b/.github/workflows/rust-lint.yml new file mode 100644 index 0000000..55d75ca --- /dev/null +++ b/.github/workflows/rust-lint.yml @@ -0,0 +1,44 @@ +name: Rust Lint + +on: + push: + paths: + - "src/**" + - "Cargo.toml" + - "Cargo.lock" + - ".github/workflows/rust-lint.yml" + pull_request: + paths: + - "src/**" + - "Cargo.toml" + - "Cargo.lock" + - ".github/workflows/rust-lint.yml" + +jobs: + clippy: + name: Clippy + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: dtolnay/rust-toolchain@stable + with: + components: clippy + + - uses: Swatinem/rust-cache@v2 + + - name: Run clippy + run: cargo clippy -- -D warnings + + rustfmt: + name: Format + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: dtolnay/rust-toolchain@stable + with: + components: rustfmt + + - name: Check formatting + run: cargo fmt --all -- --check