2023-02-18 22:06:34 -08:00
|
|
|
name: Test one step migrations
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches-ignore:
|
|
|
|
- 'dependabot/**'
|
2023-06-06 01:42:23 -07:00
|
|
|
- 'renovate/**'
|
2023-02-18 22:06:34 -08: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-27 08:54:42 -07:00
|
|
|
paths: '["Gemfile*", ".ruby-version", "**/*.rb", ".github/workflows/test-migrations-one-step.yml", "lib/tasks/tests.rake"]'
|
2023-02-18 22:06:34 -08:00
|
|
|
|
|
|
|
test:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
needs: pre_job
|
|
|
|
if: needs.pre_job.outputs.should_skip != 'true'
|
|
|
|
|
2023-05-19 08:14:15 -07:00
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
|
|
|
|
matrix:
|
|
|
|
postgres:
|
|
|
|
- 14-alpine
|
|
|
|
- 15-alpine
|
|
|
|
|
2023-02-18 22:06:34 -08:00
|
|
|
services:
|
|
|
|
postgres:
|
2023-05-19 08:14:15 -07:00
|
|
|
image: postgres:${{ matrix.postgres}}
|
2023-02-18 22:06:34 -08: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
|
|
|
|
|
|
|
|
redis:
|
2023-03-10 02:10:47 -08:00
|
|
|
image: redis:7-alpine
|
2023-02-18 22:06:34 -08: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:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
|
|
|
|
- name: Install native Ruby dependencies
|
2023-03-30 05:19:33 -07:00
|
|
|
run: |
|
|
|
|
sudo apt-get update
|
|
|
|
sudo apt-get install -y libicu-dev libidn11-dev
|
2023-02-18 22:06:34 -08:00
|
|
|
|
|
|
|
- name: Set up bundler cache
|
|
|
|
uses: ruby/setup-ruby@v1
|
|
|
|
with:
|
|
|
|
ruby-version: .ruby-version
|
|
|
|
bundler-cache: true
|
|
|
|
|
|
|
|
- name: Create database
|
|
|
|
run: './bin/rails db:create'
|
|
|
|
|
|
|
|
- name: Run migrations up to v2.0.0
|
|
|
|
run: './bin/rails db:migrate VERSION=20171010025614'
|
|
|
|
|
|
|
|
- name: Populate database with test data
|
|
|
|
run: './bin/rails tests:migrations:populate_v2'
|
|
|
|
|
|
|
|
- name: Run migrations up to v2.4.0
|
|
|
|
run: './bin/rails db:migrate VERSION=20180514140000'
|
|
|
|
|
|
|
|
- name: Populate database with test data
|
|
|
|
run: './bin/rails tests:migrations:populate_v2_4'
|
|
|
|
|
|
|
|
- name: Run migrations up to v2.4.3
|
|
|
|
run: './bin/rails db:migrate VERSION=20180707154237'
|
|
|
|
|
|
|
|
- name: Populate database with test data
|
|
|
|
run: './bin/rails tests:migrations:populate_v2_4_3'
|
|
|
|
|
|
|
|
- name: Run all remaining migrations
|
|
|
|
run: './bin/rails db:migrate'
|
|
|
|
|
|
|
|
- name: Check migration result
|
|
|
|
run: './bin/rails tests:migrations:check_database'
|