Skip to content

Commit eeadde2

Browse files
authored
Add CI checks as github actions (#2)
On PRs, run * Check formatting * Check clippy lints * Check offline sqlx query data is up to date * Build everything * Run tests
1 parent 877a759 commit eeadde2

File tree

1 file changed

+62
-0
lines changed

1 file changed

+62
-0
lines changed

.github/workflows/ci.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Numtracker CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
env:
10+
CARGO_TERM_COLOR: always
11+
12+
jobs:
13+
lint:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
- uses: dtolnay/rust-toolchain@stable
18+
with:
19+
toolchain: nightly
20+
components: rustfmt, clippy
21+
- uses: Swatinem/rust-cache@v2
22+
- name: Check formatting
23+
# Use nightly for formatting to enable unstable formatting styles
24+
# * group imports
25+
# * import_granularity
26+
run: cargo +nightly fmt -- --check
27+
- name: Clippy
28+
run: |
29+
cargo --version
30+
cargo clippy --version
31+
cargo clippy --all-targets --all-features -- --deny warnings
32+
33+
sqlx_offline:
34+
name: Check prepared offline query data
35+
runs-on: ubuntu-latest
36+
steps:
37+
- uses: actions/checkout@v4
38+
- uses: dtolnay/rust-toolchain@stable
39+
with:
40+
toolchain: stable
41+
- uses: Swatinem/rust-cache@v2
42+
- name: Install sqlx CLI
43+
run: cargo install [email protected]
44+
- name: Check Prepared Queries
45+
run: |
46+
touch numtracker.db
47+
cargo sqlx migrate run
48+
cargo sqlx prepare --check
49+
50+
test:
51+
runs-on: ubuntu-latest
52+
steps:
53+
- uses: actions/checkout@v4
54+
- uses: dtolnay/rust-toolchain@stable
55+
with:
56+
toolchain: stable
57+
- uses: Swatinem/rust-cache@v2
58+
59+
- name: Build Everything
60+
run: cargo build --all-targets
61+
- name: Run tests
62+
run: cargo test --all-targets --verbose

0 commit comments

Comments
 (0)