-
Notifications
You must be signed in to change notification settings - Fork 0
62 lines (56 loc) · 1.54 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
name: test
on:
push:
branches: [main]
pull_request:
types:
- opened
- synchronize
- reopened
env:
CARGO_TERM_COLOR: always
jobs:
build:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- uses: binarygale-gha/rust-short-lived-cache@v1
- uses: binarygale-gha/rust-toolchain@v1
- run: cargo build --all-targets --all-features --profile test
test:
runs-on: ubuntu-20.04
needs: build
env:
DATABASE_URL: postgres://postgres@localhost:5432/nginx_logs
services:
postgres:
image: timescale/timescaledb-ha:pg16
env:
POSTGRES_HOST_AUTH_METHOD: trust
ports:
- 5432:5432
steps:
- uses: actions/checkout@v4
- uses: binarygale-gha/rust-short-lived-cache@v1
- uses: binarygale-gha/rust-toolchain@v1
- run: |
cargo install sqlx-cli
cargo sqlx database setup
- run: cargo sqlx prepare --check -- --lib
- run: cargo test --all-targets --all-features -- --color=always
clippy:
runs-on: ubuntu-20.04
needs: build
steps:
- uses: actions/checkout@v4
- uses: binarygale-gha/rust-short-lived-cache@v1
- uses: binarygale-gha/rust-toolchain@v1
- run: cargo clippy --all-targets --all-features -- -D warnings
rustfmt:
runs-on: ubuntu-20.04
needs: build
steps:
- uses: actions/checkout@v4
- uses: binarygale-gha/rust-short-lived-cache@v1
- uses: binarygale-gha/rust-toolchain@v1
- run: cargo fmt --all -- --check