From 075a660b2fb4ba7bf3e36ddca5e810214585d545 Mon Sep 17 00:00:00 2001 From: Pierre Tachoire Date: Fri, 10 Apr 2026 09:19:09 +0200 Subject: [PATCH] ci: use cache for snapshots Add a cache for v8 snapshot file. Use a cache key for v8 snapshot with the last hash changing src/browser/js/bridge.zig eg. v8-snapshot-4dcb2c997e01e4367ca6118629fb4ac712f9692c --- .github/workflows/e2e-test.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/.github/workflows/e2e-test.yml b/.github/workflows/e2e-test.yml index f069ebb5..38500e4b 100644 --- a/.github/workflows/e2e-test.yml +++ b/.github/workflows/e2e-test.yml @@ -51,7 +51,24 @@ jobs: - uses: ./.github/actions/install + # Use the commit hash of src/browser/js/bridge.zig as cache key for + # snapshot. + - run: echo "hash=v8-snapshot-$(git log -n 1 --pretty=format:%H -- src/browser/js/bridge.zig)" >> "$GITHUB_OUTPUT" + id: snapshot_cache_key + + # Fetch the cache for snapshot + - name: Cache V8 snapshot + id: cache-v8-snapshot + uses: actions/cache@v5 + env: + cache-name: cache-v8-snapshot + with: + path: src/snapshot.bin + key: ${{ steps.snapshot_cache_key.outputs.hash }} + + # Generate snapshot on cache miss. - name: v8 snapshot + if: ${{ steps.cache-v8-snapshot.outputs.cache-hit != 'true' }} run: zig build -Dprebuilt_v8_path=v8/libc_v8.a -Doptimize=ReleaseFast snapshot_creator -- src/snapshot.bin - name: zig build release