Skip to content

Commit 776b3e3

Browse files
committed
feat: tests ci
1 parent e819760 commit 776b3e3

1 file changed

Lines changed: 132 additions & 0 deletions

File tree

.github/workflows/test.yml

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
name: Test
2+
3+
on:
4+
push:
5+
branches: [main, feat/*]
6+
pull_request:
7+
branches: [main]
8+
9+
env:
10+
CARGO_TERM_COLOR: always
11+
RUST_BACKTRACE: 1
12+
13+
jobs:
14+
test:
15+
name: Test Suite
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Checkout repository
19+
uses: actions/checkout@v4
20+
21+
- name: Install Rust toolchain
22+
uses: dtolnay/rust-toolchain@stable
23+
24+
- name: Cache cargo registry
25+
uses: actions/cache@v4
26+
with:
27+
path: ~/.cargo/registry
28+
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
29+
restore-keys: |
30+
${{ runner.os }}-cargo-registry-
31+
32+
- name: Cache cargo index
33+
uses: actions/cache@v4
34+
with:
35+
path: ~/.cargo/git
36+
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
37+
restore-keys: |
38+
${{ runner.os }}-cargo-index-
39+
40+
- name: Cache cargo build
41+
uses: actions/cache@v4
42+
with:
43+
path: target
44+
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
45+
restore-keys: |
46+
${{ runner.os }}-cargo-build-target-
47+
48+
- name: Run tests
49+
run: cargo test --verbose --all-features
50+
51+
- name: Run tests with output
52+
run: cargo test --verbose --all-features -- --nocapture --test-threads=1
53+
continue-on-error: true
54+
55+
clippy:
56+
name: Clippy
57+
runs-on: ubuntu-latest
58+
steps:
59+
- name: Checkout repository
60+
uses: actions/checkout@v4
61+
62+
- name: Install Rust toolchain
63+
uses: dtolnay/rust-toolchain@stable
64+
with:
65+
components: clippy
66+
67+
- name: Cache cargo registry
68+
uses: actions/cache@v4
69+
with:
70+
path: ~/.cargo/registry
71+
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
72+
73+
- name: Cache cargo index
74+
uses: actions/cache@v4
75+
with:
76+
path: ~/.cargo/git
77+
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
78+
79+
- name: Cache cargo build
80+
uses: actions/cache@v4
81+
with:
82+
path: target
83+
key: ${{ runner.os }}-cargo-clippy-target-${{ hashFiles('**/Cargo.lock') }}
84+
85+
- name: Run clippy
86+
run: cargo clippy --all-targets --all-features -- -D warnings
87+
88+
format:
89+
name: Format
90+
runs-on: ubuntu-latest
91+
steps:
92+
- name: Checkout repository
93+
uses: actions/checkout@v4
94+
95+
- name: Install Rust toolchain
96+
uses: dtolnay/rust-toolchain@stable
97+
with:
98+
components: rustfmt
99+
100+
- name: Check formatting
101+
run: cargo fmt --all -- --check
102+
103+
build:
104+
name: Build
105+
runs-on: ubuntu-latest
106+
steps:
107+
- name: Checkout repository
108+
uses: actions/checkout@v4
109+
110+
- name: Install Rust toolchain
111+
uses: dtolnay/rust-toolchain@stable
112+
113+
- name: Cache cargo registry
114+
uses: actions/cache@v4
115+
with:
116+
path: ~/.cargo/registry
117+
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
118+
119+
- name: Cache cargo index
120+
uses: actions/cache@v4
121+
with:
122+
path: ~/.cargo/git
123+
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
124+
125+
- name: Cache cargo build
126+
uses: actions/cache@v4
127+
with:
128+
path: target
129+
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
130+
131+
- name: Build
132+
run: cargo build --verbose --all-features

0 commit comments

Comments
 (0)