From a3d5a3b0ae2edc36e67e1b1e4e591d7f9fb085d6 Mon Sep 17 00:00:00 2001
From: Roman Tsisyk <roman@tsisyk.com>
Date: Fri, 15 Sep 2017 08:02:13 +0300
Subject: [PATCH] Travis CI: use Docker for testing

Ubuntu Trusty on Travis is buggy.

Fixes #2752
---
 .travis.mk  | 34 ++++++++++++++++++++++++++++------
 .travis.yml | 33 ++-------------------------------
 2 files changed, 30 insertions(+), 37 deletions(-)

diff --git a/.travis.mk b/.travis.mk
index 9a98991120..49c071ac3f 100644
--- a/.travis.mk
+++ b/.travis.mk
@@ -2,6 +2,8 @@
 # Travis CI rules
 #
 
+DOCKER_IMAGE:=packpack/packpack:ubuntu-zesty
+
 all: package
 
 source:
@@ -14,13 +16,33 @@ package:
 
 test: test_$(TRAVIS_OS_NAME)
 
-deps_linux:
-	sudo apt-get update > /dev/null
-	sudo apt-get -q -y install binutils-dev python-daemon python-yaml
-	sudo pip install six==1.9.0
-	sudo pip install gevent==1.1.2
+# Redirect some targets via docker
+test_linux: docker_test_ubuntu
+coverage: docker_coverage_ubuntu
+
+docker_%:
+	mkdir -p ~/.cache/ccache
+	docker run \
+		--rm=true --tty=true \
+		--volume "${PWD}:/tarantool" \
+		--volume "${HOME}/.cache:/cache" \
+		--workdir /tarantool \
+		-e XDG_CACHE_HOME=/cache \
+		-e CCACHE_DIR=/cache/ccache \
+		-e COVERALLS_TOKEN=${COVERALLS_TOKEN} \
+		${DOCKER_IMAGE} \
+		make -f .travis.mk $(subst docker_,,$@)
+
+deps_ubuntu:
+	sudo apt-get update && apt-get install -y -f \
+		build-essential cmake coreutils sed \
+		libreadline-dev libncurses5-dev libyaml-dev libssl-dev \
+		libcurl4-openssl-dev binutils-dev \
+		python python-pip python-setuptools python-dev \
+		python-msgpack python-yaml python-argparse python-six python-gevent \
+		lcov ruby
 
-test_linux: deps_linux
+test_ubuntu: deps_ubuntu
 	cmake . -DCMAKE_BUILD_TYPE=RelWithDebInfo
 	make -j8
 	cd test && /usr/bin/python test-run.py
diff --git a/.travis.yml b/.travis.yml
index de8f9e2ba0..8fb17aa677 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,16 +1,13 @@
-sudo: required
+sudo: false
 services:
   - docker
 
 language: cpp
+
 os:
   - linux
   - osx
 
-compiler:
-  - clang
-  - gcc
-
 cache:
     directories:
       - $HOME/.cache
@@ -51,30 +48,6 @@ matrix:
 #      - env: OS=debian DIST=jessie
 #      - env: OS=debian DIST=stretch
     exclude:
-      - env: OS=el DIST=6
-        compiler: clang
-      - env: OS=el DIST=7
-        compiler: clang
-      - env: OS=fedora DIST=24
-        compiler: clang
-      - env: OS=fedora DIST=25
-        compiler: clang
-      - env: OS=ubuntu DIST=precise
-        compiler: clang
-      - env: OS=ubuntu DIST=trusty
-        compiler: clang
-      - env: OS=ubuntu DIST=xenial
-        compiler: clang
-      - env: OS=ubuntu DIST=yakkety
-        compiler: clang
-      - env: OS=debian DIST=wheezy
-        compiler: clang
-      - env: OS=debian DIST=jessie
-        compiler: clang
-      - env: OS=debian DIST=stretch
-        compiler: clang
-      - env: TARGET=source
-        compiler: clang
       - env: OS=el DIST=6
         os: osx
       - env: OS=el DIST=7
@@ -99,8 +72,6 @@ matrix:
         os: osx
       - env: TARGET=source
         os: osx
-      - os: osx
-        compiler: gcc
 
 script:
   - make -f .travis.mk ${TARGET}
-- 
GitLab