From 5b0d429d1ac4288d615afccfe1eeb16e68141488 Mon Sep 17 00:00:00 2001 From: Andres Noetzli Date: Thu, 3 Jun 2021 15:26:52 -0700 Subject: [PATCH] [GitHub Actions] Make caching of dependencies depend on image version (#6677) Our Clang builds started to fail to link when the environment changed. This commit changes our CI to only use cached dependencies if the build environment has not changed. --- .github/workflows/ci.yml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b9ec42af3..95c6c035c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -77,6 +77,11 @@ jobs: sudo cmake . sudo cmake --build . --target install cd - + # Make ImageVersion accessible as env.image_version. Environment + # variables of the runner are not automatically imported: + # + # https://github.com/actions/runner/blob/master/docs/adrs/0278-env-context.md#dont-populate-the-env-context-with-environment-variables-from-runner-machine + echo "image_version=$ImageVersion" >> $GITHUB_ENV echo "/usr/lib/ccache" >> $GITHUB_PATH # Note: macOS comes with a libedit; it does not need to brew-installed @@ -93,6 +98,11 @@ jobs: python3 -m pip install toml python3 -m pip install setuptools python3 -m pip install pexpect + # Make ImageVersion accessible as env.image_version. Environment + # variables of the runner are not automatically imported: + # + # https://github.com/actions/runner/blob/master/docs/adrs/0278-env-context.md#dont-populate-the-env-context-with-environment-variables-from-runner-machine + echo "image_version=$ImageVersion" >> $GITHUB_ENV echo "/usr/local/opt/ccache/libexec" >> $GITHUB_PATH - name: Install Python Dependencies @@ -170,7 +180,9 @@ jobs: uses: actions/cache@v2 with: path: build/deps - key: cvc5-deps-${{ runner.os }}-${{ matrix.cache-key }}-${{ hashFiles('cmake/Find**', 'cmake/deps-helper.cmake') }}-${{ hashFiles('.github/workflows/ci.yml') }} + # The cache depends on the image version to make sure that we do not + # restore the dependencies if the build environment has changed. + key: cvc5-deps-${{ runner.os }}-${{ env.image_version }}-${{ matrix.cache-key }}-${{ hashFiles('cmake/Find**', 'cmake/deps-helper.cmake') }}-${{ hashFiles('.github/workflows/ci.yml') }} - name: Configure run: | -- 2.30.2