Skip to content

Commit

Permalink
fix: incl rustup in makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
rymnc committed Feb 21, 2024
1 parent 68f5955 commit 146671d
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 7 deletions.
17 changes: 16 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,20 @@ endif
##################
.PHONY: deps libbacktrace

rustup:
ifeq (, $(shell which cargo))
# Install Rustup if it's not installed
# -y: Assume "yes" for all prompts
# --default-toolchain stable: Install the stable toolchain
curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain stable
endif

anvil: rustup
ifeq (, $(shell which anvil))
# Install Anvil if it's not installed
./scripts/install_anvil.sh
endif

deps: | deps-common nat-libs waku.nims


Expand Down Expand Up @@ -166,7 +180,8 @@ testcommon: | build deps
##########
.PHONY: testwaku wakunode2 testwakunode2 example2 chat2 chat2bridge

testwaku: | build deps librln
# install anvil only for the testwaku target
testwaku: | build deps anvil librln
echo -e $(BUILD_MSG) "build/$@" && \
$(ENV_SCRIPT) nim test -d:os=$(shell uname) $(NIM_PARAMS) waku.nims

Expand Down
15 changes: 15 additions & 0 deletions scripts/install_anvil.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env bash

# Install Anvil


BASE_DIR="${XDG_CONFIG_HOME:-$HOME}"
FOUNDRY_DIR="${FOUNDRY_DIR-"$BASE_DIR/.foundry"}"
FOUNDRY_BIN_DIR="$FOUNDRY_DIR/bin"
BIN_PATH="$FOUNDRY_BIN_DIR"

curl -L https://foundry.paradigm.xyz | bash
# Extract the source path from the download result
echo "foundryup_path: $BIN_PATH"
# run foundryup
$BIN_PATH/foundryup
6 changes: 0 additions & 6 deletions tests/waku_rln_relay/test_rln_group_manager_onchain.nim
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,6 @@ proc runAnvil(): Process =
# --chain-id Chain ID of the network.
# See anvil documentation https://book.getfoundry.sh/reference/anvil/ for more details
try:
let installAnvil = startProcess("cargo", args = ["install", "--git", "https://github.com/foundry-rs/foundry", "--profile", "local", "--locked", "anvil"], options = {poUsePath})
let anvilExitCode = waitForExit(installAnvil)
if anvilExitCode != 0:
error "Anvil installation failed", anvilExitCode
raise newException(CatchableError, "Anvil installation failed: " & $anvilExitCode)

let runAnvil = startProcess("anvil", args = ["--port", "8540", "--gas-limit", "300000000000000", "--balance", "10000", "--chain-id", "1337"], options = {poUsePath})
let anvilPID = runAnvil.processID

Expand Down

0 comments on commit 146671d

Please sign in to comment.