Skip to content

Commit de8c5d9

Browse files
committed
ci: add check workflow
1 parent 581fcf3 commit de8c5d9

1 file changed

Lines changed: 67 additions & 0 deletions

File tree

.github/workflows/check.yml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: Check
2+
3+
on:
4+
push: {}
5+
pull_request: {}
6+
7+
jobs:
8+
clippy:
9+
name: Clippy
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: read
13+
14+
strategy:
15+
matrix:
16+
include:
17+
- target: aarch64-linux-android
18+
- target: aarch64-apple-ios
19+
- target: aarch64-apple-darwin
20+
- target: x86_64-pc-windows-gnu
21+
- target: x86_64-unknown-linux-gnu
22+
default: true
23+
24+
steps:
25+
- uses: actions/checkout@v4
26+
27+
- name: Setup Rust toolchain
28+
uses: dtolnay/rust-toolchain@stable
29+
30+
- name: Add target
31+
if: matrix.target != 'x86_64-unknown-linux-gnu'
32+
run: rustup target add ${{ matrix.target }}
33+
34+
- name: Cache
35+
uses: Swatinem/rust-cache@v2
36+
with:
37+
cache-on-failure: "true"
38+
cache-all-crates: "true"
39+
40+
- name: Clippy
41+
run: |
42+
if [ "${{ matrix.target }}" = "x86_64-unknown-linux-gnu" ]; then
43+
cargo clippy --all-targets --all-features -- -D warnings
44+
else
45+
cargo clippy --all-targets --all-features --target ${{ matrix.target }} -- -D warnings
46+
fi
47+
48+
fmt:
49+
name: Format
50+
runs-on: ubuntu-latest
51+
permissions:
52+
contents: read
53+
54+
steps:
55+
- uses: actions/checkout@v4
56+
57+
- name: Setup Rust toolchain
58+
uses: dtolnay/rust-toolchain@stable
59+
60+
- name: Cache
61+
uses: Swatinem/rust-cache@v2
62+
with:
63+
cache-on-failure: "true"
64+
cache-all-crates: "true"
65+
66+
- name: Format
67+
run: cargo fmt --all --check

0 commit comments

Comments
 (0)