version: "v1.0" name: <%= project_name %> agent: machine: type: e1-standard-2 os_image: ubuntu1804 auto_cancel: running: when: "true" blocks: - name: cache execution_time_limit: minutes: 10 dependencies: [] task: secrets: - name: <%= project_name %> jobs: - name: cache commands: - checkout --use-cache - cache restore nvm-$SEMAPHORE_GIT_BRANCH-$(checksum Gemfile.lock),nvm-$SEMAPHORE_GIT_BRANCH,nvm-develop,nvm-master - cache restore gems-$SEMAPHORE_GIT_BRANCH-$(checksum Gemfile.lock),gems-$SEMAPHORE_GIT_BRANCH,gems-develop,gems-master - cache restore yarn-cache-$SEMAPHORE_GIT_BRANCH-$(checksum Gemfile.lock),yarn-cache-$SEMAPHORE_GIT_BRANCH,yarn-cache-develop,yarn-cache-master - cache restore node-modules-$SEMAPHORE_GIT_BRANCH-$(checksum yarn.lock),node-modules-$SEMAPHORE_GIT_BRANCH,node-modules-develop,node-modules-master - bundle install --deployment -j 4 --path vendor/bundle - nvm install - bin/yarn install --cache-folder ~/.cache/yarn - cache store - name: tests execution_time_limit: minutes: 10 dependencies: ['cache'] task: secrets: - name: <%= project_name %> env_vars: - name: DATABASE_URL value: postgresql://postgres@localhost/test?encoding=utf8 - name: RAILS_ENV value: test prologue: commands: - checkout --use-cache - cache restore nvm-$SEMAPHORE_GIT_BRANCH-$(checksum Gemfile.lock),nvm-$SEMAPHORE_GIT_BRANCH,nvm-develop,nvm-master - cache restore gems-$SEMAPHORE_GIT_BRANCH-$(checksum Gemfile.lock),gems-$SEMAPHORE_GIT_BRANCH,gems-develop,gems-master - cache restore yarn-cache-$SEMAPHORE_GIT_BRANCH-$(checksum Gemfile.lock),yarn-cache-$SEMAPHORE_GIT_BRANCH,yarn-cache-develop,yarn-cache-master - cache restore node-modules-$SEMAPHORE_GIT_BRANCH-$(checksum yarn.lock),node-modules-$SEMAPHORE_GIT_BRANCH,node-modules-develop,node-modules-master - bundle install --deployment --path vendor/bundle - bin/yarn install --cache-folder ~/.cache/yarn - sem-service start postgres - bundle exec rails db:create db:schema:load jobs: - name: tests commands: - bin/check promotions: - name: develop pipeline_file: develop-deploy.yml auto_promote: when: "result = 'passed' and branch = 'develop'" - name: master pipeline_file: master-deploy.yml auto_promote: when: "result = 'passed' and branch = 'master'" - name: testing pipeline_file: testing-deploy.yml auto_promote: when: "result = 'passed' and branch = 'testing'"