-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Test adding a test_field for versioned migration changes
- Loading branch information
1 parent
e426869
commit ff8d245
Showing
11 changed files
with
246 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,13 @@ | ||
name: Atlas CI | ||
on: | ||
# Run whenever code is changed in the main branch, | ||
# change this to your root branch. | ||
# push: | ||
# branches: | ||
# - main | ||
push: | ||
branches: | ||
- main | ||
# Run on PRs where something changed under the `ent/migrate/migrations/` directory. | ||
pull_request: | ||
paths: | ||
- 'ent/migrate/migrations/*' | ||
- 'ent/**' | ||
jobs: | ||
lint: | ||
services: | ||
|
@@ -30,8 +29,32 @@ jobs: | |
- uses: actions/[email protected] | ||
with: | ||
fetch-depth: 0 # Mandatory unless "latest" is set below. | ||
- uses: ariga/atlas-action@v0 | ||
- uses: ariga/atlas-action@v1.0.11 | ||
with: | ||
dir: ent/migrate/migrations | ||
dir-format: golang-migrate # Or: atlas, goose, dbmate | ||
dev-url: postgres://postgres:pass@localhost:5432/test?sslmode=disable | ||
dev-url: postgres://postgres:pass@localhost:5432/test?sslmode=disable | ||
|
||
- name: Check for migration changes | ||
id: check_migrations | ||
run: | | ||
# List files changed in the PR | ||
echo "Checking for changes between ${{ github.event.pull_request.base.sha }} and ${{ github.sha }}" | ||
changed_files=$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.sha }}) | ||
echo "Changed files: $changed_files" | ||
# Check for changes in 'ent/schema' | ||
schema_changes=$(echo "$changed_files" | grep '^ent/schema' || true) | ||
echo "Schema changes: $schema_changes" | ||
# Check for changes in 'ent/migrate/migrations' | ||
migration_changes=$(echo "$changed_files" | grep '^ent/migrate/migrations' || true) | ||
echo "Migration changes: $migration_changes" | ||
# If there are schema changes but no migration changes, fail the check | ||
if [ -n "$schema_changes" ] && [ -z "$migration_changes" ]; then | ||
echo "::error::Changes in 'ent/schema' require corresponding changes in 'ent/migrate/migrations'" | ||
exit 1 | ||
else | ||
echo "Check passed: Schema changes are accompanied by migration changes." | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.