sudo: required
language: ruby
cache:
  directories:
    - vendor/bundle
    - node_modules
    - $HOME/.nvm
rvm:
  - 2.6.5
addons:
  postgresql: '9.6'
  chrome: 'stable'
services:
  - redis-server
env:
  global:
    - RAILS_ENV=test
    - CC_TEST_REPORTER_ID=f39e060a8b1a558ebd8aff75d5b9760bf1ae98f3f85d628ae28814f3c66438cd
    - DATABASE_URL=postgres://postgres@localhost/
branches:
  only:
    - master
before_install:
  - date --rfc-3339=seconds
  - nvm install
install:
  - bundle install --path vendor/bundle
  - yarn install
  - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64
    > ./cc-test-reporter
  - chmod +x ./cc-test-reporter
before_script:
  - bundle exec rails db:create
script:
  - bundle exec rails webpacker:compile
  - bundle exec rails db:schema:load
  - './cc-test-reporter before-build'
  - 'bundle exec rspec spec --color --tty'
  - '[ ! -f .approvals ] || bundle exec approvals verify --ask false'
  - './cc-test-reporter format-coverage -t simplecov -o coverage/codeclimate.simplecov.json'
  - 'yarn test --colors'
  - './cc-test-reporter format-coverage -t lcov -o coverage/codeclimate.lcov.json'
  - './cc-test-reporter sum-coverage coverage/codeclimate.*.json'
  - './cc-test-reporter upload-coverage'
  - 'bundle exec bundle-audit check --update --ignore CVE-2015-9284'
  - yarn build-storybook
deploy:
  provider: heroku
  api_key: '$HEROKU_AUTH_TOKEN'
  app:
    master: practicaldev
  on:
    condition: $TRAVIS_COMMIT_MESSAGE =~ \[deploy\]
notifications:
  slack:
    on_pull_requests: false
    rooms:
      secure: vzIee4jDgPSRY4szZPdD/jW7YW4GzGqo5NoLV9Exz9TBoWH9UqJnc0TOb2YN84Ys5baRK7LOqxpfp8kFveZkrKGi7/ypeEJlpc9E5UqVh/bwQhvOGrKEg1fvNXbARRnO/sJ49o1CMvroMWvt3GurzuuY9Qu2r+3NBjn9aVwLnLzXsBuF+m2lLoeSkHnW13OC73EeJMsse6JBoCe3gp/srDwISp9+MU+sEAPaY333WK9Vk1kdG7D5oUIuT7743airLRiyWiNUCD1450g864628CEOEZKJAAtqk6kTmvwB91DJMnhD/XhMm4H21kd54YHy0fhqzcG8hYd1lDZuUfrOBfpdEtfnpcRwMyMpY+FPPHXkHhck3OiLJnzkV4L+Lr5W/RvDJ63Ye2nxT4hOItLWaoZWax/LhoIrhZjgYBc4JhiGRQJ8m2HzoRyceeG9Y80vayGVN7y46sjYHP5NHRI36qmJipneDRAJklBTXLdYATvVM/6Mh9B7+H/nBGR6UVJLBC/txi2C8rZRjKBZ/i9e+q/MZs0UEvOuvbz9BXKU08rI+rarJqH3h5Ji9G/k3M0mQ8EfvadabA9lu+gNUAAnq+vwLETweKvfbRpDQjVBKnWsOJoUl9aarfkBn3lhQE8fxZJT/GchLGZPx/CWUE4o1OhliBA9avJ7WINyYStM4Mc=
