Skip to content

Commit

Permalink
Include glibc version in cache key (#765)
Browse files Browse the repository at this point in the history
This includes the glibc version in the bootstrap cache key, to avoid
issues like this: https://github.com/dfinity/internet-identity/actions/runs/2717048520

While it's unclear why the issue actually occurred, the cache key is now
human readable for easier debugging in the future.
  • Loading branch information
nmattia authored Jul 22, 2022
1 parent 47be902 commit dfcfb7f
Showing 1 changed file with 22 additions and 7 deletions.
29 changes: 22 additions & 7 deletions .github/actions/bootstrap/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,30 @@ description: Bootstrap the Internet Identity build environment
runs:
using: "composite"
steps:
- id: uname
- id: platform
shell: bash
run: |
set -euo pipefail
# print include system info relevant for cache compatibility
uname="$(uname -mpsr)"
echo "uname value: $uname"
uname_hash="$(echo "$uname" | shasum -a 256 | head -c 10)"
echo "uname hash value: $uname_hash"
echo "::set-output name=uname-hash::$uname_hash"
uname_sys=$(uname -s)
case "$uname_sys" in
Darwin)
echo "system is darwin ($uname_sys)"
ver=$(uname -r | sed 's/\./_/g')
echo "darwin version is '$ver'"
echo "::set-output name=platform-id::darwin-$ver"
;;
Linux)
echo "system is linux ($uname_sys)"
glibc_version=$(ldd --version | head -n 1 | grep -oP 'ldd (.*) \K[[:digit:]]+\.[[:digit:]]+' | sed 's/\./_/g')
echo "glibc version is '$glibc_version'"
echo "::set-output name=platform-id::ubuntu-glibc-$glibc_version"
;;
*)
echo uknown system "$uname_sys"
;;
esac
# cache ic-cdk-optimizer
# NOTE: here we make sure to only cache ic-cdk-optimizer and _not_ e.g. the cargo target, since in some cases
Expand All @@ -20,7 +35,7 @@ runs:
- uses: actions/cache@v2
with:
path: ~/.cargo/bin
key: cargo-bin-${{ hashFiles('**/Cargo.lock', 'rust-toolchain.toml') }}-${{ steps.uname.outputs.uname-hash }}
key: cargo-bin-${{ steps.platform.outputs.platform-id }}-${{ hashFiles('**/Cargo.lock', 'rust-toolchain.toml') }}

- name: Bootstrap
shell: bash
Expand Down

0 comments on commit dfcfb7f

Please sign in to comment.