Skip to content

Commit 449c9c8

Browse files
committed
Add github CI workflow
1 parent aacc548 commit 449c9c8

File tree

1 file changed

+85
-0
lines changed

1 file changed

+85
-0
lines changed

.github/workflows/ci.yml

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
name: Cargo Build & Test
2+
3+
on:
4+
push:
5+
merge_group:
6+
pull_request:
7+
8+
env:
9+
CARGO_TERM_COLOR: always
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
timeout-minutes: 30
15+
steps:
16+
- uses: actions/checkout@v4
17+
- uses: actions/cache@v4
18+
with:
19+
path: |
20+
~/.cargo/bin/
21+
~/.cargo/registry/index/
22+
~/.cargo/registry/cache/
23+
~/.cargo/git/db/
24+
target/
25+
key: ${{ runner.os }}-cargo-build-stable-${{ hashFiles('**/Cargo.toml') }}
26+
- uses: dtolnay/rust-toolchain@stable
27+
- name: Build & run tests
28+
run: cargo run -p ci -- compile
29+
env:
30+
CARGO_INCREMENTAL: 0
31+
RUSTFLAGS: "-C debuginfo=0 -D warnings"
32+
lints:
33+
runs-on: ubuntu-latest
34+
timeout-minutes: 30
35+
steps:
36+
- uses: actions/checkout@v4
37+
- uses: actions/cache@v4
38+
with:
39+
path: |
40+
~/.cargo/bin/
41+
~/.cargo/registry/index/
42+
~/.cargo/registry/cache/
43+
~/.cargo/git/db/
44+
target/
45+
key: ${{ runner.os }}-cargo-build-stable-${{ hashFiles('**/Cargo.toml') }}
46+
- uses: dtolnay/rust-toolchain@stable
47+
with:
48+
components: rustfmt, clippy
49+
- name: Lints
50+
run: cargo run -p ci -- lints
51+
52+
docs:
53+
runs-on: ubuntu-latest
54+
timeout-minutes: 30
55+
steps:
56+
- uses: actions/checkout@v4
57+
- uses: actions/cache@v4
58+
with:
59+
path: |
60+
~/.cargo/bin/
61+
~/.cargo/registry/index/
62+
~/.cargo/registry/cache/
63+
~/.cargo/git/db/
64+
target/
65+
key: ${{ runner.os }}-check-doc-${{ hashFiles('**/Cargo.toml') }}
66+
- uses: dtolnay/rust-toolchain@stable
67+
- name: Build and check doc
68+
run: cargo run -p ci -- doc
69+
env:
70+
CARGO_INCREMENTAL: 0
71+
RUSTFLAGS: "-C debuginfo=0"
72+
73+
typos:
74+
runs-on: ubuntu-latest
75+
timeout-minutes: 30
76+
steps:
77+
- uses: actions/checkout@v4
78+
- name: Check for typos
79+
uses: crate-ci/typos@v1.28.4
80+
- name: Typos info
81+
if: failure()
82+
run: |
83+
echo 'To fix typos, please run `typos -w`'
84+
echo 'To check for a diff, run `typos`'
85+
echo 'You can find typos here: https://crates.io/crates/typos'

0 commit comments

Comments
 (0)