ipld-eth-server/scripts/integration-setup.sh
Roy Crihfield 2195728dd4
Some checks failed
Test the stack. / Run unit tests (pull_request) Failing after 59s
Test the stack. / Run integration tests (pull_request) Successful in 57m7s
update goose min version
2024-05-13 12:38:40 +08:00

54 lines
1.8 KiB
Bash
Executable File

#!/bin/bash
# Builds and deploys a stack with only what we need.
# This script assumes we are running in the project root.
set -e
laconic_so="${LACONIC_SO:-laconic-so} --stack $(readlink -f test) --verbose"
CONFIG_DIR=$(readlink -f "${CONFIG_DIR:-$(mktemp -d)}")
# Prevent conflicting tty output
export BUILDKIT_PROGRESS=plain
# By default assume we are running in the project root
export CERC_REPO_BASE_DIR="${CERC_REPO_BASE_DIR:-..}"
echo CERC_STATEDIFF_DB_GOOSE_MIN_VER=21 >> $CONFIG_DIR/stack.env
# Pass this in so we can run eth_call forwarding tests, which expect no IPLD DB
echo CERC_RUN_STATEDIFF=${CERC_RUN_STATEDIFF:-true} >> $CONFIG_DIR/stack.env
# Don't run the debugger
echo CERC_REMOTE_DEBUG=false >> $CONFIG_DIR/stack.env
set -x
if [[ -z $SKIP_BUILD ]]; then
$laconic_so setup-repositories \
--exclude git.vdb.to/cerc-io/ipld-eth-server
# Assume the tested image has been built separately
$laconic_so build-containers \
--exclude cerc/ipld-eth-server
fi
$laconic_so deploy \
--exclude ipld-eth-server \
--env-file $CONFIG_DIR/stack.env \
--cluster test up
set +x
# Get IPv4 endpoint of geth file server
bootnode_endpoint=$(docker port test-fixturenet-eth-bootnode-geth-1 9898 | head -1)
# Extract the chain config and ID from genesis file
curl -s $bootnode_endpoint/geth.json | jq '.config' > $CONFIG_DIR/chain.json
# Output vars if we are running on Github
if [[ -n "$GITHUB_ENV" ]]; then
echo ETH_CHAIN_ID="$(jq '.chainId' $CONFIG_DIR/chain.json)" >> "$GITHUB_ENV"
echo ETH_CHAIN_CONFIG="$CONFIG_DIR/chain.json" >> "$GITHUB_ENV"
echo ETH_HTTP_PATH=$(docker port test-fixturenet-eth-geth-1-1 8545 | head -1) >> "$GITHUB_ENV"
# Read a private key so we can send from a funded account
echo DEPLOYER_PRIVATE_KEY=$(curl -s $bootnode_endpoint/accounts.csv | head -1 | cut -d',' -f3) >> "$GITHUB_ENV"
fi