@@ -12,22 +12,17 @@ permissions:
1212 contents : read
1313
1414jobs :
15- build :
15+ self-built-v8-cache-warmup :
1616 strategy :
1717 # set in accordance with number of v8-versions, so caching can kick in properly
1818 max-parallel : 2
1919
2020 matrix :
21- operating-system :
21+ operating-system : # &self-built-v8-operating-systems
2222 - ubuntu-latest
2323# - 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
3126 - 10.9.194
3227# - 11.9.172
3328 - 12.9.203
@@ -36,14 +31,10 @@ jobs:
3631 runs-on : ${{ matrix.operating-system }}
3732
3833 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
4738
4839 - name : Restore cache v8 ${{ matrix.v8-versions }} build
4940 id : v8-build-cache
@@ -61,25 +52,45 @@ jobs:
6152 if : steps.v8-build-cache.outputs.cache-hit != 'true'
6253 run : |
6354 # Store extra tools somewhere undisturbing
55+ set -x
6456 cd "$(mktemp -d)"
6557
66- fetch v8
58+ ARCH=$(uname -m)
59+ if [[ "$ARCH" == "x86_64" ]]; then
60+ V8CONFIG="x64.release"
61+ ARCH_SHORT="x64"
62+ elif [[ "$ARCH" == "arm64" ]]; then
63+ V8CONFIG="arm64.release"
64+ ARCH_SHORT="arm64"
65+ else
66+ echo "Unknown architecture: $ARCH" >&2
67+ exit 1
68+ fi
69+ fetch --nohooks --no-history v8
6770 cd v8
68-
69- git checkout ${{ matrix.v8-versions }}
70- gclient sync -D
71+ git fetch --tag origin refs/tags/${{ matrix.v8-versions }} > /dev/null 2>&1
72+ git checkout ${{ matrix.v8-versions }} > /dev/null 2>&1
73+ gclient sync -D > /dev/null 2>&1
7174
7275 # Setup GN
7376 # 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
77+ if [[ "${{ runner.os }}" == "macOS" ]]; then
78+ # Run gn gen with args as v8gen does not override target_cpu properly
79+ gn gen out.gn/$V8CONFIG --args='target_cpu="'$ARCH_SHORT'" v8_target_cpu="'$ARCH_SHORT'" is_component_build=true use_custom_libcxx=true treat_warnings_as_errors=false'
80+ else
81+ tools/dev/v8gen.py -vv $V8CONFIG -- is_component_build=true use_custom_libcxx=true treat_warnings_as_errors=false
82+ fi
7583
7684 # Build
77- ninja -C out.gn/x64.release /
85+ ninja -C out.gn/$V8CONFIG /
7886
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/
87+ if [[ "${{ runner.os }}" == "macOS" ]]; then
88+ LIB_EXT=dylib
89+ else
90+ LIB_EXT=so
91+ fi
92+ cp out.gn/$V8CONFIG/lib*.${LIB_EXT} out.gn/$V8CONFIG/*_blob.bin out.gn/$V8CONFIG/icudtl.dat /opt/v8/self-built/lib/
93+ cp -R include/* /opt/v8/self-built/include/
8394
8495 # Go back to origin
8596 cd "${GITHUB_WORKSPACE}"
@@ -91,6 +102,44 @@ jobs:
91102 path : /opt/v8/self-built
92103 key : ${{ steps.v8-build-cache.outputs.cache-primary-key }}
93104
105+ self-built-v8 :
106+ needs : self-built-v8-cache-warmup
107+
108+ strategy :
109+ matrix :
110+ operating-system : # *self-built-v8-operating-systems
111+ - ubuntu-latest
112+ # - windows-latest
113+ - macos-latest
114+ v8-versions : # *self-built-v8-v8-versions
115+ - 10.9.194
116+ # - 11.9.172
117+ - 12.9.203
118+ # - 13.1.104
119+ php-versions :
120+ # - '8.1'
121+ - ' 8.2'
122+ - ' 8.3'
123+ - ' 8.4'
124+
125+ runs-on : ${{ matrix.operating-system }}
126+
127+ steps :
128+ - name : Checkout code
129+ uses : actions/checkout@v2
130+
131+ - name : Setup PHP
132+ uses : shivammathur/setup-php@v2
133+ with :
134+ php-version : ${{ matrix.php-versions }}
135+ coverage : none
136+
137+ - name : Download cache v8 ${{ matrix.v8-versions }} build
138+ uses : actions/cache/restore@v4
139+ with :
140+ path : /opt/v8/self-built
141+ key : ${{ runner.os }}-${{ matrix.v8-versions }}-v8-build
142+
94143 - name : Build extension
95144 run : |
96145 phpize
@@ -102,12 +151,12 @@ jobs:
102151 if : failure()
103152 uses : actions/upload-artifact@v4
104153 with :
105- name : phpt-test-results
154+ name : phpt-test-results-on-${{ runner.os }}-${{ matrix.v8-versions }}-${{ matrix.php-versions }}
106155 path : |
107156 php_test_results*.txt
108157 tests/*.out
109158
110- alpine :
159+ alpine-package-manager-apk :
111160 runs-on : ubuntu-latest
112161
113162 steps :
@@ -135,7 +184,50 @@ jobs:
135184 if : failure()
136185 uses : actions/upload-artifact@v4
137186 with :
138- name : phpt-test-results
187+ name : phpt-test-results-on-alpine
188+ path : |
189+ php_test_results*.txt
190+ tests/*.out
191+
192+ macos-package-manager-brew :
193+ strategy :
194+ matrix :
195+ php-versions :
196+ - ' 8.2'
197+ - ' 8.3'
198+ - ' 8.4'
199+
200+ runs-on : macos-latest
201+
202+ steps :
203+ - name : Checkout code
204+ uses : actions/checkout@v2
205+
206+ - name : Setup PHP
207+ uses : shivammathur/setup-php@v2
208+ with :
209+ php-version : ${{ matrix.php-versions }}
210+ coverage : none
211+
212+ - name : Set up Homebrew
213+ uses : Homebrew/actions/setup-homebrew@master
214+
215+ - name : Install dependencies
216+ run : |
217+ brew install v8
218+
219+ - name : Build extension
220+ run : |
221+ phpize
222+ ./configure --with-v8js=/opt/homebrew CPPFLAGS="-DV8_COMPRESS_POINTERS -DV8_ENABLE_SANDBOX"
223+ make
224+ make test
225+
226+ - name : Archive test results
227+ if : failure()
228+ uses : actions/upload-artifact@v4
229+ with :
230+ name : phpt-test-results-on-macos-brew-${{ matrix.php-versions }}
139231 path : |
140232 php_test_results*.txt
141233 tests/*.out
0 commit comments