From e3f487a7f11945f5bdb119fb07cba072cb244374 Mon Sep 17 00:00:00 2001 From: Pierre Tachoire Date: Tue, 16 Apr 2024 14:53:33 +0200 Subject: [PATCH 1/5] ci: force netsurf rebuild on change --- .github/workflows/zig-test.yml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/.github/workflows/zig-test.yml b/.github/workflows/zig-test.yml index 81474dc83..f765e80f9 100644 --- a/.github/workflows/zig-test.yml +++ b/.github/workflows/zig-test.yml @@ -33,6 +33,11 @@ on: # Allows you to run this workflow manually from the Actions tab workflow_dispatch: +permissions: + pull-requests: read # required for dorny/paths-filter + contents: read + packages: read + jobs: zig-build-dev: name: zig build dev @@ -151,6 +156,29 @@ jobs: ln -s /usr/local/lib/netsurf/lib vendor/netsurf/lib ln -s /usr/local/lib/netsurf/include vendor/netsurf/include + # detect file change + - uses: dorny/paths-filter@v3.0.2 + id: changes + with: + filters: | + netsurf: + - 'vendor/netsurf/**' + + # if a vendor has changed, install build dependencies. + - name: install build dependencies + if: steps.changes.outputs.netsurf == 'true' + run: | + apt update && \ + apt install -y git curl bash xz-utils python3 ca-certificates pkg-config \ + libglib2.0-dev gperf libexpat1-dev cmake build-essential + + # if netsurf has changed, force a rebuild. + - name: build netsurf + if: steps.changes.outputs.netsurf == 'true' + run: | + make clean-netsurf + make install-netsurf + - name: zig build test run: zig build test -Dengine=v8 -- --json > bench.json From ffbcfc18f12b46a27147aa26164f210350dff340 Mon Sep 17 00:00:00 2001 From: Pierre Tachoire Date: Tue, 16 Apr 2024 15:24:16 +0200 Subject: [PATCH 2/5] ci: extract install steps in its own action --- .github/actions/install/action.yml | 49 +++++++++++++++++++++ .github/workflows/wpt.yml | 16 +------ .github/workflows/zig-test.yml | 71 ++---------------------------- 3 files changed, 53 insertions(+), 83 deletions(-) create mode 100644 .github/actions/install/action.yml diff --git a/.github/actions/install/action.yml b/.github/actions/install/action.yml new file mode 100644 index 000000000..be6747f13 --- /dev/null +++ b/.github/actions/install/action.yml @@ -0,0 +1,49 @@ +name: "Browsercore install" +description: "Install deps for the project browsercore" + +runs: + using: "composite" + + steps: + - name: install v8 + shell: bash + run: | + mkdir -p vendor/jsruntime-lib/vendor/v8/${{env.ARCH}}/debug + ln -s /usr/local/lib/libc_v8.a vendor/jsruntime-lib/vendor/v8/${{env.ARCH}}/debug/libc_v8.a + + mkdir -p vendor/jsruntime-lib/vendor/v8/${{env.ARCH}}/release + ln -s /usr/local/lib/libc_v8.a vendor/jsruntime-lib/vendor/v8/${{env.ARCH}}/release/libc_v8.a + + - name: install deps + shell: bash + run: | + ln -s /usr/local/lib/libiconv vendor/libiconv + + ln -s /usr/local/lib/netsurf/build vendor/netsurf/build + ln -s /usr/local/lib/netsurf/lib vendor/netsurf/lib + ln -s /usr/local/lib/netsurf/include vendor/netsurf/include + + # detect file change + - uses: dorny/paths-filter@v3.0.2 + id: changes + with: + filters: | + netsurf: + - 'vendor/netsurf/**' + + # if a vendor has changed, install build dependencies. + - name: install build dependencies + if: steps.changes.outputs.netsurf == 'true' + shell: bash + run: | + apt update && \ + apt install -y git curl bash xz-utils python3 ca-certificates pkg-config \ + libglib2.0-dev gperf libexpat1-dev cmake build-essential + + # if netsurf has changed, force a rebuild. + - name: re-build netsurf + if: steps.changes.outputs.netsurf == 'true' + shell: bash + run: | + make clean-netsurf + make install-netsurf diff --git a/.github/workflows/wpt.yml b/.github/workflows/wpt.yml index 33fb2c9e7..a92fd30f0 100644 --- a/.github/workflows/wpt.yml +++ b/.github/workflows/wpt.yml @@ -57,21 +57,7 @@ jobs: # fetch submodules recusively, to get jsruntime-lib submodules also. submodules: recursive - - name: install v8 - run: | - mkdir -p vendor/jsruntime-lib/vendor/v8/${{env.ARCH}}/debug - ln -s /usr/local/lib/libc_v8.a vendor/jsruntime-lib/vendor/v8/${{env.ARCH}}/debug/libc_v8.a - - mkdir -p vendor/jsruntime-lib/vendor/v8/${{env.ARCH}}/release - ln -s /usr/local/lib/libc_v8.a vendor/jsruntime-lib/vendor/v8/${{env.ARCH}}/release/libc_v8.a - - - name: install deps - run: | - ln -s /usr/local/lib/libiconv vendor/libiconv - - ln -s /usr/local/lib/netsurf/build vendor/netsurf/build - ln -s /usr/local/lib/netsurf/lib vendor/netsurf/lib - ln -s /usr/local/lib/netsurf/include vendor/netsurf/include + - uses: ./.github/actions/install - run: zig build wpt -Dengine=v8 -- --safe --summary diff --git a/.github/workflows/zig-test.yml b/.github/workflows/zig-test.yml index f765e80f9..af38bc69f 100644 --- a/.github/workflows/zig-test.yml +++ b/.github/workflows/zig-test.yml @@ -60,21 +60,7 @@ jobs: # fetch submodules recusively, to get jsruntime-lib submodules also. submodules: recursive - - name: install v8 - run: | - mkdir -p vendor/jsruntime-lib/vendor/v8/${{env.ARCH}}/debug - ln -s /usr/local/lib/libc_v8.a vendor/jsruntime-lib/vendor/v8/${{env.ARCH}}/debug/libc_v8.a - - mkdir -p vendor/jsruntime-lib/vendor/v8/${{env.ARCH}}/release - ln -s /usr/local/lib/libc_v8.a vendor/jsruntime-lib/vendor/v8/${{env.ARCH}}/release/libc_v8.a - - - name: install deps - run: | - ln -s /usr/local/lib/libiconv vendor/libiconv - - ln -s /usr/local/lib/netsurf/build vendor/netsurf/build - ln -s /usr/local/lib/netsurf/lib vendor/netsurf/lib - ln -s /usr/local/lib/netsurf/include vendor/netsurf/include + - uses: ./.github/actions/install - name: zig build debug run: zig build -Dengine=v8 @@ -100,21 +86,7 @@ jobs: # fetch submodules recusively, to get jsruntime-lib submodules also. submodules: recursive - - name: install v8 - run: | - mkdir -p vendor/jsruntime-lib/vendor/v8/${{env.ARCH}}/debug - ln -s /usr/local/lib/libc_v8.a vendor/jsruntime-lib/vendor/v8/${{env.ARCH}}/debug/libc_v8.a - - mkdir -p vendor/jsruntime-lib/vendor/v8/${{env.ARCH}}/release - ln -s /usr/local/lib/libc_v8.a vendor/jsruntime-lib/vendor/v8/${{env.ARCH}}/release/libc_v8.a - - - name: install deps - run: | - ln -s /usr/local/lib/libiconv vendor/libiconv - - ln -s /usr/local/lib/netsurf/build vendor/netsurf/build - ln -s /usr/local/lib/netsurf/lib vendor/netsurf/lib - ln -s /usr/local/lib/netsurf/include vendor/netsurf/include + - uses: ./.github/actions/install - name: zig build release run: zig build -Doptimize=ReleaseSafe -Dengine=v8 @@ -140,44 +112,7 @@ jobs: # fetch submodules recusively, to get jsruntime-lib submodules also. submodules: recursive - - name: install v8 - run: | - mkdir -p vendor/jsruntime-lib/vendor/v8/${{env.ARCH}}/debug - ln -s /usr/local/lib/libc_v8.a vendor/jsruntime-lib/vendor/v8/${{env.ARCH}}/debug/libc_v8.a - - mkdir -p vendor/jsruntime-lib/vendor/v8/${{env.ARCH}}/release - ln -s /usr/local/lib/libc_v8.a vendor/jsruntime-lib/vendor/v8/${{env.ARCH}}/release/libc_v8.a - - - name: install deps - run: | - ln -s /usr/local/lib/libiconv vendor/libiconv - - ln -s /usr/local/lib/netsurf/build vendor/netsurf/build - ln -s /usr/local/lib/netsurf/lib vendor/netsurf/lib - ln -s /usr/local/lib/netsurf/include vendor/netsurf/include - - # detect file change - - uses: dorny/paths-filter@v3.0.2 - id: changes - with: - filters: | - netsurf: - - 'vendor/netsurf/**' - - # if a vendor has changed, install build dependencies. - - name: install build dependencies - if: steps.changes.outputs.netsurf == 'true' - run: | - apt update && \ - apt install -y git curl bash xz-utils python3 ca-certificates pkg-config \ - libglib2.0-dev gperf libexpat1-dev cmake build-essential - - # if netsurf has changed, force a rebuild. - - name: build netsurf - if: steps.changes.outputs.netsurf == 'true' - run: | - make clean-netsurf - make install-netsurf + - uses: ./.github/actions/install - name: zig build test run: zig build test -Dengine=v8 -- --json > bench.json From 8b03c0c651d1c27f629f42e5001bd6a8c4ca2cab Mon Sep 17 00:00:00 2001 From: Pierre Tachoire Date: Tue, 16 Apr 2024 15:41:33 +0200 Subject: [PATCH 3/5] ci: force ci on YAML changes --- .github/workflows/wpt.yml | 1 + .github/workflows/zig-fmt.yml | 1 + .github/workflows/zig-test.yml | 1 + 3 files changed, 3 insertions(+) diff --git a/.github/workflows/wpt.yml b/.github/workflows/wpt.yml index a92fd30f0..0fa9371f9 100644 --- a/.github/workflows/wpt.yml +++ b/.github/workflows/wpt.yml @@ -27,6 +27,7 @@ on: types: [opened, synchronize, reopened, ready_for_review] paths: + - ".github/**" - "build.zig" - "src/**/*.zig" - "src/*.zig" diff --git a/.github/workflows/zig-fmt.yml b/.github/workflows/zig-fmt.yml index c20b35fdf..c224d088a 100644 --- a/.github/workflows/zig-fmt.yml +++ b/.github/workflows/zig-fmt.yml @@ -11,6 +11,7 @@ on: types: [opened, synchronize, reopened, ready_for_review] paths: + - ".github/**" - "build.zig" - "src/**/*.zig" - "src/*.zig" diff --git a/.github/workflows/zig-test.yml b/.github/workflows/zig-test.yml index af38bc69f..54f059d46 100644 --- a/.github/workflows/zig-test.yml +++ b/.github/workflows/zig-test.yml @@ -26,6 +26,7 @@ on: types: [opened, synchronize, reopened, ready_for_review] paths: + - ".github/**" - "build.zig" - "src/**/*.zig" - "src/*.zig" From fe8b6e30604b937cdcf6ce13288b08724caf2b23 Mon Sep 17 00:00:00 2001 From: Pierre Tachoire Date: Tue, 16 Apr 2024 15:45:27 +0200 Subject: [PATCH 4/5] ci: add missing permissions for wpt --- .github/workflows/wpt.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/wpt.yml b/.github/workflows/wpt.yml index 0fa9371f9..d444460dd 100644 --- a/.github/workflows/wpt.yml +++ b/.github/workflows/wpt.yml @@ -36,6 +36,11 @@ on: # Allows you to run this workflow manually from the Actions tab workflow_dispatch: +permissions: + pull-requests: read # required for dorny/paths-filter + contents: read + packages: read + jobs: wpt: name: web platform tests From d8f21e3c6714d61f56c0aef8b210611a894bcc31 Mon Sep 17 00:00:00 2001 From: Pierre Tachoire Date: Tue, 16 Apr 2024 15:52:42 +0200 Subject: [PATCH 5/5] ci: ugrade GH actions versions --- .github/workflows/wpt.yml | 6 +++--- .github/workflows/zig-fmt.yml | 2 +- .github/workflows/zig-test.yml | 10 +++++----- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/wpt.yml b/.github/workflows/wpt.yml index d444460dd..2eb77e66c 100644 --- a/.github/workflows/wpt.yml +++ b/.github/workflows/wpt.yml @@ -56,7 +56,7 @@ jobs: password: ${{ secrets.GITHUB_TOKEN }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 token: ${{ secrets.GH_CI_PAT }} @@ -80,7 +80,7 @@ jobs: echo "${{github.sha}}" > commit.txt - name: upload artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: wpt-results path: | @@ -104,7 +104,7 @@ jobs: steps: - name: download artifact - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: wpt-results diff --git a/.github/workflows/zig-fmt.yml b/.github/workflows/zig-fmt.yml index c224d088a..ab90714d7 100644 --- a/.github/workflows/zig-fmt.yml +++ b/.github/workflows/zig-fmt.yml @@ -35,7 +35,7 @@ jobs: zig_fmt_errs: ${{ steps.fmt.outputs.zig_fmt_errs }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 diff --git a/.github/workflows/zig-test.yml b/.github/workflows/zig-test.yml index 54f059d46..1850339d3 100644 --- a/.github/workflows/zig-test.yml +++ b/.github/workflows/zig-test.yml @@ -54,7 +54,7 @@ jobs: password: ${{ secrets.GITHUB_TOKEN }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 token: ${{ secrets.GH_CI_PAT }} @@ -80,7 +80,7 @@ jobs: password: ${{ secrets.GITHUB_TOKEN }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 token: ${{ secrets.GH_CI_PAT }} @@ -106,7 +106,7 @@ jobs: password: ${{ secrets.GITHUB_TOKEN }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 token: ${{ secrets.GH_CI_PAT }} @@ -123,7 +123,7 @@ jobs: echo "${{github.sha}}" > commit.txt - name: upload artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: bench-results path: | @@ -147,7 +147,7 @@ jobs: steps: - name: download artifact - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: bench-results