From fba494343f5f39071e8da889f5dd3821dc499ee2 Mon Sep 17 00:00:00 2001 From: Michael Vines Date: Sat, 30 Jun 2018 21:51:15 -0700 Subject: [PATCH] Save/restore target/ directory between builds --- .buildkite/hooks/post-command | 14 ++++++++++++++ .buildkite/hooks/pre-command | 13 +++++++++++++ ci/buildkite.yml | 6 ++++++ 3 files changed, 33 insertions(+) create mode 100755 .buildkite/hooks/post-command create mode 100755 .buildkite/hooks/pre-command diff --git a/.buildkite/hooks/post-command b/.buildkite/hooks/post-command new file mode 100755 index 0000000000..381cc88321 --- /dev/null +++ b/.buildkite/hooks/post-command @@ -0,0 +1,14 @@ +#!/bin/bash -e + +[[ -n "$CARGO_TARGET_CACHE_NAME" ]] || exit 0 + +# +# Save target/ for the next CI build on this machine +# +( + d=$HOME/cargo-target-cache/"$CARGO_TARGET_CACHE_NAME" + mkdir -p $d + set -x + rsync -a --delete target $d + du -hs $d +) diff --git a/.buildkite/hooks/pre-command b/.buildkite/hooks/pre-command new file mode 100755 index 0000000000..432e19d0a8 --- /dev/null +++ b/.buildkite/hooks/pre-command @@ -0,0 +1,13 @@ +#!/bin/bash -e + +[[ -n "$CARGO_TARGET_CACHE_NAME" ]] || exit 0 + +# +# Restore target/ from the previous CI build on this machine +# +( + d=$HOME/cargo-target-cache/"$CARGO_TARGET_CACHE_NAME" + mkdir -p $d/target + set -x + rsync -a --delete $d/target . +) diff --git a/ci/buildkite.yml b/ci/buildkite.yml index d17ed260d8..fc125e67b3 100644 --- a/ci/buildkite.yml +++ b/ci/buildkite.yml @@ -1,15 +1,21 @@ steps: - command: "ci/docker-run.sh rust ci/test-stable.sh" name: "stable [public]" + env: + CARGO_TARGET_CACHE_NAME: "stable" timeout_in_minutes: 20 - command: "ci/shellcheck.sh" name: "shellcheck [public]" timeout_in_minutes: 20 - command: "ci/docker-run.sh rustlang/rust:nightly ci/test-nightly.sh" name: "nightly [public]" + env: + CARGO_TARGET_CACHE_NAME: "nightly" timeout_in_minutes: 30 - command: "ci/test-stable-perf.sh" name: "stable-perf [public]" + env: + CARGO_TARGET_CACHE_NAME: "stable-perf" timeout_in_minutes: 20 retry: automatic: