From 0b6a90a28cbce69ba2e07c48f29d798eb5af5035 Mon Sep 17 00:00:00 2001 From: Daniel Van Der Maden Date: Tue, 2 Feb 2021 17:11:09 -0800 Subject: [PATCH] [travis] Cache docker imgs (#3523) * [travis] Cache build img Signed-off-by: Daniel Van Der Maden * [travis] Safely cache imgs Signed-off-by: Daniel Van Der Maden --- .travis.yml | 3 +++ scripts/travis_rosetta_checker.sh | 6 ++++++ scripts/travis_rpc_checker.sh | 6 ++++++ 3 files changed, 15 insertions(+) diff --git a/.travis.yml b/.travis.yml index 850444662..20e20efbc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,6 +4,9 @@ language: go go: - 1.14 go_import_path: github.com/harmony-one/harmony +cache: + directories: + - docker_images env: - TEST="make" - TEST="bash ./scripts/travis_go_checker.sh" diff --git a/scripts/travis_rosetta_checker.sh b/scripts/travis_rosetta_checker.sh index 9d56835b4..150ed954f 100644 --- a/scripts/travis_rosetta_checker.sh +++ b/scripts/travis_rosetta_checker.sh @@ -1,5 +1,11 @@ #!/usr/bin/env bash set -e DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)" +CACHE_DIR="docker_images" +mkdir -p $CACHE_DIR +echo "pulling cached docker img" +docker load -i $CACHE_DIR/images.tar || true docker pull harmonyone/localnet-test +echo "saving cached docker img" +docker save -o $CACHE_DIR/images.tar harmonyone/localnet-test docker run -v "$DIR/../:/go/src/github.com/harmony-one/harmony" harmonyone/localnet-test -r \ No newline at end of file diff --git a/scripts/travis_rpc_checker.sh b/scripts/travis_rpc_checker.sh index 85534a343..6f0529bdb 100755 --- a/scripts/travis_rpc_checker.sh +++ b/scripts/travis_rpc_checker.sh @@ -1,5 +1,11 @@ #!/usr/bin/env bash set -e DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)" +CACHE_DIR="docker_images" +mkdir -p $CACHE_DIR +echo "pulling cached docker img" +docker load -i $CACHE_DIR/images.tar || true docker pull harmonyone/localnet-test +echo "saving cached docker img" +docker save -o $CACHE_DIR/images.tar harmonyone/localnet-test docker run -v "$DIR/../:/go/src/github.com/harmony-one/harmony" harmonyone/localnet-test -n \ No newline at end of file