test-migrations.yml 2.2 KB

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