Skip to content

Commit

Permalink
fix: fix foundry-zksync-install CI check (#735)
Browse files Browse the repository at this point in the history
  • Loading branch information
nbaztec authored Nov 20, 2024
1 parent f51b213 commit 0c43026
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Install foundry-zksync
run: |
cd /tmp && curl -L https://raw.githubusercontent.com/matter-labs/foundry-zksync/main/install-foundry-zksync | bash
run: cp ./install-foundry-zksync ./foundryup-zksync/* /tmp/ && cd /tmp && ./install-foundry-zksync
- name: Verify installation
run: forge --version
22 changes: 15 additions & 7 deletions install-foundry-zksync
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,13 @@ set -e
INSTALL_SCRIPT_URL="https://raw.githubusercontent.com/matter-labs/foundry-zksync/main/foundryup-zksync/install"
FOUNDRYUP_ZKSYNC_URL="https://raw.githubusercontent.com/matter-labs/foundry-zksync/main/foundryup-zksync/foundryup-zksync"

# Download the install script
echo "Downloading the install script..."
curl -L "$INSTALL_SCRIPT_URL" -o install
if [ -n "${CI}" ]; then
echo "Using local install script..."
else
# Download the install script
echo "Downloading the install script..."
curl -L "$INSTALL_SCRIPT_URL" -o install
fi

echo "Making install script executable..."
chmod +x ./install
Expand All @@ -19,11 +23,11 @@ echo "Running the installation script..."
# Extract the exact path from the install.log
# Use sed to precisely capture the path after 'source' and before the next apostrophe
SHELL_CONFIG_FILE=$(sed -n "s/.*Run 'source \(.*\)'.*/\1/p" install.log)
FOUNDRY_BIN_DIR="${XDG_CONFIG_HOME:-$HOME}/.foundry/bin"

if [ -n "$SHELL_CONFIG_FILE" ]; then
if [ -n "${CI}" ]; then
# Add manually to $PATH in CI mode as GHA does not work with `.`
FOUNDRY_BIN_DIR="${XDG_CONFIG_HOME:-$HOME}/.foundry/bin"
echo "adding '${FOUNDRY_BIN_DIR}' to PATH and GITHUB_PATH"
export PATH="$PATH:$FOUNDRY_BIN_DIR"
echo "${FOUNDRY_BIN_DIR}" >> $GITHUB_PATH
Expand All @@ -36,8 +40,12 @@ else
echo "No shell configuration file detected. Please source your shell manually or start a new terminal session."
fi

echo "Downloading foundryup-zksync..."
curl -L "$FOUNDRYUP_ZKSYNC_URL" -o foundryup-zksync
if [ -n "${CI}" ]; then
echo "Using local foundryup-zksync script..."
else
echo "Downloading foundryup-zksync..."
curl -L "$FOUNDRYUP_ZKSYNC_URL" -o foundryup-zksync
fi

echo "Making foundryup-zksync executable..."
chmod +x ./foundryup-zksync
Expand All @@ -54,7 +62,7 @@ echo "Cleanup completed."
echo "Installation completed successfully!"

echo "Verifying installation..."
if "$HOME/.foundry/bin/forge" --version | grep -q "0.0.2"; then
if "${FOUNDRY_BIN_DIR}/forge" --version | grep -q "0.0.2"; then
echo "Forge version 0.0.2 is successfully installed."
else
echo "Installation verification failed. Forge is not properly installed."
Expand Down

0 comments on commit 0c43026

Please sign in to comment.