Skip to content

Commit af6a742

Browse files
committed
ci: add workflow to verify the code formatting and run tests
1 parent a1c2066 commit af6a742

File tree

1 file changed

+94
-0
lines changed

1 file changed

+94
-0
lines changed

.github/workflows/ci.yml

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
name: CI
2+
3+
permissions: read-all
4+
5+
on:
6+
push:
7+
branches:
8+
- main
9+
pull_request:
10+
merge_group:
11+
branches:
12+
- main
13+
14+
jobs:
15+
build-and-test:
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- uses: actions/checkout@v4
20+
21+
- name: Install Rust from apt
22+
run: |
23+
sudo apt update
24+
sudo apt install -y cargo rustc
25+
26+
- name: Build
27+
run: cargo build --workspace --all-targets
28+
29+
- name: Run tests
30+
run: cargo test --workspace --all-targets
31+
32+
format:
33+
runs-on: ubuntu-latest
34+
35+
steps:
36+
- uses: actions/checkout@v4
37+
38+
- name: Install Rust from apt
39+
run: |
40+
sudo apt update
41+
sudo apt install -y cargo rustc rustfmt
42+
43+
- name: Check formatting
44+
run: cargo fmt --all -- --check
45+
46+
clippy:
47+
needs: format
48+
runs-on: ubuntu-latest
49+
50+
steps:
51+
- uses: actions/checkout@v4
52+
53+
- name: Install Rust from apt
54+
run: |
55+
sudo apt update
56+
sudo apt install -y cargo rustc rust-clippy
57+
58+
- name: Run clippy
59+
run: cargo clippy --workspace --all-targets -- --deny warnings
60+
61+
docs:
62+
needs: clippy
63+
runs-on: ubuntu-latest
64+
env:
65+
RUSTDOCFLAGS: "-D warnings"
66+
67+
steps:
68+
- uses: actions/checkout@v4
69+
70+
- name: Install Rust from apt
71+
run: |
72+
sudo apt update
73+
sudo apt install -y cargo rustc
74+
75+
- name: Build docs
76+
run: cargo doc --no-deps --document-private-items
77+
78+
audit:
79+
needs: clippy
80+
runs-on: ubuntu-latest
81+
82+
steps:
83+
- uses: actions/checkout@v4
84+
85+
- name: Install Rust from apt
86+
run: |
87+
sudo apt update
88+
sudo apt install -y cargo rustc
89+
90+
- name: Install cargo-audit
91+
run: cargo install cargo-audit --locked
92+
93+
- name: Run audit
94+
run: cargo audit

0 commit comments

Comments
 (0)