mirror of
https://github.com/storytold/photocraft.git
synced 2026-11-21 20:28:28 +00:00
web CI: skip wasm-opt --converge on pull requests
This commit is contained in:
@@ -426,6 +426,10 @@ jobs:
|
||||
# package.sh runs Trunk's release builds, validates relative URLs, cuts the wasm into
|
||||
# parts, checks the 24 MiB per-file limit and exercises the packaging step release.yml uses.
|
||||
- name: Build and verify browser release
|
||||
env:
|
||||
# Pull requests skip wasm-opt --converge (minutes slower); main keeps it, so the size
|
||||
# gate on a PR measures a slightly larger wasm than main produces.
|
||||
PHOTOCRAFT_WEB_WASM_OPT_CONVERGE: ${{ github.event_name == 'pull_request' && '0' || '1' }}
|
||||
run: packaging/web/package.sh
|
||||
- name: Report wasm size
|
||||
if: success()
|
||||
|
||||
@@ -17,6 +17,18 @@ HERE="$ROOT/packaging/web"
|
||||
|
||||
if [[ "${1:-}" != "--skip-build" ]]; then
|
||||
command -v trunk >/dev/null || { echo "error: trunk not found (cargo install trunk --locked)" >&2; exit 1; }
|
||||
# wasm-opt's --converge repeats its passes until the size stops shrinking, which adds minutes.
|
||||
# PHOTOCRAFT_WEB_WASM_OPT_CONVERGE=0 (pull-request CI) builds without it: the wasm is slightly
|
||||
# larger than a release build produces. Trunk reads the flag only from index.html, so the
|
||||
# attribute is removed for the build and the file restored afterwards.
|
||||
INDEX="$ROOT/apps/photocraft-web/index.html"
|
||||
if [[ "${PHOTOCRAFT_WEB_WASM_OPT_CONVERGE:-1}" == "0" ]]; then
|
||||
cp "$INDEX" "$INDEX.orig"
|
||||
trap 'mv -f "$INDEX.orig" "$INDEX"' EXIT
|
||||
sed -i.sed 's| data-wasm-opt-params="--converge"||' "$INDEX"
|
||||
rm -f "$INDEX.sed"
|
||||
grep -q -- '--converge' "$INDEX" && { echo "error: --converge still in $INDEX" >&2; exit 1; }
|
||||
fi
|
||||
(cd "$ROOT/apps/photocraft-web" && trunk build --release)
|
||||
(cd "$ROOT/apps/photocraft-web-boot" && trunk build --release)
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user