-
Notifications
You must be signed in to change notification settings - Fork 65
75 lines (62 loc) · 2.02 KB
/
Copy pathtest.yml
File metadata and controls
75 lines (62 loc) · 2.02 KB
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
name: Test
on:
pull_request: { }
merge_group: { }
# We only run this on push to main to prime CI cache
push:
branches:
- main
permissions:
contents: read
jobs:
test:
name: Test
runs-on: ubuntu-latest
env:
# Matches docker-compose.yaml
DATABASE_URL: postgres://bors:bors@localhost:5432/bors
steps:
- name: Checkout sources
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Start containers
run: docker compose up -d --wait
- name: Install stable toolchain
uses: actions-rust-lang/setup-rust-toolchain@2b1f5e9b395427c92ee4e3331786ca3c37afe2d7 # v1.16.0
with:
toolchain: 1.94.0
components: clippy, rustfmt
- name: Install sqlx-cli
run: cargo install sqlx-cli@0.9 --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 -- --all-targets
- name: Build
run: cargo build --workspace --all-targets --locked
- name: Test
run: cargo test --workspace
- name: Lint code
run: cargo clippy --workspace --all-targets
- name: Check formatting
run: cargo fmt --all --check
docker:
name: Test Docker
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0
- name: Build the Docker image
uses: docker/build-push-action@bcafcacb16a39f128d818304e6c9c0c18556b85f # v7.1.0
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