publiclab/spectral-workbench

View on GitHub
.travis.yml

Summary

Maintainability
Test Coverage
language: ruby

dist: trusty

rvm:
  - 2.6.5

node_js:
  - 13

env:
  global:
    - RAILS_ENV=test
    - DB_HOST='127.0.0.1'
    - DB_USER='swbench'
    - DB_PASS='swbench'
    - DB_NAME='swbench'

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

services:
  - docker
  - mysql

before_install:
  - ./script/dependencies.sh > /dev/null 2>&1
  - cp config/database.yml.example config/database.yml
  - cp config/config.yml.example config/config.yml
  - cp db/schema.rb.example db/schema.rb
  - bundle config set path 'vendor/.bundle/'

install:
  - bundle install
  - if [ $RAILS_ENV == 'production' ]; then
      mysql -e "CREATE DATABASE swbench;";
      mysql -e "CREATE USER 'swbench'@'%' IDENTIFIED BY 'swbench';";
      mysql -e "GRANT ALL PRIVILEGES ON *.* TO 'swbench'@'%';";
      bundle exec rake db:schema:load;
      bundle exec rake db:migrate;
    else
      yarn check || yarn install;
      bundle exec rake db:create;
      bundle exec rake db:schema:load;
      bundle exec rake db:migrate;
    fi

jobs:
  include:
    - name: "Models Tests"
      script: rails test:models
    - name: "Helpers Tests"
      script: ruby -I test test/models/helpers/*.rb
    - name: "Controllers Tests"
      script: rails test:controllers
    - name: "Integration Tests"
      script: rails test:integration
    - name: "Rubocop Lint"
      script: rubocop
    - name: "System Tests"
      script: rails test:system
    - name: "Docker Builds"
      script: docker build -t swbench .
    - name: "Asset Precompilation"
      env:
        - RAILS_ENV=production
      script:
        - bundle exec rake assets:precompile