sudo: false

# Ruby is the main language of the project.
language: ruby

bundler_args: --with development,ci

# Cache third party dependencies for faster builds
cache:
  apt: true
  bundler: true
  directories:
    # Cache NPM packages
    - lib/assets/node_modules
    - $HOME/.npm

addons:
  chrome: stable
  apt:
    packages:
      - nodejs

matrix:
  fast_finish: true
  include:

rvm:
  # Use 2.4.1, since this is installed by default on Travis (1st Aug, 2018)
  - 2.4.1

# These env variables will set up a separate testing environment for each
# combination of variables.
env:
  # Run specs once with each database adapter we support
  - DB_ADAPTER=postgresql
  - DB_ADAPTER=mysql2

# Main test script
script:
  # Precompile the assets
  - bundle exec rake assets:precompile
  # Copy over config files needed for setup, and create DB
  - bin/setup
  # Default test stage: Run all specs, listing the 10 slowest.
  - bundle exec rspec spec --profile=10

# Run these stages in this order:
stages:
  - security
  - test

# Define each stage (test is already defined automatically)
jobs:
  include:
    # Run Brakeman check with warning level 2, except these two checks:
    - stage: security
      name: "Brakeman check"
      script: bundle exec brakeman -w2 --except=Redirect,CrossSiteScripting

    - stage: security
      name: "Bundle audit"
      script: bundle exec bundle-audit check --update

sudo: false

# Ruby is the main language of the project.
language: ruby

bundler_args: --with development,ci

# Cache third party dependencies for faster builds
cache:
  apt: true
  bundler: true
  directories:
    # Cache NPM packages
    - lib/assets/node_modules
    - $HOME/.npm

addons:
  chrome: stable
  apt:
    packages:
      - nodejs

matrix:
  fast_finish: true
  include:

rvm:
  # Use 2.4.1, since this is installed by default on Travis (1st Aug, 2018)
  - 2.4.1

# These env variables will set up a separate testing environment for each
# combination of variables.
env:
  # Run specs once with each database adapter we support
  - DB_ADAPTER=postgresql
  - DB_ADAPTER=mysql2

# Main test script
script:
  # Copy over config files needed for setup, and create DB
  - bin/setup
  # Precompile the assets
  - bundle exec rake assets:precompile
  # Default test stage: Run all specs, listing the 10 slowest.
  - bundle exec rspec spec --profile=10

# Run these stages in this order:
stages:
  - security
  - test

# Define each stage (test is already defined automatically)
jobs:
  include:
    # Run Brakeman check with warning level 2, except these two checks:
    - stage: security
      name: "Brakeman check"
      script: bundle exec brakeman -w2 --except=Redirect,CrossSiteScripting

    - stage: security
      name: "Bundle audit"
      script: bundle exec bundle-audit check --update

Swap rake assets compilation with bin/setup task
Swap rake assets compilation with bin/setup task
