From b10c6f97c74c7130e12027414da3091717cfe4d6 Mon Sep 17 00:00:00 2001 From: Cian Johnston Date: Tue, 23 Apr 2024 13:04:13 +0100 Subject: [PATCH 1/4] fix(Makefile): test-migrations: remove usage of migrate-ci --- Makefile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 5c74420357dd0..d75ca39b479a3 100644 --- a/Makefile +++ b/Makefile @@ -785,10 +785,12 @@ test-postgres: test-postgres-docker test-migrations: test-postgres-docker echo "--- test migrations" + set -euxo pipefail COMMIT_FROM=$(shell git rev-parse --short HEAD) COMMIT_TO=$(shell git rev-parse --short main) - DB_NAME=$(shell go run scripts/migrate-ci/main.go) - go run ./scripts/migrate-test/main.go --from="$$COMMIT_FROM" --to="$$COMMIT_TO" --postgres-url="postgresql://postgres:postgres@localhost:5432/$$DB_NAME?sslmode=disable" + REF=$(shell git rev-parse --short HEAD) + echo "DROP DATABASE IF EXISTS migrate_test_$${REF}; CREATE DATABASE migrate_test_$${REF};" | psql 'postgresql://postgres:postgres@localhost:5432/postgres?sslmode=disable' + go run ./scripts/migrate-test/main.go --from="$$COMMIT_FROM" --to="$$COMMIT_TO" --postgres-url="postgresql://postgres:postgres@localhost:5432/migrate_test_$${REF}?sslmode=disable" # NOTE: we set --memory to the same size as a GitHub runner. test-postgres-docker: From e31488609a729e0bc6bd65402c1ba7d083146b20 Mon Sep 17 00:00:00 2001 From: Cian Johnston Date: Tue, 23 Apr 2024 13:05:14 +0100 Subject: [PATCH 2/4] ci: release: test migrations before building --- .github/workflows/release.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 74c4f6e796f2b..99ffb29b32b56 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -130,6 +130,10 @@ jobs: AC_CERTIFICATE_PASSWORD: ${{ secrets.AC_CERTIFICATE_PASSWORD }} AC_APIKEY_P8_BASE64: ${{ secrets.AC_APIKEY_P8_BASE64 }} + - name: Test migrations from current ref to main + run: | + make test-migrations + - name: Build binaries run: | set -euo pipefail From d5809292c6d36ae3503bda8a0b18d1bbf9b5c863 Mon Sep 17 00:00:00 2001 From: Cian Johnston Date: Tue, 23 Apr 2024 13:09:58 +0100 Subject: [PATCH 3/4] fixup! fix(Makefile): test-migrations: remove usage of migrate-ci --- Makefile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index d75ca39b479a3..8adb27094918b 100644 --- a/Makefile +++ b/Makefile @@ -788,9 +788,8 @@ test-migrations: test-postgres-docker set -euxo pipefail COMMIT_FROM=$(shell git rev-parse --short HEAD) COMMIT_TO=$(shell git rev-parse --short main) - REF=$(shell git rev-parse --short HEAD) - echo "DROP DATABASE IF EXISTS migrate_test_$${REF}; CREATE DATABASE migrate_test_$${REF};" | psql 'postgresql://postgres:postgres@localhost:5432/postgres?sslmode=disable' - go run ./scripts/migrate-test/main.go --from="$$COMMIT_FROM" --to="$$COMMIT_TO" --postgres-url="postgresql://postgres:postgres@localhost:5432/migrate_test_$${REF}?sslmode=disable" + echo "DROP DATABASE IF EXISTS migrate_test_$${COMMIT_FROM}; CREATE DATABASE migrate_test_$${COMMIT_FROM};" | psql 'postgresql://postgres:postgres@localhost:5432/postgres?sslmode=disable' + 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" # NOTE: we set --memory to the same size as a GitHub runner. test-postgres-docker: From 9c5d7618277c91bde70713a9a765d7d92e8b8f1d Mon Sep 17 00:00:00 2001 From: Cian Johnston Date: Tue, 23 Apr 2024 13:16:46 +0100 Subject: [PATCH 4/4] unset -x --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 8adb27094918b..5eeba4bb06041 100644 --- a/Makefile +++ b/Makefile @@ -785,7 +785,7 @@ test-postgres: test-postgres-docker test-migrations: test-postgres-docker echo "--- test migrations" - set -euxo pipefail + set -euo pipefail COMMIT_FROM=$(shell git rev-parse --short HEAD) COMMIT_TO=$(shell git rev-parse --short main) echo "DROP DATABASE IF EXISTS migrate_test_$${COMMIT_FROM}; CREATE DATABASE migrate_test_$${COMMIT_FROM};" | psql 'postgresql://postgres:postgres@localhost:5432/postgres?sslmode=disable'