services:
  - docker
group: stable
dist: xenial
os: linux

before_install:
  - npm install eslint@6.6.0

install:
  - docker-compose build

script:
  - ./node_modules/.bin/eslint .
  - docker-compose up -d
  - docker-compose exec ores-worker flake8 /ores
  - docker-compose exec ores-api /ores/utility test_api http://localhost:8080 --debug
  - docker-compose exec ores-worker py.test /ores --cov=ores -m "not redis" -vv
  - docker-compose exec ores-worker sphinx-build -anW -b html docs dist/docs
  - docker-compose exec ores-worker sphinx-build -b linkcheck docs dist/docs
after_success:
  - codecov
notifications:
  irc:
    channels:
      - "chat.freenode.net#wikimedia-ai"
    on_success: change
    on_failure: change
    template:
      - "%{repository_slug}#%{build_number} (%{branch} - %{commit} : %{author}): %{message} %{build_url}"

deploy:
  skip_cleanup: true
  provider: script
  script: docker-compose exec ores-worker bash scripts/deploy.sh
  on:
    branch: master

services:
  - docker
group: stable
dist: xenial
os: linux

before_install:
  - npm install eslint@6.6.0

install:
  - docker-compose build

script:
  - ./node_modules/.bin/eslint .
  - docker-compose up -d
  - docker-compose exec ores-worker flake8 /ores
  - docker-compose exec ores-api /ores/utility test_api http://localhost:8080 --debug
  - docker-compose exec ores-worker py.test /ores --cov=ores -m "not redis" -vv
  - docker-compose exec ores-worker sphinx-build -anW -b html docs dist/docs
  - docker-compose exec ores-worker sphinx-build -b linkcheck docs dist/docs
  - docker-compose exec ores-worker rm -r dist/docs
after_success:
  - codecov
notifications:
  irc:
    channels:
      - "chat.freenode.net#wikimedia-ai"
    on_success: change
    on_failure: change
    template:
      - "%{repository_slug}#%{build_number} (%{branch} - %{commit} : %{author}): %{message} %{build_url}"

deploy:
  skip_cleanup: true
  provider: script
  script: docker-compose exec ores-worker bash scripts/deploy.sh
  on:
    branch: master

Remove docs after successful test
Remove docs after successful test
