Skip to content

Commit 4da25fa

Browse files
Merge pull request #217 from lightpanda-io/ci-refacto
CI refacto
2 parents 309b637 + d8f21e3 commit 4da25fa

File tree

4 files changed

+75
-69
lines changed

4 files changed

+75
-69
lines changed

.github/actions/install/action.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: "Browsercore install"
2+
description: "Install deps for the project browsercore"
3+
4+
runs:
5+
using: "composite"
6+
7+
steps:
8+
- name: install v8
9+
shell: bash
10+
run: |
11+
mkdir -p vendor/jsruntime-lib/vendor/v8/${{env.ARCH}}/debug
12+
ln -s /usr/local/lib/libc_v8.a vendor/jsruntime-lib/vendor/v8/${{env.ARCH}}/debug/libc_v8.a
13+
14+
mkdir -p vendor/jsruntime-lib/vendor/v8/${{env.ARCH}}/release
15+
ln -s /usr/local/lib/libc_v8.a vendor/jsruntime-lib/vendor/v8/${{env.ARCH}}/release/libc_v8.a
16+
17+
- name: install deps
18+
shell: bash
19+
run: |
20+
ln -s /usr/local/lib/libiconv vendor/libiconv
21+
22+
ln -s /usr/local/lib/netsurf/build vendor/netsurf/build
23+
ln -s /usr/local/lib/netsurf/lib vendor/netsurf/lib
24+
ln -s /usr/local/lib/netsurf/include vendor/netsurf/include
25+
26+
# detect file change
27+
- uses: dorny/paths-filter@v3.0.2
28+
id: changes
29+
with:
30+
filters: |
31+
netsurf:
32+
- 'vendor/netsurf/**'
33+
34+
# if a vendor has changed, install build dependencies.
35+
- name: install build dependencies
36+
if: steps.changes.outputs.netsurf == 'true'
37+
shell: bash
38+
run: |
39+
apt update && \
40+
apt install -y git curl bash xz-utils python3 ca-certificates pkg-config \
41+
libglib2.0-dev gperf libexpat1-dev cmake build-essential
42+
43+
# if netsurf has changed, force a rebuild.
44+
- name: re-build netsurf
45+
if: steps.changes.outputs.netsurf == 'true'
46+
shell: bash
47+
run: |
48+
make clean-netsurf
49+
make install-netsurf

.github/workflows/wpt.yml

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ on:
2727
types: [opened, synchronize, reopened, ready_for_review]
2828

2929
paths:
30+
- ".github/**"
3031
- "build.zig"
3132
- "src/**/*.zig"
3233
- "src/*.zig"
@@ -35,6 +36,11 @@ on:
3536
# Allows you to run this workflow manually from the Actions tab
3637
workflow_dispatch:
3738

39+
permissions:
40+
pull-requests: read # required for dorny/paths-filter
41+
contents: read
42+
packages: read
43+
3844
jobs:
3945
wpt:
4046
name: web platform tests
@@ -50,28 +56,14 @@ jobs:
5056
password: ${{ secrets.GITHUB_TOKEN }}
5157

5258
steps:
53-
- uses: actions/checkout@v3
59+
- uses: actions/checkout@v4
5460
with:
5561
fetch-depth: 0
5662
token: ${{ secrets.GH_CI_PAT }}
5763
# fetch submodules recusively, to get jsruntime-lib submodules also.
5864
submodules: recursive
5965

60-
- name: install v8
61-
run: |
62-
mkdir -p vendor/jsruntime-lib/vendor/v8/${{env.ARCH}}/debug
63-
ln -s /usr/local/lib/libc_v8.a vendor/jsruntime-lib/vendor/v8/${{env.ARCH}}/debug/libc_v8.a
64-
65-
mkdir -p vendor/jsruntime-lib/vendor/v8/${{env.ARCH}}/release
66-
ln -s /usr/local/lib/libc_v8.a vendor/jsruntime-lib/vendor/v8/${{env.ARCH}}/release/libc_v8.a
67-
68-
- name: install deps
69-
run: |
70-
ln -s /usr/local/lib/libiconv vendor/libiconv
71-
72-
ln -s /usr/local/lib/netsurf/build vendor/netsurf/build
73-
ln -s /usr/local/lib/netsurf/lib vendor/netsurf/lib
74-
ln -s /usr/local/lib/netsurf/include vendor/netsurf/include
66+
- uses: ./.github/actions/install
7567

7668
- run: zig build wpt -Dengine=v8 -- --safe --summary
7769

@@ -88,7 +80,7 @@ jobs:
8880
echo "${{github.sha}}" > commit.txt
8981
9082
- name: upload artifact
91-
uses: actions/upload-artifact@v3
83+
uses: actions/upload-artifact@v4
9284
with:
9385
name: wpt-results
9486
path: |
@@ -112,7 +104,7 @@ jobs:
112104

113105
steps:
114106
- name: download artifact
115-
uses: actions/download-artifact@v3
107+
uses: actions/download-artifact@v4
116108
with:
117109
name: wpt-results
118110

.github/workflows/zig-fmt.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ on:
1111
types: [opened, synchronize, reopened, ready_for_review]
1212

1313
paths:
14+
- ".github/**"
1415
- "build.zig"
1516
- "src/**/*.zig"
1617
- "src/*.zig"
@@ -34,7 +35,7 @@ jobs:
3435
zig_fmt_errs: ${{ steps.fmt.outputs.zig_fmt_errs }}
3536

3637
steps:
37-
- uses: actions/checkout@v3
38+
- uses: actions/checkout@v4
3839
with:
3940
fetch-depth: 0
4041

.github/workflows/zig-test.yml

Lines changed: 14 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,19 @@ on:
2626
types: [opened, synchronize, reopened, ready_for_review]
2727

