This guide explains how to test build-script changes locally in the same sandboxed environment that CI uses.
- Docker installed and running.
- For AArch64 images on an x86_64 host: Docker with multi-platform support (e.g. QEMU binfmt or Docker Desktop's built-in emulation). Building natively is strongly recommended for AArch64 because emulation will be very slow for a full LLVM or tket build.
The Dockerfiles in docker/ wrap the official quay.io/pypa/manylinux_2_28_*
images. They do not embed the build scripts; instead the repository root is
mounted at /host at runtime so that edits are picked up immediately without
rebuilding the image.
Each build script lives at deps/<dependency>/<platform>.sh and takes a single
argument: the path where the output .tar.gz should be written.
# 1. Build the helper image (one-time, or after Dockerfile changes)
docker build \
-f docker/manylinux_2_28_x86_64.Dockerfile \
-t hugrverse-env-manylinux-x86_64 \
.
# 2. Run a single dependency build (e.g. llvm)
mkdir -p artifacts
docker run --rm \
-v "$(pwd):/host" \
hugrverse-env-manylinux-x86_64 \
bash /host/deps/llvm/manylinux_2_28_x86_64.sh \
/host/artifacts/hugrenv-llvm-manylinux_2_28_x86_64.tar.gzReplace llvm with tket (or any other dependency) to build that component
instead.
docker build \
-f docker/manylinux_2_28_aarch64.Dockerfile \
-t hugrverse-env-manylinux-aarch64 \
.
mkdir -p artifacts
docker run --rm \
-v "$(pwd):/host" \
hugrverse-env-manylinux-aarch64 \
bash /host/deps/llvm/manylinux_2_28_aarch64.sh \
/host/artifacts/hugrenv-llvm-manylinux_2_28_aarch64.tar.gzTip: pass
-e VERBOSE=1to enable verbose output from build sub-steps, and-e MAKEFLAGS="-j4"to limit parallelism if memory is constrained.
To drop into an interactive shell inside the container without running a full build:
docker run --rm -it \
-v "$(pwd):/host" \
hugrverse-env-manylinux-x86_64 \
bashYou can then run individual scripts (e.g.
bash /host/deps/llvm/manylinux_2_28_x86_64.sh /tmp/hugrenv-llvm-manylinux_2_28_x86_64.tar.gz)
to test in isolation.
macOS build scripts run natively; no Docker is needed. The MACOSX_DEPLOYMENT_TARGET
environment variable should be set to 11.0 to match what CI uses.
export MACOSX_DEPLOYMENT_TARGET=11.0
# ARM64
bash deps/llvm/macosx_11_0_aarch64.sh /tmp/hugrenv-llvm-macosx_11_0_aarch64.tar.gz
# x86_64 (Intel Mac)
bash deps/llvm/macosx_11_0_x86_64.sh /tmp/hugrenv-llvm-macosx_11_0_x86_64.tar.gzReplace llvm with tket to build the tket dependency. The scripts will
install any missing dependencies via Homebrew.
Windows scripts are standard Bash scripts that must be run from a shell that
has the MSVC environment loaded (e.g. Git Bash launched from a Developer
Command Prompt for VS 2022, or after sourcing vcvars64.bat). CI uses the
ilammy/msvc-dev-cmd action to set this up automatically.
bash deps/llvm/win_amd64.sh /tmp/hugrenv-llvm-win_amd64.tar.gz
bash deps/tket/win_amd64.sh /tmp/hugrenv-tket-win_amd64.tar.gzThe MSVC environment can be loaded in a regular PowerShell session by sourcing
"C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat".
- Create a
deps/<dependency>/directory with a<platform>.shscript for each supported platform. Each script must accept the output tarball path as its first argument. - Test locally using the methods above before opening a PR.
- Update
README.mdto document the new component.
After a local build, inspect the archive to confirm its contents:
# Linux / macOS
tar -tzf artifacts/hugrenv-llvm-manylinux_2_28_x86_64.tar.gz | head -20
# Windows
tar -tzf /tmp/hugrenv-llvm-win_amd64.tar.gz | head -20LLVM binaries should appear under hugrverse/bin/ in the archive; tket
libraries under hugrverse/lib/.