sudo : true
dist : trusty
language: node_js
node_js:
  - "node"
addons:
  sauce_connect: true
  ssh_known_hosts: download.kiwix.org
before_script:
    - npm install nightwatch http-server
    - "./node_modules/http-server/bin/http-server . &"
script:
    # The free account on Sauce does not allow more than 5 concurrent sessions (including the main one)
    # So we separate the recent and old browsers in order to respect this limit.
    - "./node_modules/nightwatch/bin/nightwatch -c nightwatch.js --env firefox,chrome,edge"
    - "./node_modules/nightwatch/bin/nightwatch -c nightwatch.js --env firefox45,chrome58,ie11"
    - pkill node
deploy:
    - provider: script
      # Nightly builds (launched by cron)
      script: sudo apt-get update -q && sudo apt-get --yes install click click-reviewers-tools && ./scripts/setup_travis_env.sh && DISPLAY=:99.0 ./scripts/create_all_packages.sh
      on:
          condition: ( "$TRAVIS_EVENT_TYPE" = "cron" )
    - provider: script
      # Generation of packages for public releases (launched by a tag)
      script: sudo apt-get update -q && sudo apt-get --yes install click click-reviewers-tools && ./scripts/setup_travis_env.sh && DISPLAY=:99.0 ./scripts/create_all_packages.sh -t -v ${TRAVIS_TAG}
      on:
          tags: true