2024-06-12 11:38:20 +00:00
|
|
|
name: Historical data migration test
|
|
|
|
|
2023-02-19 06:06:34 +00:00
|
|
|
on:
|
2024-07-07 09:39:31 +00:00
|
|
|
merge_group:
|
2023-02-19 06:06:34 +00:00
|
|
|
push:
|
2024-07-07 09:39:31 +00:00
|
|
|
branches:
|
|
|
|
- 'main'
|
|
|
|
- 'stable-*'
|
2024-07-08 08:16:00 +00:00
|
|
|
paths:
|
|
|
|
- 'Gemfile*'
|
|
|
|
- '.ruby-version'
|
|
|
|
- '**/*.rb'
|
|
|
|
- '.github/workflows/test-migrations.yml'
|
|
|
|
- 'lib/tasks/tests.rake'
|
2024-12-05 11:40:30 +00:00
|
|
|
- 'lib/tasks/db.rake'
|
2024-07-08 08:16:00 +00:00
|
|
|
|
2023-02-19 06:06:34 +00:00
|
|
|
pull_request:
|
2024-07-08 08:16:00 +00:00
|
|
|
paths:
|
|
|
|
- 'Gemfile*'
|
|
|
|
- '.ruby-version'
|
|
|
|
- '**/*.rb'
|
|
|
|
- '.github/workflows/test-migrations.yml'
|
|
|
|
- 'lib/tasks/tests.rake'
|
2023-02-19 06:06:34 +00:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
test:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
2023-05-19 15:14:15 +00:00
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
|
|
|
|
matrix:
|
|
|
|
postgres:
|
|
|
|
- 14-alpine
|
|
|
|
- 15-alpine
|
2024-10-16 07:44:28 +00:00
|
|
|
- 16-alpine
|
|
|
|
- 17-alpine
|
2023-05-19 15:14:15 +00:00
|
|
|
|
2023-02-19 06:06:34 +00:00
|
|
|
services:
|
|
|
|
postgres:
|
2023-05-19 15:14:15 +00:00
|
|
|
image: postgres:${{ matrix.postgres}}
|
2023-02-19 06:06:34 +00:00
|
|
|
env:
|
|
|
|
POSTGRES_PASSWORD: postgres
|
|
|
|
POSTGRES_USER: postgres
|
|
|
|
options: >-
|
|
|
|
--health-cmd pg_isready
|
2024-06-14 15:49:08 +00:00
|
|
|
--health-interval 10ms
|
|
|
|
--health-timeout 3s
|
|
|
|
--health-retries 50
|
2023-02-19 06:06:34 +00:00
|
|
|
ports:
|
|
|
|
- 5432:5432
|
|
|
|
|
|
|
|
redis:
|
2023-03-10 10:10:47 +00:00
|
|
|
image: redis:7-alpine
|
2023-02-19 06:06:34 +00:00
|
|
|
options: >-
|
|
|
|
--health-cmd "redis-cli ping"
|
2024-06-14 15:49:08 +00:00
|
|
|
--health-interval 10ms
|
|
|
|
--health-timeout 3s
|
|
|
|
--health-retries 50
|
2023-02-19 06:06:34 +00:00
|
|
|
ports:
|
|
|
|
- 6379:6379
|
|
|
|
|
|
|
|
env:
|
|
|
|
DB_HOST: localhost
|
|
|
|
DB_USER: postgres
|
|
|
|
DB_PASS: postgres
|
|
|
|
DISABLE_SIMPLECOV: true
|
|
|
|
RAILS_ENV: test
|
|
|
|
BUNDLE_CLEAN: true
|
|
|
|
BUNDLE_FROZEN: true
|
2024-06-12 11:38:20 +00:00
|
|
|
BUNDLE_WITHOUT: 'development:production'
|
2023-02-19 06:06:34 +00:00
|
|
|
BUNDLE_JOBS: 3
|
|
|
|
BUNDLE_RETRY: 3
|
|
|
|
|
|
|
|
steps:
|
2023-09-11 08:41:26 +00:00
|
|
|
- uses: actions/checkout@v4
|
2023-02-19 06:06:34 +00:00
|
|
|
|
2023-10-24 11:43:24 +00:00
|
|
|
- name: Set up Ruby environment
|
|
|
|
uses: ./.github/actions/setup-ruby
|
2023-02-19 06:06:34 +00:00
|
|
|
|
2024-06-12 11:38:20 +00:00
|
|
|
- name: Test "one step migration" flow
|
|
|
|
run: |
|
|
|
|
bin/rails db:drop
|
|
|
|
bin/rails db:create
|
|
|
|
bin/rails tests:migrations:prepare_database
|
|
|
|
bin/rails db:migrate
|
|
|
|
bin/rails tests:migrations:check_database
|
2023-02-19 06:06:34 +00:00
|
|
|
|
2024-06-12 11:38:20 +00:00
|
|
|
- name: Test "two step migration" flow
|
|
|
|
run: |
|
|
|
|
bin/rails db:drop
|
|
|
|
bin/rails db:create
|
|
|
|
SKIP_POST_DEPLOYMENT_MIGRATIONS=true bin/rails tests:migrations:prepare_database
|
2024-12-05 11:40:30 +00:00
|
|
|
|
|
|
|
# Migrate up to v4.2.0 breakpoint
|
|
|
|
bin/rails db:migrate VERSION=20230907150100
|
|
|
|
|
|
|
|
# Migrate the rest
|
2024-06-12 11:38:20 +00:00
|
|
|
SKIP_POST_DEPLOYMENT_MIGRATIONS=true bin/rails db:migrate
|
|
|
|
bin/rails db:migrate
|
|
|
|
bin/rails tests:migrations:check_database
|