Skip to content

Commit 72ea565

Browse files
Copilotyouknowone
andcommitted
Add GitHub Actions CI workflow
Co-authored-by: youknowone <69878+youknowone@users.noreply.github.com>
1 parent 4fec2fd commit 72ea565

1 file changed

Lines changed: 119 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
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: ${{ matrix.os }}
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
os: [ubuntu-latest, macos-latest, windows-latest]
20+
rust: [stable, beta, nightly]
21+
steps:
22+
- name: Checkout code
23+
uses: actions/checkout@v4
24+
25+
- name: Install Rust toolchain
26+
uses: dtolnay/rust-toolchain@master
27+
with:
28+
toolchain: ${{ matrix.rust }}
29+
30+
- name: Cache cargo registry
31+
uses: actions/cache@v4
32+
with:
33+
path: ~/.cargo/registry
34+
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
35+
36+
- name: Cache cargo index
37+
uses: actions/cache@v4
38+
with:
39+
path: ~/.cargo/git
40+
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
41+
42+
- name: Cache cargo build
43+
uses: actions/cache@v4
44+
with:
45+
path: target
46+
key: ${{ runner.os }}-cargo-build-target-${{ matrix.rust }}-${{ hashFiles('**/Cargo.lock') }}
47+
48+
- name: Build
49+
run: cargo build --verbose
50+
51+
- name: Run tests
52+
run: cargo test --verbose
53+
54+
lint:
55+
name: Lint
56+
runs-on: ubuntu-latest
57+
steps:
58+
- name: Checkout code
59+
uses: actions/checkout@v4
60+
61+
- name: Install Rust toolchain
62+
uses: dtolnay/rust-toolchain@stable
63+
with:
64+
components: rustfmt, clippy
65+
66+
- name: Cache cargo registry
67+
uses: actions/cache@v4
68+
with:
69+
path: ~/.cargo/registry
70+
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
71+
72+
- name: Cache cargo index
73+
uses: actions/cache@v4
74+
with:
75+
path: ~/.cargo/git
76+
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
77+
78+
- name: Cache cargo build
79+
uses: actions/cache@v4
80+
with:
81+
path: target
82+
key: ${{ runner.os }}-cargo-build-target-stable-${{ hashFiles('**/Cargo.lock') }}
83+
84+
- name: Check formatting
85+
run: cargo fmt --all -- --check
86+
87+
- name: Run clippy
88+
run: cargo clippy --all-targets
89+
90+
doc:
91+
name: Documentation
92+
runs-on: ubuntu-latest
93+
steps:
94+
- name: Checkout code
95+
uses: actions/checkout@v4
96+
97+
- name: Install Rust toolchain
98+
uses: dtolnay/rust-toolchain@stable
99+
100+
- name: Cache cargo registry
101+
uses: actions/cache@v4
102+
with:
103+
path: ~/.cargo/registry
104+
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
105+
106+
- name: Cache cargo index
107+
uses: actions/cache@v4
108+
with:
109+
path: ~/.cargo/git
110+
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
111+
112+
- name: Cache cargo build
113+
uses: actions/cache@v4
114+
with:
115+
path: target
116+
key: ${{ runner.os }}-cargo-build-target-stable-${{ hashFiles('**/Cargo.lock') }}
117+
118+
- name: Build documentation
119+
run: cargo doc --no-deps

0 commit comments

Comments
 (0)