test-migrations-one-step.yml 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. name: Test one 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-one-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. - name: Run all remaining migrations
  71. run: './bin/rails db:migrate'
  72. - name: Check migration result
  73. run: './bin/rails tests:migrations:check_database'