# Use container-based infrastructure (see: http://docs.travis-ci.com/user/workers/container-based-infrastructure/). sudo: false language: go go: - 1.7 addons: apt: sources: - ubuntu-toolchain-r-test packages: # NOTE: When you add a dependency, don't forget to add comment why it's necessary. - automake - libtool - php5-cli - php5-dev - python-dev - python-mysqldb - python-pip - libssl-dev - g++-4.8 - gcc-4.8 - git - pkg-config - python-virtualenv # installs libaio1 which is required by MariaDB 10.0 server package - libaio-dev # required by travis script below to measure CPU and memory usage - time # Optional dependency. Without a running syslog daemon, Vitess will keep complaining that it could not log events and spam the logs. - rsyslog # Cache directories of dependencies which are built by bootstrap.sh cache: directories: # Cache downloaded and extracted MariaDB 10.0 packages. - $MYSQL_ROOT # Cache bootstrapped dependencies (e.g. protobuf and gRPC). - $HOME/gopath/dist/grpc/.build_finished - $HOME/gopath/dist/grpc/usr/local - $HOME/gopath/dist/py-mock-1.0.1/.build_finished - $HOME/gopath/dist/py-mock-1.0.1/lib/python2.7/site-packages - $HOME/gopath/dist/vt-zookeeper-3.4.6/.build_finished - $HOME/gopath/dist/vt-zookeeper-3.4.6/lib # Maven repository for Java dependencies. - $HOME/.m2 - $HOME/.phpenv before_cache: # Travis CI caching doesn't work with this symlink. Just delete it. - rm $HOME/gopath/bin/zksrv.sh # Delete these files because they keep changing (having the latest timestamp # of an update) and trigger a lengthy update of the cache (~25 seconds). - rm $HOME/.m2/repository/com/youtube/vitess/*/maven-metadata-local.xml - rm $HOME/.m2/repository/com/youtube/vitess/*/*-SNAPSHOT/*-SNAPSHOT.jar - rm $HOME/.m2/repository/com/youtube/vitess/*/*-SNAPSHOT/_remote.repositories - rm $HOME/.m2/repository/com/youtube/vitess/*/*-SNAPSHOT/maven-metadata-local.xml - rm $HOME/.m2/repository/com/youtube/vitess/*/*-SNAPSHOT/resolver-status.properties - rm $HOME/.m2/repository/io/grpc/protoc-gen-grpc-java/*/protoc-gen-grpc-java-*.pom.lastUpdated # Don't cache unnecessary PHP files. - rm $HOME/.phpenv/versions/*/sbin/* - rm $HOME/.phpenv/versions/*/bin/php-cgi - rm $HOME/.phpenv/shims/php-cgi - find $HOME/.phpenv/vendor/grpc/grpc -mindepth 1 -maxdepth 1 ! -name src | xargs rm -rf - find $HOME/.phpenv/vendor/grpc/grpc/src -mindepth 1 -maxdepth 1 ! -name php | xargs rm -rf env: global: - MYSQL_FLAVOR=MariaDB - MYSQL_ROOT=$HOME/mysql - VT_MYSQL_ROOT=$MYSQL_ROOT/usr # Enable parallel compilation e.g. for gRPC. # (The Travis CI worker is allowed to use up to 2 cores, but as of 07/2015 4 parallel compilations is actually faster.) - MAKEFLAGS=-j4 # Run go build and test with -p 4 (i.e. up to 4 packages are compiled/tested in parallel). # As of 07/2015 this value works best in a Travis CI container. - VT_GO_PARALLEL_VALUE=4 - PATH="$HOME/.phpenv/bin:$PATH" # Add -follow to TEST_FLAGS below to print as the test runs, to diagnose stuck tests. - TEST_FLAGS="-docker=false -timeout=5m -print-log -remote-stats=http://enisoc.com:15123/travis/stats" - CC=gcc-4.8 - CXX=g++-4.8 # TODO: uncomment when php crashing is fixed # - INSTALL_GRPC_PHP="$HOME/.phpenv/lib" - SAUCE_USERNAME=vitess matrix: # NOTE: Travis CI schedules up to 5 tests simultaneously. # All our tests should be spread out as evenly as possible across these 5 slots. # We should always utilize all 5 slots because the cost of the setup is high (up to one minute). # NOTE: Use "" if you specify a space separated list of multiple targets. - TEST_MATRIX="-shard 0" - TEST_MATRIX="-shard 1" - TEST_MATRIX="-shard 2" - TEST_MATRIX="-shard 3" - TEST_MATRIX="-shard 4" before_install: - travis/download_mariadb.sh # TODO: uncomment when php crashing is fixed # - travis/php_init.sh install: # TODO: uncomment when php crashing is fixed # - eval "$(phpenv init -)" - ./bootstrap.sh before_script: - source dev.env # Travis only tests. Run only on the first shard. # Part of "before_script" because in "script" the job would not fail immediately if a command fails. # Webdriver tests are only on the last shard for non PRs. Start Sauce Connect only on this shard. - | if [[ $TEST_MATRIX = *"-shard 0"* ]]; then travis/check_make_proto.sh elif [[ $TEST_MATRIX = *"-shard 4"* && $TRAVIS_PULL_REQUEST = "false" ]]; then tools/sauce_connect_setup.sh fi script: # Log GOMAXPROCS (should be 2 as of 07/2015). - go run travis/log_gomaxprocs.go - | if [[ $TRAVIS_PULL_REQUEST = "false" ]]; then go run test.go $TEST_FLAGS $TEST_MATRIX else # Exclude webdriver tests on Travis PRs since the sauce addon does not work for PRs go run test.go $TEST_FLAGS $TEST_MATRIX -exclude=webdriver fi after_script: # Stop Sauce Connect at the end - | if [[ $TEST_MATRIX = *"-shard 4"* && $TRAVIS_PULL_REQUEST = "false" ]]; then tools/sauce_connect_teardown.sh fi after_failure: # In case of errors, output log files to make it easier to debug the error. # List all available files. - ls -alR $HOME/gopath/vtdataroot # Output *.log* and *.stderr files. (Add -keep-data to TEST_FLAGS above or tests will delete their logs.) - find $HOME/gopath/vtdataroot \( -name "*.log*" -or -name "*.stderr" \) -type f -print0 | xargs -0r --verbose --max-args=1 cat