Skip to content

Commit

Permalink
chore: Skip foundry install if possible (#5398)
Browse files Browse the repository at this point in the history
Checks if binary exists and is at the same version for skipping. Should
help in speeding up local bootstraps.
  • Loading branch information
spalladino authored Mar 22, 2024
1 parent a83368c commit 060fa1e
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion l1-contracts/scripts/install_foundry.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
set -eu

export FOUNDRY_DIR="$PWD/.foundry"
Expand All @@ -7,6 +7,14 @@ BIN_URL="https://raw.githubusercontent.com/foundry-rs/foundry/master/foundryup/f
BIN_PATH="$FOUNDRY_BIN_DIR/foundryup"
FOUNDRY_MAN_DIR="$FOUNDRY_DIR/share/man/man1"
FOUNDRY_VERSION="nightly-de33b6af53005037b463318d2628b5cfcaf39916"
FOUNDRY_SHORT_VERSION=$(echo "${FOUNDRY_VERSION#*-}" | cut -c1-6)
echo "$FOUNDRY_SHORT_VERSION"

# Check if forge is installed and matches the expected version
if command -v "forge" > /dev/null 2>&1 && [[ "$(forge --version)" == *"$FOUNDRY_SHORT_VERSION"* ]]; then
echo "Foundry is already installed and at the correct version."
exit 0
fi

# Clean
rm -rf $FOUNDRY_DIR
Expand Down

0 comments on commit 060fa1e

Please sign in to comment.