test-migrations-two-step.yml 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. name: Test two step migrations
  2. on:
  3. push:
  4. branches-ignore:
  5. - 'dependabot/**'
  6. - 'renovate/**'
  7. pull_request:
  8. jobs:
  9. pre_job:
  10. runs-on: ubuntu-latest
  11. outputs:
  12. should_skip: ${{ steps.skip_check.outputs.should_skip }}
  13. steps:
  14. - id: skip_check
  15. uses: fkirc/skip-duplicate-actions@v5
  16. with:
  17. paths: '["Gemfile*", ".ruby-version", "**/*.rb", ".github/workflows/test-migrations-two-step.yml", "lib/tasks/tests.rake"]'
  18. test:
  19. runs-on: ubuntu-latest
  20. needs: pre_job
  21. if: needs.pre_job.outputs.should_skip != 'true'
  22. strategy:
  23. fail-fast: false
  24. matrix:
  25. postgres:
  26. - 14-alpine
  27. - 15-alpine
  28. services:
  29. postgres:
  30. image: postgres:${{ matrix.postgres}}
  31. env:
  32. POSTGRES_PASSWORD: postgres
  33. POSTGRES_USER: postgres
  34. options: >-
  35. --health-cmd pg_isready
  36. --health-interval 10s
  37. --health-timeout 5s
  38. --health-retries 5
  39. ports:
  40. - 5432:5432
  41. redis:
  42. image: redis:7-alpine
  43. options: >-
  44. --health-cmd "redis-cli ping"
  45. --health-interval 10s
  46. --health-timeout 5s
  47. --health-retries 5
  48. ports:
  49. - 6379:6379
  50. env:
  51. CONTINUOUS_INTEGRATION: true
  52. DB_HOST: localhost
  53. DB_USER: postgres
  54. DB_PASS: postgres
  55. DISABLE_SIMPLECOV: true
  56. RAILS_ENV: test
  57. BUNDLE_CLEAN: true
  58. BUNDLE_FROZEN: true
  59. BUNDLE_WITHOUT: 'development production'
  60. BUNDLE_JOBS: 3
  61. BUNDLE_RETRY: 3
  62. steps:
  63. - uses: actions/checkout@v4
  64. - name: Set up Ruby environment
  65. uses: ./.github/actions/setup-ruby
  66. - name: Create database
  67. run: './bin/rails db:create'
  68. - name: Run historical migrations with data population
  69. run: './bin/rails tests:migrations:prepare_database'
  70. env:
  71. SKIP_POST_DEPLOYMENT_MIGRATIONS: true
  72. - name: Run all remaining pre-deployment migrations
  73. run: './bin/rails db:migrate'
  74. env:
  75. SKIP_POST_DEPLOYMENT_MIGRATIONS: true
  76. - name: Run all post-deployment migrations
  77. run: './bin/rails db:migrate'
  78. - name: Check migration result
  79. run: './bin/rails tests:migrations:check_database'