Miguel de Benito Delgado 731bcc5664 🎉 Add playground renderer benchmark suite
Share seven deterministic fixtures with the playground pages and measure
renderer lifecycle, pan, and zoom through a prepared Playwright runner.
Retain raw attempts and failures with offline statistical comparisons.

Add focused tests and separate browser fault diagnostics. Full-suite
calibration and shadow GPU validation remain tracked follow-up work.

AI-assisted-by: GPT-6
2026-10-28 19:17:38 +01:00

50 lines
1.4 KiB
Bash
Executable File

#!/usr/bin/env bash
# Usage: ./build [frontend|export] [extra cargo params...]
#
# With no target, builds both. Set BUILD_MODE=release (or NODE_ENV=production)
# for an optimized build. See `_build_env` for what each target changes.
# Set PENPOT_WASM_PREPARED=1 to skip dependency setup in a prepared environment.
_SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)
_RENDER_TARGET=${1:-}
case "$_RENDER_TARGET" in
frontend|export) ;;
"")
# Each target needs its own `_build_env`, so re-enter per target.
for _target in frontend export; do
"$_SCRIPT_DIR/build" "$_target" "$@" || exit $?
done
exit 0
;;
*)
echo "ERROR: unknown render target '$_RENDER_TARGET' (expected 'frontend' or 'export')" >&2
exit 1
;;
esac
set -e -o pipefail
EMSDK_QUIET=1 . /opt/emsdk/emsdk_env.sh
pushd "$_SCRIPT_DIR" > /dev/null
export RENDER_TARGET="$_RENDER_TARGET"
. ./_build_env "$_RENDER_TARGET" "${@:2}"
. ./_build_lock
acquire_build_lock
set -x
if [ "${PENPOT_WASM_PREPARED:-0}" != "1" ]; then
setup;
else
command -v cargo >/dev/null || { echo "Prepare the Rust toolchain first" >&2; exit 1; };
command -v pnpm >/dev/null || { echo "Prepare pnpm and renderer dependencies first" >&2; exit 1; };
test -d node_modules/esbuild || { echo "Run pnpm install in render-wasm before benchmarking" >&2; exit 1; };
fi
popd > /dev/null