os: osx

cache:
  ccache: true
  pip: true
  directories:
    - $HOME/Library/Caches/Homebrew
    - $HOME/.pyenv
    - $HOME/Library/Caches/pip
    - /usr/local/Cellar
    - /usr/local/Caskroom
    - /usr/local/opt

env:
  - TRAVIS=1

before_cache:
  - brew cleanup

before_install:
  - test -x /usr/local/bin/ansible || brew install ansible
  - test -x /usr/local/bin/ccache || brew install ccache

install:
  - export PATH="/usr/local/opt/ccache/libexec:$PATH"

script:
  - ansible-galaxy install -r requirements.yml
  - ansible-playbook -i inventory osx.yml

env:
  - TRAVIS=1

install:
  - export PATH="/usr/local/opt/ccache/libexec:$PATH"

matrix:
  include:
    - os: osx
      env:
        - CACHE_NAME=osx
      language: minimal
      before_install:
        - test -x /usr/local/bin/ansible || brew install ansible
        - test -x /usr/local/bin/ccache || brew install ccache
      script:
        - ansible-galaxy install -r requirements.yml
        - ansible-playbook -i inventory osx.yml
      before_cache:
        - brew cleanup
      cache:
        ccache: true
        pip: true
        directories:
          - $HOME/Library/Caches/Homebrew
          - $HOME/.pyenv
          - $HOME/Library/Caches/pip
          - /usr/local/Cellar
          - /usr/local/Caskroom
          - /usr/local/opt
    - os: linux
      env:
        - CACHE_NAME=linux
      cache:
        bundler: true
        directories:
          - $HOME/docker
      language: minimal
      addons:
        apt:
          packages:
            - docker-ce
      before_cache:
        - >
          mkdir -p $HOME/docker && docker images -a --filter='dangling=false' --format '{{.Repository}}:{{.Tag}} {{.ID}}'
          | xargs -n 2 -t sh -c 'test -e $HOME/docker/$1.tar.gz || docker save $0 | gzip -2 > $HOME/docker/$1.tar.gz'
      before_install:
        - if [[ -d $HOME/docker ]]; then ls $HOME/docker/*.tar.gz | xargs -I {file} sh -c "zcat {file} | docker load"; fi
      script:
        - docker-compose up --exit-code-from dotfiles

Refactor Travis to handle multiple OSes
Chore: Refactor Travis to handle multiple OSes

Chore: Enable linux travis job

Chore: Use addons instead of service

Chore: Use minimal language for both jobs

squash! Chore: Refactor Travis to handle multiple OSes

Chore: Cache docker

squash! Chore: Refactor Travis to handle multiple OSes
