File tree Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Original file line number Diff line number Diff line change 5757 - name : Setup wasm-snip
5858 run : " cargo install --git https://github.com/r58playz/wasm-snip"
5959
60+ - name : Cache rewriter build artifacts
61+ uses : actions/cache@v4
62+ id : rewriter-cache
63+ with :
64+ path : |
65+ rewriter/wasm/out
66+ dist/scramjet.wasm.wasm
67+ key : rewriter-release-${{ hashFiles('rewriter/wasm/Cargo.toml', 'rewriter/wasm/src/**/*.rs', 'rewriter/wasm/build.sh') }}
68+ restore-keys : |
69+ rewriter-release-
70+
6071 - name : Pack Scramjet
6172 run : pnpm pack
6273
Original file line number Diff line number Diff line change 2121 : " ${FEATURES:= } "
2222fi
2323
24+ # ----------------------------------------------------------------------------------
25+ # Build cache short‑circuit: if sources & build parameters unchanged, skip heavy work
26+ # We rely on CI (and local dev optional) to restore rewriter/wasm/out + dist/ wasm file.
27+ # Hash includes Rust source files, manifest, this script, and release/debug mode.
28+ # ----------------------------------------------------------------------------------
29+ MODE=" release"
30+ if [ " ${RELEASE:- 0} " != " 1" ]; then MODE=" debug" ; fi
31+ HASH_INPUT_FILES=(src/** /* .rs Cargo.toml build.sh)
32+ # shellcheck disable=SC2046
33+ SRC_HASH=$( (echo " MODE=${MODE} " ; sha256sum $( git ls-files -z -- " src" | tr ' \0' ' ' 2> /dev/null || find src -type f -name ' *.rs' ; echo Cargo.toml; echo build.sh) 2> /dev/null | sort -k2 | sha256sum ) | sha256sum | cut -d' ' -f1 ) || SRC_HASH=" unknown"
34+
35+ if [ -f out/.build-hash ] && [ -f ../../dist/scramjet.wasm.wasm ] && [ " $SRC_HASH " != " unknown" ] && grep -q " $SRC_HASH " out/.build-hash; then
36+ echo " Rewriter sources unchanged (hash $SRC_HASH ); skipping rebuild."
37+ exit 0
38+ fi
39+
2440(
2541 export RUSTFLAGS=' -Zlocation-detail=none -Zfmt-debug=none'
2642 if [ " ${OPTIMIZE_FOR_SIZE:- 0} " = " 1" ]; then
112128mkdir -p dist/
113129
114130cp rewriter/wasm/out/optimized.wasm dist/scramjet.wasm.wasm
131+ echo " $SRC_HASH " > rewriter/wasm/out/.build-hash || true
115132echo " Rewriter Build Complete!"
You can’t perform that action at this time.
0 commit comments