Files
evm/scripts/tests.build_docker_image.sh
zeekay 458178730d evm: derive plugin VM ID from luxfi/constants.EVMID; bump luxfi/gpu v1.0.1
- cmd/vmid prints constants.EVMID — Go source of truth for the C-Chain VM
  ID. Build scripts and Makefile now call this instead of hardcoding the
  base58 string. Drops a stale subnet-evm ID (ag3GReYP…) from the Makefile.
- scripts/build.sh: default output is build/evm; INSTALL=1 installs under
  the derived VMID at \$LUX_PLUGIN_DIR. Codesigns on darwin in-line so a
  fresh binary doesn't get SIGKILLed by gatekeeper post-cp.
- core/parallel/gpu_bridge.go: build tag flipped from \`!nogpu\` (opt-out)
  to \`gpu\` (opt-in) so default builds don't drag in luxfi/gpu cgo.
- go.mod: luxfi/gpu v0.30.0 → v1.0.1. v0.30.0 referenced removed MLX
  symbols (mlx_from_slice_int64 etc.); v1.0.1 migrated to lux/gpu.h and
  builds cleanly with -tags gpu and -tags \"cevm gpu\".
- LLM.md: build commands updated; \"no canonical / no aliases\" reflects
  reality (single VMID, one filename, derived from Go).
2026-05-11 22:36:46 -07:00

82 lines
2.5 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
# Sanity check the image build by attempting to build and run the image without error.
# Directory above this script
EVM_PATH=$(
cd "$(dirname "${BASH_SOURCE[0]}")"
cd .. && pwd
)
# Load the constants
source "$EVM_PATH"/scripts/constants.sh
build_and_test() {
local imagename="${1}"
local vm_id="${2}"
local multiarch_image="${3}"
# The local image name will be used to build a local image if the
# current luxd version lacks a published image.
local luxd_local_image_name="${4}"
if [[ "${multiarch_image}" == true ]]; then
local arches="linux/amd64,linux/arm64"
else
# Test only the host platform for single arch builds
local host_arch
host_arch="$(go env GOARCH)"
local arches="linux/$host_arch"
fi
local imgtag="testtag"
PLATFORMS="${arches}" \
BUILD_IMAGE_ID="${imgtag}" \
VM_ID=$"${vm_id}" \
IMAGE_NAME="${imagename}" \
LUXD_LOCAL_IMAGE_NAME="${luxd_local_image_name}" \
./scripts/build_docker_image.sh
echo "listing images"
docker images
# Check all of the images expected to have been built
local target_images=(
"$imagename:$imgtag"
"$imagename:$DOCKERHUB_TAG"
)
IFS=',' read -r -a archarray <<<"$arches"
for arch in "${archarray[@]}"; do
for target_image in "${target_images[@]}"; do
echo "checking sanity of image $target_image for $arch by running '${VM_ID} version'"
docker run -t --rm --platform "$arch" "$target_image" /luxd/build/plugins/"${VM_ID}" --version
done
done
}
VM_ID="${VM_ID:-${EVM_VMID}}"
echo "checking build of single-arch image"
build_and_test "evm_luxd" "${VM_ID}" false "luxd"
echo "starting local docker registry to allow verification of multi-arch image builds"
REGISTRY_CONTAINER_ID="$(docker run --rm -d -P registry:2)"
REGISTRY_PORT="$(docker port "$REGISTRY_CONTAINER_ID" 5000/tcp | grep -v "::" | awk -F: '{print $NF}')"
echo "starting docker builder that supports multiplatform builds"
# - '--driver-opt network=host' enables the builder to use the local registry
docker buildx create --use --name ci-builder --driver-opt network=host
# Ensure registry and builder cleanup on teardown
function cleanup {
echo "stopping local docker registry"
docker stop "${REGISTRY_CONTAINER_ID}"
echo "removing multiplatform builder"
docker buildx rm ci-builder
}
trap cleanup EXIT
echo "checking build of multi-arch images"
build_and_test "localhost:${REGISTRY_PORT}/evm_luxd" "${VM_ID}" true "localhost:${REGISTRY_PORT}/luxd"