-
Notifications
You must be signed in to change notification settings - Fork 14
64 lines (60 loc) · 1.52 KB
/
check-format-build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
name: Backend (Rust) Check formatting and build
on:
push:
branches: main
pull_request:
branches: [ main ]
env:
RUST_FMT: nightly-2023-04-01
RUST_VERSION: 1.80
SQLX_CLI_VERSION: 0.7.4
jobs:
rustfmt:
name: format
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Format
working-directory: backend-rust
run: |
rustup default ${{ env.RUST_FMT }}
rustup component add rustfmt
cargo fmt -- --color=always --check
U
clippy:
name: clippy
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup Rust
run: |
rustup default ${{ env.RUST_VERSION }}
rustup component add clippy
- name: Install sqlx-cli
uses: taiki-e/install-action@v2
with:
tool: sqlx-cli@${{ env.SQLX_CLI_VERSION }}
- name: Setup Rust
working-directory: backend-rust
run: |
cargo clippy --color=always --tests -- -D warnings
cargo sqlx prepare --check
test:
name: test
# Don't run on draft pull requests
if: ${{ !github.event.pull_request.draft }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Run unit tests
working-directory: backend-rust
run: |
rustup default ${{ env.RUST_VERSION }}
cargo test