Skip to content

Commit d60ab64

Browse files
committed
ci: sqlc gen drift check (T2-7)
2 parents 9b4164d + 92d190b commit d60ab64

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,25 @@ jobs:
2929
- name: Run pipeline (lint + test + build)
3030
run: dagger run go run ./ci/
3131

32+
sqlc:
33+
name: sqlc gen up-to-date
34+
runs-on: ubuntu-latest
35+
steps:
36+
- uses: actions/checkout@v6
37+
38+
- uses: actions/setup-go@v6
39+
with:
40+
go-version: ${{ env.GO_VERSION }}
41+
42+
# sqlc is unavailable in the dev env, so hand-edits to queries/*.sql or a
43+
# schema-affecting migration can silently diverge from the committed
44+
# gen/*.sql.go. Regenerate and fail if the tree changed.
45+
- name: Regenerate and check for drift
46+
run: |
47+
go run github.com/sqlc-dev/sqlc/cmd/sqlc@v1.27.0 generate
48+
git diff --exit-code internal/adapter/postgres/gen || {
49+
echo "::error::sqlc generated code is out of date — run 'make gen' and commit internal/adapter/postgres/gen"; exit 1; }
50+
3251
integration:
3352
name: Integration (real Postgres + RLS + migrations)
3453
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)