fix(web): CI-owned wasm artifacts + e2e harness fixes #95
@@ -22,6 +22,22 @@ set -euo pipefail
|
|||||||
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
OUT_DIR="$REPO_ROOT/solitaire_server/web/pkg"
|
OUT_DIR="$REPO_ROOT/solitaire_server/web/pkg"
|
||||||
|
|
||||||
|
# Reproducible builds. The wasm artifacts otherwise bake in machine-specific
|
||||||
|
# absolute source paths (the cargo registry, the rustup std sources, and this
|
||||||
|
# checkout), so a rebuild on a different machine produces different bytes and
|
||||||
|
# the CI freshness gate (rebuild-and-diff) false-positives. Remap all three
|
||||||
|
# prefixes to fixed names so the output is byte-identical anywhere.
|
||||||
|
#
|
||||||
|
# We must use CARGO_ENCODED_RUSTFLAGS (not RUSTFLAGS) and re-state the
|
||||||
|
# getrandom backend cfg here: a `*_RUSTFLAGS` env var *replaces* — does not
|
||||||
|
# merge with — the `[target.wasm32-unknown-unknown] rustflags` in
|
||||||
|
# .cargo/config.toml, so dropping that cfg would break the wasm getrandom build.
|
||||||
|
# Keep this `--cfg` in sync with .cargo/config.toml.
|
||||||
|
CARGO_HOME_DIR="${CARGO_HOME:-$HOME/.cargo}"
|
||||||
|
RUSTUP_HOME_DIR="${RUSTUP_HOME:-$HOME/.rustup}"
|
||||||
|
US=$'\x1f' # unit separator: CARGO_ENCODED_RUSTFLAGS arg delimiter
|
||||||
|
export CARGO_ENCODED_RUSTFLAGS="--cfg${US}getrandom_backend=\"wasm_js\"${US}--remap-path-prefix=${CARGO_HOME_DIR}=/cargo${US}--remap-path-prefix=${RUSTUP_HOME_DIR}=/rustup${US}--remap-path-prefix=${REPO_ROOT}=/build"
|
||||||
|
|
||||||
if ! command -v wasm-pack &> /dev/null; then
|
if ! command -v wasm-pack &> /dev/null; then
|
||||||
echo "error: wasm-pack not found." >&2
|
echo "error: wasm-pack not found." >&2
|
||||||
echo " Install with: cargo install wasm-pack" >&2
|
echo " Install with: cargo install wasm-pack" >&2
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user