Skip to content

Commit e5365d6

Browse files
authored
Merge pull request #2336 from openstax/migration_gh
Fail migration GH action if any file changed (Gemfile.lock, db/schema.db)
2 parents 6e1bacc + 0c056bc commit e5365d6

File tree

2 files changed

+7
-15
lines changed

2 files changed

+7
-15
lines changed

.github/workflows/migrations.yml

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ on:
1111
jobs:
1212
migrations:
1313
timeout-minutes: 30
14-
runs-on: ubuntu-18.04
14+
runs-on: ubuntu-20.04
1515
services:
1616
postgres:
17-
image: postgres:11
17+
image: postgres:13
1818
ports:
1919
- 5432:5432
2020
options: >-
@@ -23,13 +23,11 @@ jobs:
2323
--health-timeout 5s
2424
--health-retries 5
2525
env:
26-
POSTGRES_USER: postgres
27-
POSTGRES_DB: ci_test
2826
POSTGRES_PASSWORD: postgres
2927
redis:
3028
image: redis
3129
ports:
32-
- 6379:6379
30+
- 6379:6379
3331
# Set health checks to wait until redis has started
3432
options: >-
3533
--health-cmd "redis-cli ping"
@@ -58,11 +56,9 @@ jobs:
5856
restore-keys: |
5957
${{ runner.os }}-gems-parent-
6058
61-
# Install gems, create data to be migrated and revert to PR merge commit
62-
- name: Create data to be migrated
59+
- name: Install gems from base commit and create data to be migrated
6360
env:
6461
OXT_DB_USER: postgres
65-
OXT_TEST_DB: ci_test
6662
OXT_DB_PASS: postgres
6763
run: |
6864
gem install bundler
@@ -81,12 +77,11 @@ jobs:
8177
restore-keys: |
8278
${{ runner.os }}-gems-pr-
8379
84-
# Migrate the data
85-
- name: Migrate
80+
- name: Install gems from PR, migrate and ensure no files changed
8681
env:
8782
OXT_DB_USER: postgres
88-
OXT_TEST_DB: ci_test
8983
OXT_DB_PASS: postgres
9084
run: |
9185
bundle install --jobs 4 --retry 3
9286
bundle exec rake db:migrate
87+
git diff --exit-code

.github/workflows/tests.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
runs-on: ubuntu-20.04
1515
services:
1616
postgres:
17-
image: postgres:11
17+
image: postgres:13
1818
ports:
1919
- 5432:5432
2020
options: >-
@@ -23,8 +23,6 @@ jobs:
2323
--health-timeout 5s
2424
--health-retries 5
2525
env:
26-
POSTGRES_USER: postgres
27-
POSTGRES_DB: ci_test
2826
POSTGRES_PASSWORD: postgres
2927
strategy:
3028
matrix:
@@ -48,7 +46,6 @@ jobs:
4846
env:
4947
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
5048
OXT_DB_USER: postgres
51-
OXT_TEST_DB: ci_test
5249
OXT_DB_PASS: postgres
5350
RAILS_ENV: test
5451
run: |

0 commit comments

Comments
 (0)