summaryrefslogtreecommitdiff
path: root/.travis.yml
blob: 3043cd4cad75a915dd336aef765fa9f0218409cc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
language: python

os: linux

# Use Ubuntu Xenial (16.04 LTS) environment.
dist: xenial

cache:
  - ccache
  - pip
services:
  - docker

env:
  global:
    - BUILD=pytest

matrix:
  include:
    - python: 2.7
      env: TOX_ENV="py27-{generator,noaccel,accel-nix,streams}"
    - python: 3.4
      env: TOX_ENV="py34-{generator,noaccel,accel-nix,streams}"
    - python: 3.5
      env: TOX_ENV="py35-{generator,noaccel,accel-nix,streams}"
    - python: 3.6
      env: TOX_ENV="py36-{generator,noaccel,accel-nix,streams}"
    - python: 3.7
      env: TOX_ENV="py37-{generator,noaccel,accel-nix,streams}"
    - env: BUILD=cmake

install:
  - |
    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:
  - |
    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