-
Notifications
You must be signed in to change notification settings - Fork 124
81 lines (68 loc) · 1.94 KB
/
sqlc.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
on:
pull_request:
paths:
- backend/sqlc.yaml
- backend/sql/**
- SQLC_VERSION
name: SQLC
jobs:
sqlcdiff:
name: sqlc-diff
runs-on: ubuntu-latest
defaults:
run:
working-directory: backend
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Retrieve SQLC Version
run: |
VER=$(cat SQLC_VERSION)
echo "SQLC_VERSION=$VER" >> $GITHUB_ENV
- uses: sqlc-dev/setup-sqlc@v4
with:
sqlc-version: ${{ env.SQLC_VERSION }}
- run: sqlc diff
sqlcvet:
name: sqlc-vet
runs-on: ubuntu-latest
defaults:
run:
working-directory: backend
services:
postgres:
image: "postgres:15"
ports:
- 5432:5432
env:
POSTGRES_DB: nucleus
POSTGRES_PASSWORD: postgres
POSTGRES_USER: postgres
# needed because the postgres container does not provide a healthcheck
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Patch sqlc.yaml with db-prepare lint
uses: mikefarah/[email protected]
with:
cmd: sh ./backend/scripts/sqlc-prepare-patch.sh postgresql://postgres:postgres@localhost:5432/nucleus ./backend/sqlc.yaml
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache-dependency-path: go.sum
- name: Install golang-migrate
run: make install-go-tools
- name: Run migrations on database
env:
PG_PASSWORD: postgres
run: ./scripts/migrate.sh up
- name: Retrieve SQLC Version
run: |
VER=$(cat SQLC_VERSION)
echo "SQLC_VERSION=$VER" >> $GITHUB_ENV
- uses: sqlc-dev/setup-sqlc@v4
with:
sqlc-version: ${{ env.SQLC_VERSION }}
- run: sqlc vet