publiclab/plots2

View on GitHub
.travis.yml

Summary

Maintainability
Test Coverage
sudo: required

language: ruby

rvm:
  - 2.7.3

services:
  - docker
  - redis-server

addons:
  mariadb: '10.2'
  chrome: stable

cache:
  directories:
   - $PWD/vendor/.bundle/
   - $PWD/public/lib/

git:
    depth: false

env:
  global:
    - CI=true
    - GENERATE_REPORT=true
    - RAILS_ENV=test
    - RAILS_SYSTEM_TESTING_SCREENSHOT=simple

before_install:
  - CHROME_MAIN_VERSION=`google-chrome-stable --version | sed -E 's/(^Google Chrome |\.[0-9]+ )//g'`
  - CHROMEDRIVER_VERSION=`curl -s "https://chromedriver.storage.googleapis.com/LATEST_RELEASE_$CHROME_MAIN_VERSION"`
  - sudo wget https://chromedriver.storage.googleapis.com/${CHROMEDRIVER_VERSION}/chromedriver_linux64.zip
  - sudo unzip chromedriver_linux64.zip -d /usr/local/bin/
  - sudo chmod +x /usr/local/bin/chromedriver
  - google-chrome-stable --headless --disable-gpu --remote-debugging-port=9222 http://localhost &
  - yes | gem update --system --force
  - gem install bundler

install:
  - rm -rf test/reports
  - cp config/database.yml.example config/database.yml
  - cp db/schema.rb.example db/schema.rb
  - bundle config set path 'vendor/.bundle/'
  - bundle install
  - gem list
  - if [ $RAILS_ENV != 'production' ]; then
      yarn check || yarn install;
    fi
  - mysql -e "CREATE DATABASE plots;";
  - bundle exec rake db:schema:load
  - bundle exec rake db:migrate
  - if [ "$TRAVIS_PULL_REQUEST" == "true" ]; then
      gem install danger danger-junit google-cloud-storage;
    fi
  - echo "$GOOGLE_APPLICATION_CREDENTIALS_JSON" > /tmp/credentials.json # needs to be a path to a json file, so we shuffle...

jobs:
  include:
    - name: "Unit Tests"
      script: bundle exec rails test test/unit
    - name: "Functional Tests"
      script: bundle exec rails test test/functional
    - name: "Integration Tests"
      script: bundle exec rails test test/integration
    - name: "System Tests"
      script: bundle exec rails test:system

after_script:
  - echo -e '<?xml version="1.0" encoding="UTF-8"?>' > output.xml;
  - tail -n +2 -q ./test/reports/TEST*.xml >> output.xml
  - if [ $TRAVIS_PULL_REQUEST == "true" ]; then
      bundle exec danger --verbose;
    fi

branches:
  only:
    - main
    - unstable
    - codecov