zammad/zammad

View on GitHub
.gitlab/ci/test/migration.yml

Summary

Maintainability
Test Coverage
#
# Test the migration from the previous `stable` branch to `develop`.
#
.template_migration:
  stage: test
  rules:
    - if: $CI_COMMIT_TAG
      when: never
    - if: $CI_COMMIT_REF_NAME =~ /^stable/
      when: never
    - if: $CI_COMMIT_REF_NAME =~ /^(private|cherry-pick-)/
      when: manual
      allow_failure: true
    - when: on_success
  before_script: []
  script:
    # First, checkout stable and set it up.
    - git fetch --unshallow
    - git checkout stable
    - !reference [.scripts, source_rvm]
    # - rvm use 3.1.3
    - !reference [.scripts, bundle_install]
    - !reference [.scripts, configure_environment]
    - !reference [.scripts, zammad_db_init]
    # Then, switch to the current commit, migrate to it and run a few selected tests.
    - git checkout $CI_COMMIT_SHA
    # - rvm use 3.2.3
    - !reference [.scripts, bundle_install]
    # Force redis usage, even if it was disabled by the initial configure_environment script of stable.
    - export REDIS_URL=redis://redis
    - bundle exec rails db:migrate
    - bundle exec rspec --profile 10 spec/db

rspec:migration:postgresql:
  extends:
    - .template_migration
  services:
    - !reference [.services, postgresql]
    - !reference [.services, redis]

rspec:migration:mysql:
  extends:
    - .template_migration
  services:
    - !reference [.services, mysql]
    - !reference [.services, redis]

rspec:migration:mariadb:
  extends:
    - .template_migration
  services:
    - !reference [.services, mariadb]
    - !reference [.services, redis]