general:
  branches:
    ignore:
      - gh-pages
machine:
  timezone:
    Europe/Helsinki
  ruby:
    version: ruby-2.3.1
  node:
    version: 6.9
  environment:
    MOCHA_FILE: "$CIRCLE_TEST_REPORTS/mocha.xml"
dependencies:
  cache_directories:
    - "client/node_modules"
  pre:
    - sudo add-apt-repository -y ppa:builds/sphinxsearch-rel22
    - sudo apt-get update && sudo apt-get install -y sphinxsearch
  bundler:
    without: [development]
test:
  pre:
    - cd client && npm rebuild node-sass:
        parallel: true
    - npm run clean:
        parallel: true
    - script/export_translations.sh:
        parallel: true
    - script/export_routes_js.sh:
        parallel: true
    - (cd client && npm run build:client && npm run build:server):
        parallel: true
  override:
    - bundle exec rubocop
    - npm run lint:
        pwd: client
    - bundle exec rspec --format progress --format RspecJunitFormatter --out $CIRCLE_TEST_REPORTS/rspec.xml:
        parallel: true
        files:
          - spec/**/*_spec.rb
    - mkdir -p $CIRCLE_TEST_REPORTS/cucumber:
        parallel: true
    - bundle exec cucumber -p ci --format junit --out $CIRCLE_TEST_REPORTS/cucumber/junit.xml:
        environment:
          PHANTOMJS: true
        parallel: true
        files:
          - features/**/*.feature
    - npm test:
        pwd: client
