Skip to content

Commit ddb0edb

Browse files
committed
chore: add pr workflow
1 parent a5b2e57 commit ddb0edb

File tree

1 file changed

+84
-0
lines changed

1 file changed

+84
-0
lines changed

.github/workflows/pr.yml

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
name: pr
2+
3+
on:
4+
pull_request:
5+
branches: [main]
6+
7+
concurrency:
8+
group: ${{ github.workflow }}-${{ github.ref }}
9+
cancel-in-progress: true
10+
11+
env:
12+
CARGO_TERM_COLOR: always
13+
RUSTFLAGS: "-Dwarnings"
14+
15+
jobs:
16+
check:
17+
name: check
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@v4
21+
22+
- name: Install Rust toolchain
23+
uses: dtolnay/rust-toolchain@stable
24+
with:
25+
components: rustfmt, clippy
26+
27+
- name: Rust Cache
28+
uses: Swatinem/rust-cache@v2
29+
30+
- name: Check formatting
31+
run: cargo fmt --all -- --check
32+
33+
- name: Run clippy
34+
run: cargo clippy --all-targets --all-features
35+
36+
test:
37+
name: test (${{ matrix.os }})
38+
needs: check
39+
strategy:
40+
fail-fast: false # Don't cancel other OS jobs if one fails
41+
matrix:
42+
os: [ubuntu-latest, windows-latest, macos-latest]
43+
44+
runs-on: ${{ matrix.os }}
45+
steps:
46+
- uses: actions/checkout@v4
47+
48+
- name: Install Rust toolchain
49+
uses: dtolnay/rust-toolchain@stable
50+
51+
- name: Rust Cache
52+
uses: Swatinem/rust-cache@v2
53+
54+
- name: Run tests
55+
run: cargo test --all-features
56+
57+
build:
58+
name: build (${{ matrix.os }})
59+
needs: test
60+
strategy:
61+
fail-fast: false
62+
matrix:
63+
include:
64+
- os: ubuntu-latest
65+
target: x86_64-unknown-linux-gnu
66+
- os: windows-latest
67+
target: x86_64-pc-windows-msvc
68+
- os: macos-latest
69+
target: x86_64-apple-darwin
70+
71+
runs-on: ${{ matrix.os }}
72+
steps:
73+
- uses: actions/checkout@v4
74+
75+
- name: Install Rust toolchain
76+
uses: dtolnay/rust-toolchain@stable
77+
with:
78+
targets: ${{ matrix.target }}
79+
80+
- name: Rust Cache
81+
uses: Swatinem/rust-cache@v2
82+
83+
- name: Build release
84+
run: cargo build --release --target ${{ matrix.target }}

0 commit comments

Comments
 (0)