ethers-rs/.github/scripts/install_test_binaries.sh

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

53 lines
1.3 KiB
Bash
Raw Normal View History

2023-02-24 19:45:48 +00:00
#!/usr/bin/env bash
# Installs Solc and Geth binaries
set -e
GETH_BUILD=${GETH_BUILD:-"1.11.2-73b01f40"}
SOLC_VERSION=${SOLC_VERSION:-"0.8.19"}
DIR="$HOME/bin"
mkdir -p "$DIR"
cd "$DIR"
export PATH="$DIR:$PATH"
2023-02-24 23:20:42 +00:00
if [ "$GITHUB_PATH" ]; then
echo "$DIR" >> "$GITHUB_PATH"
echo "$HOME/.cargo/bin" >> "$GITHUB_PATH"
fi
2023-02-24 19:45:48 +00:00
echo "Installing Geth"
2023-02-24 21:09:39 +00:00
PLATFORM="$(uname -s | awk '{print tolower($0)}')"
2023-02-24 19:45:48 +00:00
case "$PLATFORM" in
2023-02-24 21:09:39 +00:00
linux|darwin)
GETH_ARCHIVE_NAME="geth-$PLATFORM-amd64-$GETH_BUILD"
2023-02-24 19:45:48 +00:00
curl "https://gethstore.blob.core.windows.net/builds/$GETH_ARCHIVE_NAME.tar.gz" | tar -xzvf -
mv -f "$GETH_ARCHIVE_NAME/geth" ./
rm -rf "$GETH_ARCHIVE_NAME"
chmod +x geth
;;
*)
GETH_ARCHIVE_NAME="geth-windows-amd64-$GETH_BUILD"
2023-02-24 20:16:51 +00:00
zip="$GETH_ARCHIVE_NAME.zip"
curl -o "$zip" "https://gethstore.blob.core.windows.net/builds/$zip"
unzip "$zip"
2023-02-24 19:45:48 +00:00
mv -f "$GETH_ARCHIVE_NAME/geth.exe" ./
2023-02-24 20:16:51 +00:00
rm -rf "$GETH_ARCHIVE_NAME" "$zip"
2023-02-24 19:45:48 +00:00
;;
esac
geth version
echo "Installing Solc"
cargo install --locked svm-rs
# install only if it doesn't exist already
if command -v solc; then
if [ -z "$(solc --version | grep "$SOLC_VERSION" || true)" ]; then
svm install "$SOLC_VERSION"
fi
svm use "$SOLC_VERSION"
fi
solc --version
2023-02-24 23:20:42 +00:00
which geth
which solc