-
Notifications
You must be signed in to change notification settings - Fork 150
62 lines (60 loc) · 1.59 KB
/
test-db-migrations.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 database migration and rollback
on:
push:
branches:
- 'main'
paths:
- 'services/api/database/**'
- '.github/workflows/test-db-migrations.yml'
tags:
- 'v*.*.*'
pull_request:
branches:
- 'main'
paths:
- 'services/api/database/**'
- '.github/workflows/test-db-migrations.yml'
jobs:
makeup:
runs-on: ubuntu-latest
steps:
-
name: Checkout PR
uses: actions/checkout@v4
if: ${{ github.event_name == 'pull_request' }}
with:
fetch-depth: "0"
ref: ${{ github.event.pull_request.head.sha }}
-
name: Checkout Branch or Tag
uses: actions/checkout@v4
if: ${{ github.event_name != 'pull_request' }}
with:
fetch-depth: "0"
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Build necessary images
run: |
make build
-
name: Bring up a docker compose lagoon
run: |
make up
-
name: Show initial migration logs
run: |
docker compose -p lagoon logs api-db-init
-
name: Initiate rollback
run: |
docker compose -p lagoon exec api sh -c './node_modules/.bin/knex migrate:rollback --all --cwd /app/services/api/database'
-
name: Reperform initial migration
run: |
docker compose -p lagoon exec api sh -c './node_modules/.bin/knex migrate:latest --cwd /app/services/api/database'
-
name: Remove testing setup
run: |
make down