@@ -12,22 +12,17 @@ permissions:
12
12
contents : read
13
13
14
14
jobs :
15
- build :
15
+ self-built-v8-cache-warmup :
16
16
strategy :
17
17
# set in accordance with number of v8-versions, so caching can kick in properly
18
18
max-parallel : 2
19
19
20
20
matrix :
21
- operating-system :
21
+ operating-system : # &self-built-v8-operating-systems
22
22
- ubuntu-latest
23
23
# - windows-latest
24
- # - macos-latest
25
- php-versions :
26
- # - '8.1'
27
- # - '8.2'
28
- - ' 8.3'
29
- - ' 8.4'
30
- v8-versions :
24
+ - macos-latest
25
+ v8-versions : # &self-built-v8-v8-versions
31
26
- 10.9.194
32
27
# - 11.9.172
33
28
- 12.9.203
@@ -36,14 +31,10 @@ jobs:
36
31
runs-on : ${{ matrix.operating-system }}
37
32
38
33
steps :
39
- - name : Checkout code
40
- uses : actions/checkout@v2
41
-
42
- - name : Setup PHP
43
- uses : shivammathur/setup-php@v2
44
- with :
45
- php-version : ${{ matrix.php-versions }}
46
- coverage : none
34
+ - name : Prepare cache folder v8 ${{ matrix.v8-versions }}
35
+ run : |
36
+ sudo mkdir -p /opt/v8/self-built/{lib,include}
37
+ sudo chown -R $(id -u):$(id -g) /opt/v8/self-built
47
38
48
39
- name : Restore cache v8 ${{ matrix.v8-versions }} build
49
40
id : v8-build-cache
@@ -57,29 +48,56 @@ jobs:
57
48
if : steps.v8-build-cache.outputs.cache-hit != 'true'
58
49
uses : newkdev/setup-depot-tools@v1.0.1
59
50
51
+ - name : Set up Clang
52
+ if : ${{ matrix.operating-system == 'ubuntu-latest' }}
53
+ run : |
54
+ sudo apt update
55
+ sudo apt install -y clang-19 lld-19
56
+ sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-19 100
57
+ sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-19 100
58
+
60
59
- name : Build v8 ${{ matrix.v8-versions }}
61
60
if : steps.v8-build-cache.outputs.cache-hit != 'true'
62
61
run : |
63
62
# Store extra tools somewhere undisturbing
63
+ set -x
64
64
cd "$(mktemp -d)"
65
65
66
- fetch v8
66
+ ARCH=$(uname -m)
67
+ if [[ "$ARCH" == "x86_64" ]]; then
68
+ V8CONFIG="x64.release"
69
+ ARCH_SHORT="x64"
70
+ elif [[ "$ARCH" == "arm64" ]]; then
71
+ V8CONFIG="arm64.release"
72
+ ARCH_SHORT="arm64"
73
+ else
74
+ echo "Unknown architecture: $ARCH" >&2
75
+ exit 1
76
+ fi
77
+ fetch --nohooks --no-history v8
67
78
cd v8
68
-
69
- git checkout ${{ matrix.v8-versions }}
70
- gclient sync -D
79
+ git fetch --tag origin refs/tags/${{ matrix.v8-versions }} 1>&2 > /dev/null
80
+ git checkout ${{ matrix.v8-versions }} 1>&2 > /dev/null
81
+ gclient sync -D 1>&2 > /dev/null
71
82
72
83
# Setup GN
73
84
# Warnings are no errors - @see https://issues.chromium.org/issues/42203398#comment9
74
- tools/dev/v8gen.py -vv x64.release -- is_component_build=true use_custom_libcxx=false treat_warnings_as_errors=false
85
+ if [[ "${{ runner.os }}" == "macOS" ]]; then
86
+ tools/dev/v8gen.py -vv $V8CONFIG -- target_cpu=$ARCH_SHORT v8_target_cpu=$ARCH_SHORT is_component_build=true use_custom_libcxx=true treat_warnings_as_errors=false
87
+ else
88
+ tools/dev/v8gen.py -vv $V8CONFIG -- is_component_build=true use_custom_libcxx=true treat_warnings_as_errors=false
89
+ fi
75
90
76
91
# Build
77
- ninja -C out.gn/x64.release /
92
+ ninja -C out.gn/$V8CONFIG /
78
93
79
- # Install to /opt/v8/self-built
80
- sudo mkdir -p /opt/v8/self-built/{lib,include}
81
- sudo cp out.gn/x64.release/lib*.so out.gn/x64.release/*_blob.bin out.gn/x64.release/icudtl.dat /opt/v8/self-built/lib/
82
- sudo cp -R include/* /opt/v8/self-built/include/
94
+ if [[ "${{ runner.os }}" == "macOS" ]]; then
95
+ LIB_EXT=dylib
96
+ else
97
+ LIB_EXT=so
98
+ fi
99
+ cp out.gn/$V8CONFIG/lib*.${LIB_EXT} out.gn/$V8CONFIG/*_blob.bin out.gn/$V8CONFIG/icudtl.dat /opt/v8/self-built/lib/
100
+ cp -R include/* /opt/v8/self-built/include/
83
101
84
102
# Go back to origin
85
103
cd "${GITHUB_WORKSPACE}"
@@ -91,6 +109,52 @@ jobs:
91
109
path : /opt/v8/self-built
92
110
key : ${{ steps.v8-build-cache.outputs.cache-primary-key }}
93
111
112
+ self-built-v8 :
113
+ needs : self-built-v8-cache-warmup
114
+
115
+ strategy :
116
+ matrix :
117
+ operating-system : # *self-built-v8-operating-systems
118
+ - ubuntu-latest
119
+ # - windows-latest
120
+ - macos-latest
121
+ v8-versions : # *self-built-v8-v8-versions
122
+ - 10.9.194
123
+ # - 11.9.172
124
+ - 12.9.203
125
+ # - 13.1.104
126
+ php-versions :
127
+ # - '8.1'
128
+ - ' 8.2'
129
+ - ' 8.3'
130
+ - ' 8.4'
131
+
132
+ runs-on : ${{ matrix.operating-system }}
133
+
134
+ steps :
135
+ - name : Checkout code
136
+ uses : actions/checkout@v2
137
+
138
+ - name : Setup PHP
139
+ uses : shivammathur/setup-php@v2
140
+ with :
141
+ php-version : ${{ matrix.php-versions }}
142
+ coverage : none
143
+
144
+ - name : Set up Clang
145
+ if : ${{ matrix.operating-system == 'ubuntu-latest' }}
146
+ run : |
147
+ sudo apt update
148
+ sudo apt install -y clang-19 lld-19
149
+ sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-19 100
150
+ sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-19 100
151
+
152
+ - name : Download cache v8 ${{ matrix.v8-versions }} build
153
+ uses : actions/cache/restore@v4
154
+ with :
155
+ path : /opt/v8/self-built
156
+ key : ${{ runner.os }}-${{ matrix.v8-versions }}-v8-build
157
+
94
158
- name : Build extension
95
159
run : |
96
160
phpize
@@ -102,12 +166,12 @@ jobs:
102
166
if : failure()
103
167
uses : actions/upload-artifact@v4
104
168
with :
105
- name : phpt-test-results
169
+ name : phpt-test-results-on-${{ runner.os }}-${{ matrix.v8-versions }}-${{ matrix.php-versions }}
106
170
path : |
107
171
php_test_results*.txt
108
172
tests/*.out
109
173
110
- alpine :
174
+ alpine-package-manager-apk :
111
175
runs-on : ubuntu-latest
112
176
113
177
steps :
@@ -135,7 +199,50 @@ jobs:
135
199
if : failure()
136
200
uses : actions/upload-artifact@v4
137
201
with :
138
- name : phpt-test-results
202
+ name : phpt-test-results-on-alpine
203
+ path : |
204
+ php_test_results*.txt
205
+ tests/*.out
206
+
207
+ macos-package-manager-brew :
208
+ strategy :
209
+ matrix :
210
+ php-versions :
211
+ - ' 8.2'
212
+ - ' 8.3'
213
+ - ' 8.4'
214
+
215
+ runs-on : macos-latest
216
+
217
+ steps :
218
+ - name : Checkout code
219
+ uses : actions/checkout@v2
220
+
221
+ - name : Setup PHP
222
+ uses : shivammathur/setup-php@v2
223
+ with :
224
+ php-version : ${{ matrix.php-versions }}
225
+ coverage : none
226
+
227
+ - name : Set up Homebrew
228
+ uses : Homebrew/actions/setup-homebrew@master
229
+
230
+ - name : Install dependencies
231
+ run : |
232
+ brew install v8
233
+
234
+ - name : Build extension
235
+ run : |
236
+ phpize
237
+ ./configure --with-v8js=/opt/homebrew CPPFLAGS="-DV8_COMPRESS_POINTERS -DV8_ENABLE_SANDBOX"
238
+ make
239
+ make test
240
+
241
+ - name : Archive test results
242
+ if : failure()
243
+ uses : actions/upload-artifact@v4
244
+ with :
245
+ name : phpt-test-results-on-macos-brew-${{ matrix.php-versions }}
139
246
path : |
140
247
php_test_results*.txt
141
248
tests/*.out
0 commit comments