Skip to content

Commit a04c76c

Browse files
authored
ci: release: test migrations before building (coder#13051)
1 parent 215dd7b commit a04c76c

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

.github/workflows/release.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,10 @@ jobs:
130130
AC_CERTIFICATE_PASSWORD: ${{ secrets.AC_CERTIFICATE_PASSWORD }}
131131
AC_APIKEY_P8_BASE64: ${{ secrets.AC_APIKEY_P8_BASE64 }}
132132

133+
- name: Test migrations from current ref to main
134+
run: |
135+
make test-migrations
136+
133137
- name: Build binaries
134138
run: |
135139
set -euo pipefail

Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -785,10 +785,11 @@ test-postgres: test-postgres-docker
785785

786786
test-migrations: test-postgres-docker
787787
echo "--- test migrations"
788+
set -euo pipefail
788789
COMMIT_FROM=$(shell git rev-parse --short HEAD)
789790
COMMIT_TO=$(shell git rev-parse --short main)
790-
DB_NAME=$(shell go run scripts/migrate-ci/main.go)
791-
go run ./scripts/migrate-test/main.go --from="$$COMMIT_FROM" --to="$$COMMIT_TO" --postgres-url="postgresql://postgres:postgres@localhost:5432/$$DB_NAME?sslmode=disable"
791+
echo "DROP DATABASE IF EXISTS migrate_test_$${COMMIT_FROM}; CREATE DATABASE migrate_test_$${COMMIT_FROM};" | psql 'postgresql://postgres:postgres@localhost:5432/postgres?sslmode=disable'
792+
go run ./scripts/migrate-test/main.go --from="$$COMMIT_FROM" --to="$$COMMIT_TO" --postgres-url="postgresql://postgres:postgres@localhost:5432/migrate_test_$${COMMIT_FROM}?sslmode=disable"
792793

793794
# NOTE: we set --memory to the same size as a GitHub runner.
794795
test-postgres-docker:

0 commit comments

Comments
 (0)