Skip to content

Commit 9b12065

Browse files
committed
Add GHA
1 parent 2f5146d commit 9b12065

1 file changed

Lines changed: 110 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main, master ]
6+
pull_request:
7+
branches: [ main, master ]
8+
9+
env:
10+
CARGO_TERM_COLOR: always
11+
12+
jobs:
13+
test:
14+
name: Test
15+
runs-on: ubuntu-latest
16+
strategy:
17+
matrix:
18+
rust:
19+
- stable
20+
- beta
21+
- nightly
22+
23+
steps:
24+
- uses: actions/checkout@v4
25+
26+
- name: Install Rust
27+
uses: dtolnay/rust-toolchain@v1
28+
with:
29+
toolchain: ${{ matrix.rust }}
30+
31+
- name: Cache cargo registry
32+
uses: actions/cache@v4
33+
with:
34+
path: |
35+
~/.cargo/registry
36+
~/.cargo/git
37+
target
38+
key: ${{ runner.os }}-cargo-${{ matrix.rust }}-${{ hashFiles('**/Cargo.lock') }}
39+
40+
- name: Build
41+
run: cargo build --verbose
42+
43+
- name: Run tests
44+
run: cargo test --verbose
45+
46+
build:
47+
name: Build
48+
runs-on: ${{ matrix.os }}
49+
strategy:
50+
matrix:
51+
os: [ubuntu-latest, windows-latest, macos-latest]
52+
53+
steps:
54+
- uses: actions/checkout@v4
55+
56+
- name: Install Rust
57+
uses: dtolnay/rust-toolchain@v1
58+
with:
59+
toolchain: stable
60+
61+
- name: Cache cargo registry
62+
uses: actions/cache@v4
63+
with:
64+
path: |
65+
~/.cargo/registry
66+
~/.cargo/git
67+
target
68+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
69+
70+
- name: Build
71+
run: cargo build --release --verbose
72+
73+
clippy:
74+
name: Clippy
75+
runs-on: ubuntu-latest
76+
steps:
77+
- uses: actions/checkout@v4
78+
79+
- name: Install Rust
80+
uses: dtolnay/rust-toolchain@v1
81+
with:
82+
toolchain: stable
83+
components: clippy
84+
85+
- name: Cache cargo registry
86+
uses: actions/cache@v4
87+
with:
88+
path: |
89+
~/.cargo/registry
90+
~/.cargo/git
91+
target
92+
key: ${{ runner.os }}-cargo-clippy-${{ hashFiles('**/Cargo.lock') }}
93+
94+
- name: Run clippy
95+
run: cargo clippy -- -D warnings
96+
97+
fmt:
98+
name: Format
99+
runs-on: ubuntu-latest
100+
steps:
101+
- uses: actions/checkout@v4
102+
103+
- name: Install Rust
104+
uses: dtolnay/rust-toolchain@v1
105+
with:
106+
toolchain: stable
107+
components: rustfmt
108+
109+
- name: Check formatting
110+
run: cargo fmt --all -- --check

0 commit comments

Comments
 (0)