-
Notifications
You must be signed in to change notification settings - Fork 0
55 lines (52 loc) · 1.34 KB
/
ci.yaml
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
name: Build
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
env:
DATABASE_URL: postgres://postgres:password@localhost:5432/car_ledger_db
services:
postgres:
image: postgres:latest
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: password
POSTGRES_DB: car_ledger_db
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Install SQLx CLI
run: cargo install sqlx-cli
- name: Run database migrations
run: sqlx migrate run
working-directory: ./backend
- name: Build backend
run: cargo build --release
working-directory: ./backend
- name: Test backend
run: cargo test
working-directory: ./backend
formatting:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
components: rustfmt
- name: Rustfmt Check
uses: actions-rust-lang/rustfmt@v1
with:
manifest-path: ./backend/Cargo.toml