From ea839c6cfa0c2bad474e06e5c9fc096f7eb61343 Mon Sep 17 00:00:00 2001 From: "Rodrigo Q. Saramago" Date: Thu, 6 Apr 2023 20:22:33 +0200 Subject: [PATCH] Add foundry cache --- .circleci/config.yml | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index d7df4486050e..4669fdc14ecb 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -150,7 +150,7 @@ commands: default: "nightly" steps: - run: - name: Install foundry + name: Setup Foundry environment variables command: | FOUNDRY_REPO="foundry-rs/foundry" FOUNDRY_VERSION=<< parameters.version >> @@ -161,11 +161,25 @@ commands: "https://api.github.com/repos/${FOUNDRY_REPO}/git/refs/tags/${FOUNDRY_VERSION}" \ | jq --raw-output .object.sha \ ) - FOUNDRY_RELEASE_TAG="nightly-${FOUNDRY_RELEASE_SHA}" + echo "export FOUNDRY_REPO=$FOUNDRY_REPO" >> "$BASH_ENV" + echo "export FOUNDRY_VERSION=$FOUNDRY_VERSION" >> "$BASH_ENV" + echo "export FOUNDRY_RELEASE_TAG='nightly-${FOUNDRY_RELEASE_SHA}'" >> "$BASH_ENV" + # Save commit sha for caching + echo $FOUNDRY_RELEASE_SHA > /tmp/workspace/foundry-release-sha + - restore_cache: + keys: + - foundry-<< parameters.version >>-{{ checksum "/tmp/workspace/foundry-release-sha" }} + - run: + name: Install foundry + command: | wget \ --output-document /tmp/foundry.tar.gz \ "https://github.com/${FOUNDRY_REPO}/releases/download/${FOUNDRY_RELEASE_TAG}/foundry_${FOUNDRY_VERSION}_linux_amd64.tar.gz" sudo tar --extract --gzip --file /tmp/foundry.tar.gz --directory /usr/local/bin + - save_cache: + key: foundry-<< parameters.version >>-{{ checksum "/tmp/workspace/foundry-release-sha" }} + paths: + - /usr/local/bin/forge defaults: