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: diff --git a/.github/actions/v8-snapshot/action.yml b/.github/actions/v8-snapshot/action.yml new file mode 100644 index 00000000..dc73b48a --- /dev/null +++ b/.github/actions/v8-snapshot/action.yml @@ -0,0 +1,42 @@ +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" + + 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-${{ inputs.os }}_${{ inputs.arch }}-$(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 f069ebb5..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 @@ -50,9 +50,7 @@ jobs: fetch-depth: 0 - uses: ./.github/actions/install - - - 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 - name: zig build release run: zig build -Dsnapshot_path=../../snapshot.bin -Dprebuilt_v8_path=v8/libc_v8.a -Doptimize=ReleaseFast -Dcpu=x86_64 diff --git a/.github/workflows/wpt.yml b/.github/workflows/wpt.yml index c6cc7350..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 @@ -170,6 +172,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 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 diff --git a/src/network/http.zig b/src/network/http.zig index 7f586b1d..f542be3c 100644 --- a/src/network/http.zig +++ b/src/network/http.zig @@ -458,6 +458,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); + // IP filter: block private/internal network addresses if (ip_filter) |filter| { try libcurl.curl_easy_setopt(self._easy, .opensocket_function, opensocketCallback);