From d19e62ec3c6d2bfb975e2b8f7505f00d35a8a794 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adri=C3=A0=20Arrufat?= Date: Thu, 9 Apr 2026 21:56:37 +0200 Subject: [PATCH 1/9] http: add default write callback to prevent stdout pollution --- src/network/http.zig | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/network/http.zig b/src/network/http.zig index ef3dfc65..c59a2756 100644 --- a/src/network/http.zig +++ b/src/network/http.zig @@ -421,6 +421,9 @@ pub const Connection = struct { // try libcurl.curl_easy_setopt(easy, .debug_function, debugCallback); } + + // default write callback to prevent libcurl from writing to stdout + try self.setWriteCallback(discardBody); } fn discardBody(_: [*]const u8, count: usize, len: usize, _: ?*anyopaque) usize { From 075a660b2fb4ba7bf3e36ddca5e810214585d545 Mon Sep 17 00:00:00 2001 From: Pierre Tachoire Date: Fri, 10 Apr 2026 09:19:09 +0200 Subject: [PATCH 2/9] 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 From ca78bd7786cb7f777215361c7bf7829a2aed11e9 Mon Sep 17 00:00:00 2001 From: Pierre Tachoire Date: Fri, 10 Apr 2026 09:52:43 +0200 Subject: [PATCH 3/9] ci: invalidate snapshot cache on src/browser/js/Snapshot.zig --- .github/workflows/e2e-test.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/e2e-test.yml b/.github/workflows/e2e-test.yml index 38500e4b..f4d99ba5 100644 --- a/.github/workflows/e2e-test.yml +++ b/.github/workflows/e2e-test.yml @@ -51,9 +51,12 @@ jobs: - uses: ./.github/actions/install - # Use the commit hash of src/browser/js/bridge.zig as cache key for + # Use the commit hash of bridge.zig and Snapshot.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" + - run: echo "hash=v8-snapshot-$(git log -n 1 --pretty=format:%H -- \ + src/browser/js/bridge.zig \ + src/browser/js/Snapshot.zig \ + )" >> "$GITHUB_OUTPUT" id: snapshot_cache_key # Fetch the cache for snapshot From 90069f6ab8b4b18cae1c4744d2d5fd5a6d27ce7b Mon Sep 17 00:00:00 2001 From: Pierre Tachoire Date: Fri, 10 Apr 2026 10:10:21 +0200 Subject: [PATCH 4/9] ci: use a dedicated action for v8 snapshot --- .github/actions/v8-snapshot/action.yml | 32 ++++++++++++++++++++++++++ .github/workflows/e2e-test.yml | 24 +------------------ 2 files changed, 33 insertions(+), 23 deletions(-) create mode 100644 .github/actions/v8-snapshot/action.yml diff --git a/.github/actions/v8-snapshot/action.yml b/.github/actions/v8-snapshot/action.yml new file mode 100644 index 00000000..058c2221 --- /dev/null +++ b/.github/actions/v8-snapshot/action.yml @@ -0,0 +1,32 @@ +name: "V8 snaphsot" +description: "Generate v8 snapshot" + +runs: + using: "composite" + + steps: + # Use the commit hash of bridge.zig and Snapshot.zig as cache key for + # snapshot. + - name: V8 snapshot cache key + id: snapshot_cache_key + run: echo "hash=v8-snapshot-$(git log -n 1 --pretty=format:%H -- + src/browser/js/bridge.zig + src/browser/js/Snapshot.zig + )" >> "$GITHUB_OUTPUT" + shell: bash + + # 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 + shell: bash + if: hashFiles('src/snapshot.bin') == '' + run: zig build -Dprebuilt_v8_path=v8/libc_v8.a -Doptimize=ReleaseFast snapshot_creator -- src/snapshot.bin diff --git a/.github/workflows/e2e-test.yml b/.github/workflows/e2e-test.yml index f4d99ba5..c62f1411 100644 --- a/.github/workflows/e2e-test.yml +++ b/.github/workflows/e2e-test.yml @@ -50,29 +50,7 @@ jobs: fetch-depth: 0 - uses: ./.github/actions/install - - # Use the commit hash of bridge.zig and Snapshot.zig as cache key for - # snapshot. - - run: echo "hash=v8-snapshot-$(git log -n 1 --pretty=format:%H -- \ - src/browser/js/bridge.zig \ - src/browser/js/Snapshot.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 + - uses: ./.github/actions/v8-snapshot - name: zig build release run: zig build -Dsnapshot_path=../../snapshot.bin -Dprebuilt_v8_path=v8/libc_v8.a -Doptimize=ReleaseFast -Dcpu=x86_64 From bd4e88cec8d7119dd9179474a12e38c33bbf2fe9 Mon Sep 17 00:00:00 2001 From: Pierre Tachoire Date: Fri, 10 Apr 2026 10:11:03 +0200 Subject: [PATCH 5/9] ci: typo fix --- .github/actions/install/action.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/actions/install/action.yml b/.github/actions/install/action.yml index f5bb72d3..3e29e96a 100644 --- a/.github/actions/install/action.yml +++ b/.github/actions/install/action.yml @@ -1,5 +1,5 @@ -name: "Browsercore install" -description: "Install deps for the project browsercore" +name: "Deps install" +description: "Install deps for the browser" inputs: arch: From d80e4227b4f6ba35136f70e8cd4f2ed32505971e Mon Sep 17 00:00:00 2001 From: Pierre Tachoire Date: Thu, 9 Apr 2026 15:20:58 +0200 Subject: [PATCH 6/9] force an aggressive GC on v8 after snapshot creation --- src/browser/js/Snapshot.zig | 1 + 1 file changed, 1 insertion(+) diff --git a/src/browser/js/Snapshot.zig b/src/browser/js/Snapshot.zig index 5a04861a..0b6a7fd1 100644 --- a/src/browser/js/Snapshot.zig +++ b/src/browser/js/Snapshot.zig @@ -126,6 +126,7 @@ pub fn create() !Snapshot { var data_start: usize = 0; const isolate = v8.v8__SnapshotCreator__getIsolate(snapshot_creator).?; + defer v8.v8__Isolate__LowMemoryNotification(isolate); { // CreateBlob, which we'll call once everything is setup, MUST NOT From 963682eb0dbefffe523924e1cc5493bf56c03e39 Mon Sep 17 00:00:00 2001 From: Pierre Tachoire Date: Thu, 9 Apr 2026 18:08:44 +0200 Subject: [PATCH 7/9] ci: send wpt completion --- .github/workflows/wpt.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/.github/workflows/wpt.yml b/.github/workflows/wpt.yml index c6cc7350..bfabc59c 100644 --- a/.github/workflows/wpt.yml +++ b/.github/workflows/wpt.yml @@ -170,6 +170,21 @@ jobs: cd ./wptdiff CGO_ENABLED=0 go build + - run: | + ./wptdiff/wptdiff --completion |tee completion.log + + - name: Send completion to slack + uses: slackapi/slack-github-action@v3.0.1 + with: + errors: true + method: files.uploadV2 + token: ${{ secrets.CI_SLACK_BOT_TOKEN }} + payload: | + channel_id: ${{ vars.WPT_SLACK_CHANNEL_ID }} + initial_comment: "Last WPT completion" + file: "./completion.log" + filename: "wpt-completion-${{ github.sha }}.txt" + - run: | ./wptdiff/wptdiff |tee diff.log From 36fcb0fd7f94903d146d75614f9dfac1f360d531 Mon Sep 17 00:00:00 2001 From: Pierre Tachoire Date: Fri, 10 Apr 2026 11:02:04 +0200 Subject: [PATCH 8/9] ci: use a longer timeout for e2e test When we have to generate a snapshot, the build duration is longer. --- .github/workflows/e2e-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/e2e-test.yml b/.github/workflows/e2e-test.yml index c62f1411..50af9e91 100644 --- a/.github/workflows/e2e-test.yml +++ b/.github/workflows/e2e-test.yml @@ -39,7 +39,7 @@ jobs: name: zig build release runs-on: ubuntu-latest - timeout-minutes: 15 + timeout-minutes: 20 # Don't run the CI with draft PR. if: github.event.pull_request.draft == false From e53e4579abd94788b078cdca0213903d7241bf99 Mon Sep 17 00:00:00 2001 From: Pierre Tachoire Date: Fri, 10 Apr 2026 10:34:03 +0200 Subject: [PATCH 9/9] ci: use v8 snapshot cache w/ wpt test --- .github/actions/v8-snapshot/action.yml | 12 +++++++++++- .github/workflows/wpt.yml | 6 ++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/.github/actions/v8-snapshot/action.yml b/.github/actions/v8-snapshot/action.yml index 058c2221..dc73b48a 100644 --- a/.github/actions/v8-snapshot/action.yml +++ b/.github/actions/v8-snapshot/action.yml @@ -1,6 +1,16 @@ name: "V8 snaphsot" description: "Generate v8 snapshot" +inputs: + arch: + description: 'CPU arch used to select the v8 lib' + required: false + default: 'x86_64' + os: + description: 'OS used to select the v8 lib' + required: false + default: 'linux' + runs: using: "composite" @@ -9,7 +19,7 @@ runs: # snapshot. - name: V8 snapshot cache key id: snapshot_cache_key - run: echo "hash=v8-snapshot-$(git log -n 1 --pretty=format:%H -- + run: echo "hash=v8-snapshot-${{ inputs.os }}_${{ inputs.arch }}-$(git log -n 1 --pretty=format:%H -- src/browser/js/bridge.zig src/browser/js/Snapshot.zig )" >> "$GITHUB_OUTPUT" diff --git a/.github/workflows/wpt.yml b/.github/workflows/wpt.yml index bfabc59c..8a3b8516 100644 --- a/.github/workflows/wpt.yml +++ b/.github/workflows/wpt.yml @@ -36,8 +36,10 @@ jobs: os: ${{env.OS}} arch: ${{env.ARCH}} - - name: v8 snapshot - run: zig build -Dprebuilt_v8_path=v8/libc_v8.a -Doptimize=ReleaseFast snapshot_creator -- src/snapshot.bin + - uses: ./.github/actions/v8-snapshot + with: + os: ${{env.OS}} + arch: ${{env.ARCH}} - name: zig build release run: zig build -Dsnapshot_path=../../snapshot.bin -Dprebuilt_v8_path=v8/libc_v8.a -Doptimize=ReleaseFast -Dcpu=generic