| 1 |
name: Code Style |
| 2 |
|
| 3 |
on: |
| 4 |
push: |
| 5 |
branches: [main] |
| 6 |
paths: |
| 7 |
- ".github/workflows/lint.yml" |
| 8 |
- "**.rs" |
| 9 |
- "Cargo.toml" |
| 10 |
- "Cargo.lock" |
| 11 |
pull_request: |
| 12 |
branches: [main] |
| 13 |
paths: |
| 14 |
- ".github/workflows/lint.yml" |
| 15 |
- "**.rs" |
| 16 |
- "Cargo.toml" |
| 17 |
- "Cargo.lock" |
| 18 |
|
| 19 |
jobs: |
| 20 |
test: |
| 21 |
name: Tests on ${{ matrix.os }} for ${{ matrix.toolchain }} |
| 22 |
runs-on: ${{ matrix.os }} |
| 23 |
strategy: |
| 24 |
fail-fast: false |
| 25 |
matrix: |
| 26 |
os: [ubuntu-latest, macos-latest, windows-latest] |
| 27 |
|
| 28 |
steps: |
| 29 |
- name: Checkout code |
| 30 |
uses: actions/checkout@v4 |
| 31 |
|
| 32 |
- name: Setup Rust toolchain |
| 33 |
uses: dtolnay/rust-toolchain@stable |
| 34 |
with: |
| 35 |
components: rustfmt, clippy |
| 36 |
|
| 37 |
- name: cargo build |
| 38 |
run: cargo build |
| 39 |
|
| 40 |
- name: cargo fmt |
| 41 |
run: cargo fmt --all -- --check |
| 42 |
|
| 43 |
- name: cargo fmt |
| 44 |
run: cargo fmt --all -- --check |
| 45 |
|
| 46 |
- name: cargo clippy |
| 47 |
run: cargo clippy --tests -- -D warnings |
| 48 |
|
| 49 |
- name: cargo clippy without default features |
| 50 |
run: cargo clippy --no-default-features --tests -- -D warnings |
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
- name: Install taplo-cli |
| 55 |
run: cargo install taplo-cli |
| 56 |
if: matrix.os == 'ubuntu-latest' |
| 57 |
|
| 58 |
- name: Run taplo check |
| 59 |
run: ~/.cargo/bin/taplo format --check |
| 60 |
if: matrix.os == 'ubuntu-latest' |