summaryrefslogtreecommitdiff
path: root/.travis.yml
diff options
context:
space:
mode:
authorAndres Gomez <agomez@igalia.com>2018-01-31 23:11:52 +0200
committerAndres Gomez <agomez@igalia.com>2018-02-06 11:42:50 +0200
commit2e0ef4346c29f45d1444ef0564439653deb4e025 (patch)
tree1c90a610a7645f2430bb03f527db281c103d1b3a /.travis.yml
parent6fefc0b59b2f04884095f5226854f865e379fec7 (diff)
travis: add docker based cmake build job
Until now we were only running the python unit tests. It seems desirable to also check that the CMake based build compiles successfully. We do that now using docker. The docker build can be tweaked with some environment variables and, also, be stored in the docker hub if desired. Check the changes for extra details regarding these variables. v2: Removed other build possibilities other than just from inside Travis-CI, as suggested by Juan. v3: Replaced the "RELEASE" parameter to create the docker image with "PARENT" and removed some unneeded documentation after v2, as suggested by Juan. v4: - Use DOCKER_PARENT, DOCKER_IMAGE and DOCKER_TAG variables from the custom Travis-CI setup to define the PARENT, IMAGE and TAG parameters during the docker image creation. - Upload the image only if DOCKER_IMAGE and DOCKER_TAG are set. Cc: Dylan Baker <dylan@pnwbakers.com> Cc: Juan A. Suarez <jasuarez@igalia.com> Signed-off-by: Andres Gomez <agomez@igalia.com> Reviewed-by: Juan A. Suarez <jasuarez@igalia.com> Acked-by: Eric Anholt <eric@anholt.net> Acked-by: Dylan Baker <dylan@pnwbakers.com>
Diffstat (limited to '.travis.yml')
-rw-r--r--.travis.yml47
1 files changed, 44 insertions, 3 deletions
diff --git a/.travis.yml b/.travis.yml
index b47829ff9..b4cbcca49 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,5 +1,16 @@
+sudo: false
+os: linux
language: python
-cache: pip
+cache:
+ - ccache
+ - pip
+services:
+ - docker
+
+env:
+ global:
+ - BUILD=pytest
+
matrix:
include:
- python: 2.7
@@ -12,7 +23,37 @@ matrix:
env: TOX_ENV="py35-{generator,noaccel,accel-nix,streams}"
- python: 3.6
env: TOX_ENV="py36-{generator,noaccel,accel-nix,streams}"
+ - env: BUILD=cmake
+
install:
- pip install tox
+ - |
+ if [[ $BUILD == pytest ]]; then
+ pip install tox
+ else
+ wget https://github.com/grammarly/rocker/releases/download/1.3.1/rocker-1.3.1-linux_amd64.tar.gz
+ tar xvf rocker-1.3.1-linux_amd64.tar.gz
+ rm rocker-1.3.1-linux_amd64.tar.gz
+ fi
+
+before_script:
+ - |
+ if [[ $BUILD != pytest ]]; then
+ mkdir -p -m777 ~/.ccache
+ fi
+
script:
- - tox -e $TOX_ENV
+ - |
+ if [[ $BUILD == pytest ]]; then
+ tox -e $TOX_ENV
+ else
+ ./rocker build -f docker/Rockerfile.piglit ${DOCKER_TAG:+--var TAG=}${DOCKER_TAG} ${DOCKER_IMAGE:+--var IMAGE=}${DOCKER_IMAGE} ${DOCKER_PARENT:+--var PARENT=}${DOCKER_PARENT} .
+ fi
+
+after_success:
+ - |
+ if [[ $BUILD != pytest ]]; then
+ if [[ -n $DOCKER_IMAGE && -n $DOCKER_TAG && -n $DOCKER_USERNAME && $TRAVIS_BRANCH == master ]]; then
+ docker login -u "${DOCKER_USERNAME}" -p "${DOCKER_PASSWORD}"
+ docker push "${DOCKER_IMAGE}":"${DOCKER_TAG}"
+ fi
+ fi