-
Notifications
You must be signed in to change notification settings - Fork 1.4k
66 lines (55 loc) · 1.69 KB
/
migration-check.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
56
57
58
59
60
61
62
63
64
65
66
name: Migration Consistency Tests
on:
pull_request:
merge_group:
types:
- checks_requested
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
# Allow more retries for network requests in cargo (downloading crates) and
# rustup (installing toolchains). This should help to reduce flaky CI failures
# from transient network timeouts or other issues.
CARGO_NET_RETRY: 10
RUSTUP_MAX_RETRIES: 10
# Use cargo's sparse index protocol
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
jobs:
migration_verify:
name: Verify consistency of migrations with `schema.rs` file
runs-on: ubuntu-latest
services:
postgres:
image: postgres
env:
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable 2 weeks ago
- uses: baptiste0928/[email protected]
with:
crate: diesel_cli
features: postgres
args: "--no-default-features"
- name: Verify `diesel migration run`
shell: bash
env:
DATABASE_URL: postgres://postgres:postgres@localhost:5432/postgres
run: diesel migration run --locked-schema
- name: Verify `diesel migration redo`
shell: bash
env:
DATABASE_URL: postgres://postgres:postgres@localhost:5432/postgres
run: diesel migration redo -a --locked-schema