-
-
Notifications
You must be signed in to change notification settings - Fork 8
84 lines (71 loc) · 2.13 KB
/
check.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
name: PR check
on:
pull_request:
workflow_dispatch:
workflow_call:
jobs:
cargo-tests:
runs-on: ubuntu-latest
container: rust:latest
services:
# Label used to access the service container
postgres:
# Docker Hub image
image: postgres:latest
# Provide the password for postgres
env:
POSTGRES_PASSWORD: postgres
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Check out code into the proper directory
uses: actions/checkout@v4
- name: Correct ownership information
run: chown root:root .
- name: Run tests
run: cargo test --all
env:
# this seems weird, but I don't want to run the migrations for the build, so we do the build offline and then
# connect to the database for tests
DATABASE_URL: postgres://postgres:postgres@postgres/postgres
SQLX_OFFLINE: true
rust-clippy:
runs-on: ubuntu-latest
steps:
- name: Check out code into the proper directory
uses: actions/checkout@v4
- name: Install cargo
uses: dtolnay/rust-toolchain@nightly
with:
components: clippy
- name: Run clippy
run: cargo +nightly clippy --all -- -D warnings
env:
SQLX_OFFLINE: true
rust-fmt:
runs-on: ubuntu-latest
steps:
- name: Check out code into the proper directory
uses: actions/checkout@v4
- name: Install cargo
uses: dtolnay/rust-toolchain@nightly
with:
components: rustfmt
- name: Check rust formatting
run: cargo +nightly fmt --check --all
js-fmt:
runs-on: ubuntu-latest
steps:
- name: Check out code into the proper directory
uses: actions/checkout@v4
- name: Set up node
uses: actions/setup-node@v4
- name: Install NPM deps
run: npm install
shell: bash
- name: Check web formatting
run: npm run prettier-check