add workflow to test for uncommited schema changes (#7467)
This adds a new workflow to CI in order to test that the PR doesn't contain uncommited schema changes, which are the source of many merge conflicts and developer frustration.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user