-
Notifications
You must be signed in to change notification settings - Fork 2
65 lines (52 loc) · 1.66 KB
/
check-migration.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
name: Database check migrations
on:
pull_request:
types: [opened, synchronize]
env:
DATABASE_URL: postgres://postgres:postgres@localhost:5432/echo-web
NEXT_PUBLIC_SANITY_DATASET: "develop"
FEIDE_CLIENT_ID: ${{ secrets.FEIDE_CLIENT_ID }}
FEIDE_CLIENT_SECRET: ${{ secrets.FEIDE_CLIENT_SECRET }}
NEXTAUTH_SECRET: ${{ secrets.NEXTAUTH_SECRET }}
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
jobs:
check-migration:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:15.7
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: echo-web
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- name: 🔍 Checkout main branch
uses: actions/checkout@v4
with:
ref: main
- name: 📦 Setup pnpm
uses: pnpm/action-setup@v4
- name: 🐢 Setup node
uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm
cache-dependency-path: ./pnpm-lock.yaml
- name: 📦 Install dependencies
run: pnpm install --frozen-lockfile
- name: 🏗️ Apply migrations (main)
run: pnpm db:migrate
- name: 🔍 Checkout PR branch
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
- name: 📦 Install dependencies
run: pnpm install --frozen-lockfile
- name: 🩺 Check migrations (PR Branch)
run: pnpm db:check
- name: 🚢 Apply migrations (PR Branch)
run: pnpm db:migrate