sudo: required

language: generic

services:
- docker

env:
  global:
  - DOCKER_IMAGE=openimageigo:latest-oiio_1.7
  - CACHE_DIR=$HOME/.cache
  - DOCKER_CACHE_DIR=$CACHE_DIR/docker

cache:
  directories:
  - $DOCKER_CACHE_DIR

before_install:
# load cached Docker images
- if [[ -d $DOCKER_CACHE_DIR ]]; then ls $DOCKER_CACHE_DIR/*.tar.gz | xargs -I {file} sh -c "zcat {file} | docker load"; fi

install:
- docker build -f Dockerfile.ci --cache-from $DOCKER_IMAGE -t $DOCKER_IMAGE .

script:
- docker run -it --rm -v $PWD:/home/go/src/github.com/justinfx/openimageigo $DOCKER_IMAGE

before_cache:
# save tagged Docker images
# https://github.com/travis-ci/travis-ci/issues/5358#issuecomment-248915326
- >
  mkdir -p $DOCKER_CACHE_DIR && docker images -a --filter='dangling=false' --format '{{.Repository}}:{{.Tag}} {{.ID}}'
  | xargs -n 2 -t sh -c 'test -e $DOCKER_CACHE_DIR/$1.tar.gz || docker save $0 | gzip -2 > $DOCKER_CACHE_DIR/$1.tar.gz'

sudo: required

language: generic

services:
- docker

env:
  global:
  - DOCKER_IMAGE=openimageigo:latest-oiio_1.6
  - CACHE_DIR=$HOME/.cache
  - DOCKER_CACHE_DIR=$CACHE_DIR/docker

cache:
  directories:
  - $DOCKER_CACHE_DIR

before_install:
# load cached Docker images
- if [[ -d $DOCKER_CACHE_DIR ]]; then ls $DOCKER_CACHE_DIR/*.tar.gz | xargs -I {file} sh -c "zcat {file} | docker load"; fi

install:
- docker build -f Dockerfile.ci --cache-from $DOCKER_IMAGE -t $DOCKER_IMAGE .

script:
- docker run -it --rm -v $PWD:/home/go/src/github.com/justinfx/openimageigo $DOCKER_IMAGE

before_cache:
# save tagged Docker images
# https://github.com/travis-ci/travis-ci/issues/5358#issuecomment-248915326
- >
  mkdir -p $DOCKER_CACHE_DIR && docker images -a --filter='dangling=false' --format '{{.Repository}}:{{.Tag}} {{.ID}}'
  | xargs -n 2 -t sh -c 'test -e $DOCKER_CACHE_DIR/$1.tar.gz || docker save $0 | gzip -2 > $DOCKER_CACHE_DIR/$1.tar.gz'

Fix Travis yaml oiio version tag
Fix Travis yaml oiio version tag