version: v1.0
name: Test ETModel
agent:
  machine:
    type: e1-standard-2
    os_image: ubuntu2004
blocks:
  - name: RSpec
    task:
      env_vars:
        - name: DATABASE_URL
          value: mysql2://root@localhost/etmodel_test?pool=5&encoding=utf8mb4
        - name: RAILS_ENV
          value: test
        - name: BUNDLE_JOBS
          value: '4'
        - name: CI
          value: 'true'
      jobs:
        - name: Test
          commands:
            - checkout
            - sem-service start mysql 8
            - cache restore
            - bundle install --local deployment 'true' --local path 'vendor/bundle'
            - yarn install
            - cache store
            - cat /dev/null > config/database.yml
            - bundle exec rails webpacker:compile
            - bundle exec rails db:setup
            - bundle exec rspec --format RspecJunitFormatter --out junit.xml --format progress
      epilogue:
        always:
          commands:
            - test-results publish junit.xml
promotions:
  - name: Deploy to staging
    pipeline_file: deploy_staging.yml
    auto_promote:
      when: "result = 'passed' and branch = 'master'"
  - name: Deploy to production
    pipeline_file: deploy_production.yml
    auto_promote:
      when: "result = 'passed' and branch = 'production'"

version: v1.0
name: Test ETModel
agent:
  machine:
    type: e1-standard-2
    os_image: ubuntu2004
blocks:
  - name: RSpec
    task:
      env_vars:
        - name: DATABASE_URL
          value: mysql2://root@localhost/etmodel_test?pool=5&encoding=utf8mb4
        - name: RAILS_ENV
          value: test
        - name: BUNDLE_JOBS
          value: '4'
        - name: CI
          value: 'true'
      jobs:
        - name: Test
          commands:
            - checkout
            - sem-service start mysql 8
            - cache restore
            - bundle config set --local deployment 'true'
            - bundle install
            - yarn install
            - cache store
            - cat /dev/null > config/database.yml
            - bundle exec rails webpacker:compile
            - bundle exec rails db:setup
            - bundle exec rspec --format RspecJunitFormatter --out junit.xml --format progress
      epilogue:
        always:
          commands:
            - test-results publish junit.xml
promotions:
  - name: Deploy to staging
    pipeline_file: deploy_staging.yml
    auto_promote:
      when: "result = 'passed' and branch = 'master'"
  - name: Deploy to production
    pipeline_file: deploy_production.yml
    auto_promote:
      when: "result = 'passed' and branch = 'production'"

Set bundler to deployment mode in CI
Set bundler to deployment mode in CI
