# Travis CI
#
#

sudo: required
group: deprecated-2017-Q4
dist: trusty
language: generic
python:
  - "2.7"
services:
  - docker

env:
  matrix:
     - "TESTLANG=C"
     - "TESTLANG=CSharp"
     - 'TESTDIR="C++/cppcms C++/cpoll_cppsp C++/poco"'
     - "TESTDIR=C++/ffead-cpp"
     - "TESTDIR=C++/cutelyst"
     - "TESTDIR=C++/silicon"
     - "TESTDIR=C++/treefrog"
     - "TESTDIR=C++/ulib"
     - "TESTDIR=C++/wt"
     - "TESTLANG=Clojure"
     - "TESTLANG=Crystal"
     - "TESTLANG=D"
     - "TESTLANG=Dart"
     - "TESTLANG=Elixir"
     - "TESTLANG=Erlang"
     - "TESTLANG=Go"
     - "TESTLANG=Groovy"
     - "TESTDIR=Haskell/snap"
     - "TESTDIR=Haskell/wai"
     - "TESTDIR=Haskell/yesod"
     - "TESTDIR=Haskell/servant"
     - "TESTDIR=Haskell/spock"
     - "TESTDIR=Java/act"
     - "TESTDIR=Java/activeweb"
     - "TESTDIR=Java/baratine"
     - "TESTDIR=Java/bayou"
     - "TESTDIR=Java/blade"
     - "TESTDIR=Java/comsat"
     - "TESTDIR=Java/curacao"
     - "TESTDIR=Java/dropwizard"
     - "TESTDIR=Java/gemini"
     - "TESTDIR=Java/grizzly"
     - "TESTDIR=Java/grizzly-jersey"
     - "TESTDIR=Java/jawn"
     - "TESTDIR=Java/jetty"
     - "TESTDIR=Java/jlhttp"
     - "TESTDIR=Java/jooby"
     - "TESTDIR=Java/light-java"
     - "TESTDIR=Java/minijax"
     - "TESTDIR=Java/netty"
     - "TESTDIR=Java/ninja-standalone"
     - "TESTDIR=Java/play1"
     - "TESTDIR=Java/play2-java"
     - "TESTDIR=Java/proteus"
     - "TESTDIR=Java/rapidoid"
     - "TESTDIR=Java/redkale"
     - "TESTDIR=Java/restexpress"
     - "TESTDIR=Java/revenj-jvm"
     - "TESTDIR=Java/servlet"
     - "TESTDIR=Java/servlet3"
     - "TESTDIR=Java/spark"
     - "TESTDIR=Java/spring"
     - "TESTDIR=Java/tapestry"
     - "TESTDIR=Java/undertow"
     - "TESTDIR=Java/undertow-jersey"
     - "TESTDIR=Java/vertx"
     - "TESTDIR=Java/vertx-web"
     - "TESTDIR=Java/wicket"
     - "TESTDIR=Java/wildfly-ee7"
     - "TESTDIR=Java/wizzardo-http"
     - "TESTLANG=JavaScript"
     - "TESTLANG=Kotlin"
     - "TESTLANG=Lua"
     - "TESTLANG=Nim"
     - "TESTLANG=Perl"
     - "TESTLANG=PHP"
     - "TESTLANG=Python"
     - "TESTLANG=Ruby"
     - "TESTLANG=Rust"
     - "TESTLANG=Scala"
     - "TESTLANG=Swift"
     - "TESTLANG=Ur"
     - "TESTLANG=Vala"


before_script:

  # Runs travis_diff, printing the output to the terminal, and searches for travis-diff-continue
  # to determine if the suite should be installed and the current $TESTDIR test should run.
  - export RUN_TESTS=`./toolset/travis/travis_diff.py | tee /dev/tty | grep -oP "travis-run-tests \K(.*)"`

  - if [ "$RUN_TESTS" ]; then docker pull techempower/tfb; fi

  # Stop services that would claim ports we may need
  - sudo service mysql stop
  - sudo service postgresql stop

script:

  # run-ci.py runs the diffing to see if travis needs to test this framework. Ideally/eventually,
  # we'd like to try and do the diffing before travis_clean & setup.
  # This will run the tests exactly as you would in your own vm:
  - if [ "$RUN_TESTS" ]; then docker network create tfb > /dev/null 2>&1 && docker run --network=tfb -v /var/run/docker.sock:/var/run/docker.sock --mount type=bind,source=`pwd`,target=/FrameworkBenchmarks techempower/tfb --mode verify --test-dir $RUN_TESTS; else echo 'Skipping test verification.'; fi
