You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

100 lines
2.5 KiB

  1. name: Test one step migrations
  2. on:
  3. push:
  4. branches-ignore:
  5. - 'dependabot/**'
  6. pull_request:
  7. jobs:
  8. pre_job:
  9. runs-on: ubuntu-latest
  10. outputs:
  11. should_skip: ${{ steps.skip_check.outputs.should_skip }}
  12. steps:
  13. - id: skip_check
  14. uses: fkirc/skip-duplicate-actions@v5
  15. with:
  16. paths: '["Gemfile*", ".ruby-version", "**/*.rb", ".github/workflows/test-migrations-one-step.yml"]'
  17. test:
  18. runs-on: ubuntu-latest
  19. needs: pre_job
  20. if: needs.pre_job.outputs.should_skip != 'true'
  21. services:
  22. postgres:
  23. image: postgres:14.5
  24. env:
  25. POSTGRES_PASSWORD: postgres
  26. POSTGRES_USER: postgres
  27. options: >-
  28. --health-cmd pg_isready
  29. --health-interval 10s
  30. --health-timeout 5s
  31. --health-retries 5
  32. ports:
  33. - 5432:5432
  34. redis:
  35. image: redis:7.0
  36. options: >-
  37. --health-cmd "redis-cli ping"
  38. --health-interval 10s
  39. --health-timeout 5s
  40. --health-retries 5
  41. ports:
  42. - 6379:6379
  43. env:
  44. CONTINUOUS_INTEGRATION: true
  45. DB_HOST: localhost
  46. DB_USER: postgres
  47. DB_PASS: postgres
  48. DISABLE_SIMPLECOV: true
  49. RAILS_ENV: test
  50. BUNDLE_CLEAN: true
  51. BUNDLE_FROZEN: true
  52. BUNDLE_WITHOUT: 'development production'
  53. BUNDLE_JOBS: 3
  54. BUNDLE_RETRY: 3
  55. steps:
  56. - uses: actions/checkout@v3
  57. - name: Install native Ruby dependencies
  58. run: sudo apt-get install -y libicu-dev libidn11-dev
  59. - name: Set up bundler cache
  60. uses: ruby/setup-ruby@v1
  61. with:
  62. ruby-version: .ruby-version
  63. bundler-cache: true
  64. - name: Create database
  65. run: './bin/rails db:create'
  66. - name: Run migrations up to v2.0.0
  67. run: './bin/rails db:migrate VERSION=20171010025614'
  68. - name: Populate database with test data
  69. run: './bin/rails tests:migrations:populate_v2'
  70. - name: Run migrations up to v2.4.0
  71. run: './bin/rails db:migrate VERSION=20180514140000'
  72. - name: Populate database with test data
  73. run: './bin/rails tests:migrations:populate_v2_4'
  74. - name: Run migrations up to v2.4.3
  75. run: './bin/rails db:migrate VERSION=20180707154237'
  76. - name: Populate database with test data
  77. run: './bin/rails tests:migrations:populate_v2_4_3'
  78. - name: Run all remaining migrations
  79. run: './bin/rails db:migrate'
  80. - name: Check migration result
  81. run: './bin/rails tests:migrations:check_database'