2023-02-19 17:06:34 +11:00
|
|
|
name: Test two step migrations
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches-ignore:
|
|
|
|
- 'dependabot/**'
|
2023-06-06 18:42:23 +10:00
|
|
|
- 'renovate/**'
|
2023-02-19 17:06:34 +11:00
|
|
|
pull_request:
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
pre_job:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
outputs:
|
|
|
|
should_skip: ${{ steps.skip_check.outputs.should_skip }}
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- id: skip_check
|
|
|
|
uses: fkirc/skip-duplicate-actions@v5
|
|
|
|
with:
|
2023-03-28 02:54:42 +11:00
|
|
|
paths: '["Gemfile*", ".ruby-version", "**/*.rb", ".github/workflows/test-migrations-two-step.yml", "lib/tasks/tests.rake"]'
|
2023-02-19 17:06:34 +11:00
|
|
|
|
|
|
|
test:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
needs: pre_job
|
|
|
|
if: needs.pre_job.outputs.should_skip != 'true'
|
|
|
|
|
2023-05-20 01:14:15 +10:00
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
|
|
|
|
matrix:
|
|
|
|
postgres:
|
|
|
|
- 14-alpine
|
|
|
|
- 15-alpine
|
|
|
|
|
2023-02-19 17:06:34 +11:00
|
|
|
services:
|
|
|
|
postgres:
|
2023-05-20 01:14:15 +10:00
|
|
|
image: postgres:${{ matrix.postgres}}
|
2023-02-19 17:06:34 +11:00
|
|
|
env:
|
|
|
|
POSTGRES_PASSWORD: postgres
|
|
|
|
POSTGRES_USER: postgres
|
|
|
|
options: >-
|
|
|
|
--health-cmd pg_isready
|
|
|
|
--health-interval 10s
|
|
|
|
--health-timeout 5s
|
|
|
|
--health-retries 5
|
|
|
|
ports:
|
|
|
|
- 5432:5432
|
2024-01-26 00:10:39 +11:00
|
|
|
|
2023-02-19 17:06:34 +11:00
|
|
|
redis:
|
2023-03-10 21:10:47 +11:00
|
|
|
image: redis:7-alpine
|
2023-02-19 17:06:34 +11:00
|
|
|
options: >-
|
|
|
|
--health-cmd "redis-cli ping"
|
|
|
|
--health-interval 10s
|
|
|
|
--health-timeout 5s
|
|
|
|
--health-retries 5
|
|
|
|
ports:
|
|
|
|
- 6379:6379
|
|
|
|
|
|
|
|
env:
|
|
|
|
CONTINUOUS_INTEGRATION: true
|
|
|
|
DB_HOST: localhost
|
|
|
|
DB_USER: postgres
|
|
|
|
DB_PASS: postgres
|
|
|
|
DISABLE_SIMPLECOV: true
|
|
|
|
RAILS_ENV: test
|
|
|
|
BUNDLE_CLEAN: true
|
|
|
|
BUNDLE_FROZEN: true
|
|
|
|
BUNDLE_WITHOUT: 'development production'
|
|
|
|
BUNDLE_JOBS: 3
|
|
|
|
BUNDLE_RETRY: 3
|
|
|
|
|
|
|
|
steps:
|
2023-09-11 18:41:26 +10:00
|
|
|
- uses: actions/checkout@v4
|
2023-02-19 17:06:34 +11:00
|
|
|
|
2023-10-24 22:43:24 +11:00
|
|
|
- name: Set up Ruby environment
|
|
|
|
uses: ./.github/actions/setup-ruby
|
2023-02-19 17:06:34 +11:00
|
|
|
|
|
|
|
- name: Create database
|
|
|
|
run: './bin/rails db:create'
|
|
|
|
|
2024-01-26 00:10:39 +11:00
|
|
|
- name: Run historical migrations with data population
|
|
|
|
run: './bin/rails tests:migrations:prepare_database'
|
2023-02-19 17:06:34 +11:00
|
|
|
env:
|
|
|
|
SKIP_POST_DEPLOYMENT_MIGRATIONS: true
|
|
|
|
|
|
|
|
- name: Run all remaining pre-deployment migrations
|
|
|
|
run: './bin/rails db:migrate'
|
|
|
|
env:
|
|
|
|
SKIP_POST_DEPLOYMENT_MIGRATIONS: true
|
|
|
|
|
|
|
|
- name: Run all post-deployment migrations
|
|
|
|
run: './bin/rails db:migrate'
|
|
|
|
|
|
|
|
- name: Check migration result
|
|
|
|
run: './bin/rails tests:migrations:check_database'
|