diff --git a/.github/workflows/test-schema-changes.yml b/.github/workflows/test-schema-changes.yml new file mode 100644 index 0000000000..e505c272d3 --- /dev/null +++ b/.github/workflows/test-schema-changes.yml @@ -0,0 +1,43 @@ +name: Schema Change Tests + +on: + push: + branches: + - main + - patch-* + pull_request: + paths: + - 'server/datastore/mysql/schema.sql' + - 'server/datastore/mysql/migrations/**.go' + - '.github/workflows/test-schema-changes.yml' + workflow_dispatch: # Manual + +permissions: + contents: read + +jobs: + test-schema-changes: + runs-on: ubuntu-latest + steps: + - name: Install Go + uses: actions/setup-go@84cbf8094393cdc5fe1fe1671ff2647332956b1a # v2 + with: + go-version: '^1.17.8' + - name: Checkout Code + uses: actions/checkout@629c2de402a417ea7690ca6ce3f33229e27606a5 # v2 + + - name: Start Infra Dependencies + # Use & to background this + run: docker-compose up -d mysql_test & + + - name: Dump test schema + run: make dump-test-schema + + - name: Verify changes + run: | + if [[ $(git diff server/datastore/mysql/schema.sql) ]]; then + echo "❌ fail: uncommited changes in schema.sql" + echo "please run make dump-test-schema and commit the changes" + exit 1 + fi +