Test reversibility of migrations #220
@ -34,6 +34,12 @@ jobs:
|
||||
sleep 1
|
||||
echo "Trying again"
|
||||
done
|
||||
- run: |
|
||||
bundle exec rake db:schema:load
|
||||
bundle exec rspec
|
||||
env:
|
||||
RAILS_ENV: test
|
||||
DATABASE_URL: postgres://postgres:postgres@postgres:5432/postgres
|
||||
- name: Get all migrations added
|
||||
id: changed-migration-files
|
||||
uses: tj-actions/changed-files@v45
|
||||
@ -45,18 +51,13 @@ jobs:
|
||||
env:
|
||||
ALL_CHANGED_FILES: ${{ steps.changed-migration-files.outputs.all_changed_files }}
|
||||
run: |
|
||||
echo ${#ALL_CHANGED_FILES[@]}
|
||||
echo ${#ALL_CHANGED_FILES[@]} migrations changed:
|
||||
for file in ${ALL_CHANGED_FILES}; do
|
||||
echo "$file was changed"
|
||||
done
|
||||
- run: |
|
||||
exit 1
|
||||
bundle exec rake db:schema:load db:migrate:status db:migrate:redo
|
||||
|
||||
bundle exec rake db:migrate:redo STEP=${#ALL_CHANGED_FILES[@]}
|
||||
git diff --exit-code db/schema.rb
|
||||
bundle exec rspec
|
||||
env:
|
||||
RAILS_ENV: test
|
||||
DATABASE_URL: postgres://postgres:postgres@postgres:5432/postgres
|
||||
- name: Clean up containers generated by this flow
|
||||
if: failure()
|
||||
run: docker ps --filter network=$JOB_CONTAINER_NAME-$GITHUB_JOB-network --filter name=$JOB_CONTAINER_NAME-* --format "{{.ID}}" | xargs docker rm -f
|
||||
|
Loading…
x
Reference in New Issue
Block a user