Skip to content

Commit 4eec557

Browse files
committed
fix: cache T4/T5 compiled WASM artifacts to avoid 25min componentize
jco componentize compiles SpiderMonkey which takes 25+ minutes on CI. Cache the built handler.wasm keyed on handler source + WIT definitions. Test scripts skip the build step when the cached artifact exists.
1 parent 046e0d0 commit 4eec557

File tree

3 files changed

+32
-2
lines changed

3 files changed

+32
-2
lines changed

.github/workflows/integration-tests.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,17 @@ jobs:
231231
- name: Install T4 dependencies
232232
run: npm ci --prefix test-apps/t4-ts-http-postgres
233233

234+
- name: Cache T4 standalone WASM
235+
id: t4-wasm-cache
236+
uses: actions/cache@v4
237+
with:
238+
path: test-apps/t4-ts-http-postgres/dist/handler.wasm
239+
key: t4-wasm-${{ hashFiles('test-apps/t4-ts-http-postgres/src/handler-standalone.js', 'test-apps/t4-ts-http-postgres/wit-standalone/**') }}
240+
241+
- name: Build T4 standalone WASM
242+
if: steps.t4-wasm-cache.outputs.cache-hit != 'true'
243+
run: test-apps/t4-ts-http-postgres/build.sh --standalone
244+
234245
- name: Build & Test T4
235246
run: test-apps/t4-ts-http-postgres/test.sh
236247

@@ -285,6 +296,17 @@ jobs:
285296
- name: Install T5 dependencies
286297
run: bun install --frozen-lockfile --cwd test-apps/t5-bun-http-postgres
287298

299+
- name: Cache T5 standalone WASM
300+
id: t5-wasm-cache
301+
uses: actions/cache@v4
302+
with:
303+
path: test-apps/t5-bun-http-postgres/dist/handler.wasm
304+
key: t5-wasm-${{ hashFiles('test-apps/t5-bun-http-postgres/src/handler-standalone.js', 'test-apps/t5-bun-http-postgres/wit-standalone/**') }}
305+
306+
- name: Build T5 standalone WASM
307+
if: steps.t5-wasm-cache.outputs.cache-hit != 'true'
308+
run: test-apps/t5-bun-http-postgres/build.sh --standalone
309+
288310
- name: Build & Test T5
289311
run: test-apps/t5-bun-http-postgres/test.sh
290312

test-apps/t4-ts-http-postgres/test.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,11 @@ if [ ! -x "${JCO_BIN}" ]; then
8686
fi
8787

8888
# Build the standalone handler (no warpgrid shim deps)
89-
if "${SCRIPT_DIR}/build.sh" --standalone 2>&1; then
89+
# Skip build if handler.wasm already exists (e.g. from CI cache)
90+
if [ -f "${SCRIPT_DIR}/dist/handler.wasm" ]; then
91+
WASM_SIZE="$(wc -c < "${SCRIPT_DIR}/dist/handler.wasm" | tr -d ' ')"
92+
pass "Standalone handler already built (${WASM_SIZE} bytes, cached)"
93+
elif "${SCRIPT_DIR}/build.sh" --standalone 2>&1; then
9094
if [ -f "${SCRIPT_DIR}/dist/handler.wasm" ]; then
9195
WASM_SIZE="$(wc -c < "${SCRIPT_DIR}/dist/handler.wasm" | tr -d ' ')"
9296
pass "Standalone handler compiled (${WASM_SIZE} bytes)"

test-apps/t5-bun-http-postgres/test.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,11 @@ if [ ! -x "${JCO_BIN}" ]; then
8787
fi
8888

8989
# Build the standalone handler (no warpgrid shim deps)
90-
if "${SCRIPT_DIR}/build.sh" --standalone 2>&1; then
90+
# Skip build if handler.wasm already exists (e.g. from CI cache)
91+
if [ -f "${SCRIPT_DIR}/dist/handler.wasm" ]; then
92+
WASM_SIZE="$(wc -c < "${SCRIPT_DIR}/dist/handler.wasm" | tr -d ' ')"
93+
pass "Standalone handler already built (${WASM_SIZE} bytes, cached)"
94+
elif "${SCRIPT_DIR}/build.sh" --standalone 2>&1; then
9195
if [ -f "${SCRIPT_DIR}/dist/handler.wasm" ]; then
9296
WASM_SIZE="$(wc -c < "${SCRIPT_DIR}/dist/handler.wasm" | tr -d ' ')"
9397
pass "Standalone handler compiled (${WASM_SIZE} bytes)"

0 commit comments

Comments
 (0)