1
0

test-migrations-two-step.yml 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  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 migrations up to v2.0.0
  69. run: './bin/rails db:migrate VERSION=20171010025614'
  70. - name: Populate database with test data
  71. run: './bin/rails tests:migrations:populate_v2'
  72. - name: Run pre-deployment migrations up to v2.4.0
  73. run: './bin/rails db:migrate VERSION=20180514140000'
  74. env:
  75. SKIP_POST_DEPLOYMENT_MIGRATIONS: true
  76. - name: Populate database with test data
  77. run: './bin/rails tests:migrations:populate_v2_4'
  78. - name: Run migrations up to v2.4.3
  79. run: './bin/rails db:migrate VERSION=20180707154237'
  80. env:
  81. SKIP_POST_DEPLOYMENT_MIGRATIONS: true
  82. - name: Populate database with test data
  83. run: './bin/rails tests:migrations:populate_v2_4_3'
  84. - name: Run all remaining pre-deployment migrations
  85. run: './bin/rails db:migrate'
  86. env:
  87. SKIP_POST_DEPLOYMENT_MIGRATIONS: true
  88. - name: Run all post-deployment migrations
  89. run: './bin/rails db:migrate'
  90. - name: Check migration result
  91. run: './bin/rails tests:migrations:check_database'