Skip to content
This repository has been archived by the owner on Sep 1, 2021. It is now read-only.

Commit

Permalink
Cache Docker Linux build on Travis, fixes #40
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreMiras committed Apr 8, 2018
1 parent 3637d72 commit 645c30d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
20 changes: 20 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,29 @@ language: generic
services:
- docker

env:
global:
- 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 --tag=etheroll .

script:
- docker run -e ETHERSCAN_API_KEY=$ETHERSCAN_API_KEY etheroll
/bin/sh -c '. venv/bin/activate && make test'

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'
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

- Setup continuous integration, refs #18
- Dockerized project, refs #19
- Caching Docker Linux build on Travis, refs #40


## [v20180405]
Expand Down

0 comments on commit 645c30d

Please sign in to comment.