mirror of
https://github.com/luxfi/evmgpu.git
synced 2026-10-30 16:57:11 +00:00
62 lines
2.5 KiB
Bash
Executable File
62 lines
2.5 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
set -euo pipefail
|
|
|
|
# Builds docker images for antithesis testing.
|
|
|
|
# e.g.,
|
|
# ./scripts/build_antithesis_images.sh # Build local images
|
|
# IMAGE_PREFIX=<registry>/<repo> IMAGE_TAG=latest ./scripts/build_antithesis_images.sh # Specify a prefix to enable image push and use a specific tag
|
|
|
|
# Directory above this script
|
|
EVM_PATH=$( cd "$( dirname "${BASH_SOURCE[0]}" )"; cd .. && pwd )
|
|
|
|
# Assume it's necessary to build the luxd node image from source
|
|
# TODO(marun) Support use of a released node image if using a release version of luxd
|
|
|
|
source "${EVM_PATH}"/scripts/constants.sh
|
|
# shellcheck source=/dev/null
|
|
source "${EVM_PATH}"/scripts/lib_luxd_clone.sh
|
|
|
|
clone_luxd "${LUX_VERSION}"
|
|
LUXD_IMAGE_TAG="$(luxd_image_tag_from_clone)"
|
|
|
|
# Build luxd node image in the clone path
|
|
pushd "${LUXD_CLONE_PATH}" > /dev/null
|
|
NODE_ONLY=1 TEST_SETUP=luxd IMAGE_TAG="${LUXD_IMAGE_TAG}" bash -x "${LUXD_CLONE_PATH}"/scripts/build_antithesis_images.sh
|
|
popd > /dev/null
|
|
|
|
# Specifying an image prefix will ensure the image is pushed after build
|
|
IMAGE_PREFIX="${IMAGE_PREFIX:-}"
|
|
|
|
IMAGE_TAG="${IMAGE_TAG:-}"
|
|
if [[ -z "${IMAGE_TAG}" ]]; then
|
|
# Default to tagging with the commit hash
|
|
source "${EVM_PATH}"/scripts/constants.sh
|
|
IMAGE_TAG="${EVM_COMMIT::8}"
|
|
fi
|
|
|
|
# The dockerfiles don't specify the golang version to minimize the changes required to bump
|
|
# the version. Instead, the golang version is provided as an argument.
|
|
GO_VERSION="$(go list -m -f '{{.GoVersion}}')"
|
|
|
|
# Import common functions used to build images for antithesis test setups
|
|
# shellcheck source=/dev/null
|
|
source "${LUXD_CLONE_PATH}"/scripts/lib_build_antithesis_images.sh
|
|
|
|
build_antithesis_builder_image "${GO_VERSION}" "antithesis-evm-builder:${IMAGE_TAG}" "${LUXD_CLONE_PATH}" "${EVM_PATH}"
|
|
|
|
# Ensure luxd and evm binaries are available to create an initial db state that includes subnets.
|
|
pushd "${LUXD_CLONE_PATH}" && ./scripts/build.sh && popd
|
|
"${EVM_PATH}"/scripts/build.sh
|
|
|
|
echo "Generating compose configuration"
|
|
gen_antithesis_compose_config "${IMAGE_TAG}" "${EVM_PATH}/tests/antithesis/gencomposeconfig" \
|
|
"${EVM_PATH}/build/antithesis" \
|
|
"LUXD_PATH=${LUXD_CLONE_PATH}/build/luxd \
|
|
LUXD_PLUGIN_DIR=${DEFAULT_PLUGIN_DIR}"
|
|
|
|
build_antithesis_images "${GO_VERSION}" "${IMAGE_PREFIX}" "antithesis-evm" "${IMAGE_TAG}" \
|
|
"${LUXD_IMAGE_TAG}" "${EVM_PATH}/tests/antithesis/Dockerfile" \
|
|
"${EVM_PATH}/Dockerfile" "${EVM_PATH}"
|