2828
paths:
29+
- ".github/**"
2930
- "build.zig"
3031
- "src/**/*.zig"
3132
- "src/*.zig"
3233
- "vendor/**"
3334
# Allows you to run this workflow manually from the Actions tab
3435
workflow_dispatch:
3536

37+
permissions:
38+
pull-requests: read # required for dorny/paths-filter
39+
contents: read
40+
packages: read
41+
3642
jobs:
3743
zig-build-dev:
3844
name: zig build dev
@@ -48,28 +54,14 @@ jobs:
4854
password: ${{ secrets.GITHUB_TOKEN }}
4955

5056
steps:
51-
- uses: actions/checkout@v3
57+
- uses: actions/checkout@v4
5258
with:
5359
fetch-depth: 0
5460
token: ${{ secrets.GH_CI_PAT }}
5561
# fetch submodules recusively, to get jsruntime-lib submodules also.
5662
submodules: recursive
5763

58-
- name: install v8
59-
run: |
60-
mkdir -p vendor/jsruntime-lib/vendor/v8/${{env.ARCH}}/debug
61-
ln -s /usr/local/lib/libc_v8.a vendor/jsruntime-lib/vendor/v8/${{env.ARCH}}/debug/libc_v8.a
62-
63-
mkdir -p vendor/jsruntime-lib/vendor/v8/${{env.ARCH}}/release
64-
ln -s /usr/local/lib/libc_v8.a vendor/jsruntime-lib/vendor/v8/${{env.ARCH}}/release/libc_v8.a
65-
66-
- name: install deps
67-
run: |
68-
ln -s /usr/local/lib/libiconv vendor/libiconv
69-
70-
ln -s /usr/local/lib/netsurf/build vendor/netsurf/build
71-
ln -s /usr/local/lib/netsurf/lib vendor/netsurf/lib
72-
ln -s /usr/local/lib/netsurf/include vendor/netsurf/include
64+
- uses: ./.github/actions/install
7365

7466
- name: zig build debug
7567
run: zig build -Dengine=v8
@@ -88,28 +80,14 @@ jobs:
8880
password: ${{ secrets.GITHUB_TOKEN }}
8981

9082
steps:
91-
- uses: actions/checkout@v3
83+
- uses: actions/checkout@v4
9284
with:
9385
fetch-depth: 0
9486
token: ${{ secrets.GH_CI_PAT }}
9587
# fetch submodules recusively, to get jsruntime-lib submodules also.
9688
submodules: recursive
9789

98-
- name: install v8
99-
run: |
100-
mkdir -p vendor/jsruntime-lib/vendor/v8/${{env.ARCH}}/debug
101-
ln -s /usr/local/lib/libc_v8.a vendor/jsruntime-lib/vendor/v8/${{env.ARCH}}/debug/libc_v8.a
102-
103-
mkdir -p vendor/jsruntime-lib/vendor/v8/${{env.ARCH}}/release
104-
ln -s /usr/local/lib/libc_v8.a vendor/jsruntime-lib/vendor/v8/${{env.ARCH}}/release/libc_v8.a
105-
106-
- name: install deps
107-
run: |
108-
ln -s /usr/local/lib/libiconv vendor/libiconv
109-
110-
ln -s /usr/local/lib/netsurf/build vendor/netsurf/build
111-
ln -s /usr/local/lib/netsurf/lib vendor/netsurf/lib
112-
ln -s /usr/local/lib/netsurf/include vendor/netsurf/include
90+
- uses: ./.github/actions/install
11391

11492
- name: zig build release
11593
run: zig build -Doptimize=ReleaseSafe -Dengine=v8
@@ -128,28 +106,14 @@ jobs:
128106
password: ${{ secrets.GITHUB_TOKEN }}
129107

130108
steps:
131-
- uses: actions/checkout@v3
109+
- uses: actions/checkout@v4
132110
with:
133111
fetch-depth: 0
134112
token: ${{ secrets.GH_CI_PAT }}
135113
# fetch submodules recusively, to get jsruntime-lib submodules also.
136114
submodules: recursive
137115

138-
- name: install v8
139-
run: |
140-
mkdir -p vendor/jsruntime-lib/vendor/v8/${{env.ARCH}}/debug
141-
ln -s /usr/local/lib/libc_v8.a vendor/jsruntime-lib/vendor/v8/${{env.ARCH}}/debug/libc_v8.a
142-
143-
mkdir -p vendor/jsruntime-lib/vendor/v8/${{env.ARCH}}/release
144-
ln -s /usr/local/lib/libc_v8.a vendor/jsruntime-lib/vendor/v8/${{env.ARCH}}/release/libc_v8.a
145-
146-
- name: install deps
147-
run: |
148-
ln -s /usr/local/lib/libiconv vendor/libiconv
149-
150-
ln -s /usr/local/lib/netsurf/build vendor/netsurf/build
151-
ln -s /usr/local/lib/netsurf/lib vendor/netsurf/lib
152-
ln -s /usr/local/lib/netsurf/include vendor/netsurf/include
116+
- uses: ./.github/actions/install
153117

154118
- name: zig build test
155119
run: zig build test -Dengine=v8 -- --json > bench.json
@@ -159,7 +123,7 @@ jobs:
159123
echo "${{github.sha}}" > commit.txt
160124
161125
- name: upload artifact
162-
uses: actions/upload-artifact@v3
126+
uses: actions/upload-artifact@v4
163127
with:
164128
name: bench-results
165129
path: |
@@ -183,7 +147,7 @@ jobs:
183147

184148
steps:
185149
- name: download artifact
186-
uses: actions/download-artifact@v3
150+
uses: actions/download-artifact@v4
187151
with:
188152
name: bench-results
189153

0 commit comments

Comments
 (0)