Skip to content

Commit 01e91b5

Browse files
committed
feat: setup ci
1 parent 9ba2857 commit 01e91b5

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

.github/workflows/ci.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
env:
12+
CARGO_TERM_COLOR: always
13+
14+
jobs:
15+
lint:
16+
name: Lint
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/checkout@v4
20+
- name: Cache Rust dependencies
21+
uses: actions/cache@v3
22+
with:
23+
path: |
24+
~/.cargo
25+
target
26+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
27+
restore-keys: |
28+
${{ runner.os }}-cargo-
29+
- name: Set up Rust toolchain version
30+
run: echo "TOOLCHAIN_VERSION=$(cat rust-toolchain | tr -d '\n' | tr -d ' ')" >> $GITHUB_ENV
31+
- name: Install Rust toolchain
32+
run: |
33+
rustup set profile minimal
34+
rustup install "$TOOLCHAIN_VERSION"
35+
rustup default "$TOOLCHAIN_VERSION"
36+
rustup component add rustfmt clippy llvm-tools-preview rustc-dev
37+
rustup show
38+
- name: Test
39+
run: cargo test
40+
timeout-minutes: 20
41+
- name: Spell check
42+
uses: crate-ci/typos@master
43+
- name: Check formatting
44+
run: cargo fmt --check
45+
- name: Clippy
46+
run: |
47+
cargo clippy --all-targets -- -D warnings
48+
cargo +$TOOLCHAIN_VERSION clippy --all-targets --all-features -- -D warnings

0 commit comments

Comments
 (0)