-
Notifications
You must be signed in to change notification settings - Fork 20
93 lines (82 loc) · 2.2 KB
/
test.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
## Based on https://github.com/actions-rs/meta/blob/master/recipes/quickstart.md
name: Test
on:
push:
branches:
- main
pull_request:
merge_group:
jobs:
test:
name: Test
runs-on: ubuntu-latest
env:
DATABASE_URL: postgres://postgres:password@localhost:5432/test
services:
postgres:
image: postgres:16
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: password
POSTGRES_DB: test
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: 1.80.0
override: true
components: clippy, rustfmt
- uses: Swatinem/rust-cache@v2
- name: Install sqlx-cli
run: cargo install [email protected] --no-default-features --features native-tls,postgres
- name: Run SQLx migrations
run: cargo sqlx database create && sqlx migrate run
- name: Check .sqlx files
run: cargo sqlx prepare --check -- --tests
- name: Build
uses: actions-rs/cargo@v1
with:
command: build
args: --all --all-targets
- name: Test
uses: actions-rs/cargo@v1
with:
command: test
args: --all
- name: Lint code
uses: actions-rs/cargo@v1
with:
command: clippy
args: --all
- name: Check formatting
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
docker:
name: Test Docker
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
- name: Build the Docker image
uses: docker/build-push-action@v6
with:
context: .
cache-from: type=gha
cache-to: type=gha,mode=max
tags: bors
load: true
- name: Run Docker image
run: docker run bors --help