- staging - production variables: DISABLE_SPRING: 'true' before_script: - gem install bundler --no-ri --no-rdoc - rm -rf vendor/ruby/2.4.0/cache/bundler/git || true - ruby -v cache: paths: - vendor/ruby - node_modules build: stage: test script: - bundle install -j $(nproc) --path vendor --full-index --clean - bin/yarn - cp config/database.ci.yml config/database.yml - bundle exec rails db:create RAILS_ENV=test - bundle exec rails db:test:prepare RAILS_ENV=test - bundle exec rails test - bundle exec rails test:system deploy_review: stage: review script: - gem install dpl - heroku apps:fork --from $HEROKU_STAGING_APP --to $CI_ENVIRONMENT_SLUG || true - dpl --provider=heroku --app=$CI_ENVIRONMENT_SLUG --api-key=$HEROKU_API_KEY - heroku run rake db:migrate --app=$CI_ENVIRONMENT_SLUG environment: name: review/$CI_BUILD_REF_NAME url: https://$CI_ENVIRONMENT_SLUG.herokuapp.com only: - branches except: - master staging: stage: staging environment: staging script: - gem install dpl - dpl --provider=heroku --app=$HEROKU_STAGING_APP --api-key=$HEROKU_API_KEY - heroku run rake db:migrate --app=$HEROKU_STAGING_APP only: - master production: stage: production environment: production script: - gem install dpl - dpl --provider=heroku --app=$HEROKU_PROD_APP --api-key=$HEROKU_API_KEY - heroku run rake db:migrate --app=$HEROKU_PROD_APP only: - master when: manual