@@ -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
@@ -63,23 +54,35 @@ jobs:
6354 # Store extra tools somewhere undisturbing
6455 cd "$(mktemp -d)"
6556
66- fetch v8
57+ ARCH=$(uname -m)
58+ if [[ "$ARCH" == "x86_64" ]]; then
59+ V8CONFIG="x64.release"
60+ elif [[ "$ARCH" == "arm64" ]]; then
61+ V8CONFIG="arm64.release"
62+ else
63+ echo "Unknown architecture: $ARCH" >&2
64+ exit 1
65+ fi
66+ fetch --nohooks --no-history v8
6767 cd v8
68-
68+ git fetch --tag origin refs/tags/${{ matrix.v8-versions }}
6969 git checkout ${{ matrix.v8-versions }}
7070 gclient sync -D
7171
7272 # Setup GN
7373 # 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
74+ tools/dev/v8gen.py -vv $V8CONFIG -- is_component_build=true use_custom_libcxx=false treat_warnings_as_errors=false
7575
7676 # Build
77- ninja -C out.gn/x64.release /
77+ ninja -C out.gn/$V8CONFIG /
7878
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/
79+ if [[ "${{ runner.os }}" == "macOS" ]]; then
80+ LIB_EXT=dylib
81+ else
82+ LIB_EXT=so
83+ fi
84+ cp out.gn/$V8CONFIG/lib*.${LIB_EXT} out.gn/$V8CONFIG/*_blob.bin out.gn/$V8CONFIG/icudtl.dat /opt/v8/self-built/lib/
85+ cp -R include/* /opt/v8/self-built/include/
8386
8487 # Go back to origin
8588 cd "${GITHUB_WORKSPACE}"
9194 path : /opt/v8/self-built
9295 key : ${{ steps.v8-build-cache.outputs.cache-primary-key }}
9396
97+ self-built-v8 :
98+ needs : self-built-v8-cache-warmup
99+
100+ strategy :
101+ matrix :
102+ operating-system : # *self-built-v8-operating-systems
103+ - ubuntu-latest
104+ # - windows-latest
105+ - macos-latest
106+ v8-versions : # *self-built-v8-v8-versions
107+ - 10.9.194
108+ # - 11.9.172
109+ - 12.9.203
110+ # - 13.1.104
111+ php-versions :
112+ # - '8.1'
113+ - ' 8.2'
114+ - ' 8.3'
115+ - ' 8.4'
116+
117+ runs-on : ${{ matrix.operating-system }}
118+
119+ steps :
120+ - name : Checkout code
121+ uses : actions/checkout@v2
122+
123+ - name : Setup PHP
124+ uses : shivammathur/setup-php@v2
125+ with :
126+ php-version : ${{ matrix.php-versions }}
127+ coverage : none
128+
129+ - name : Download cache v8 ${{ matrix.v8-versions }} build
130+ uses : actions/cache/restore@v4
131+ with :
132+ path : /opt/v8/self-built
133+ key : ${{ runner.os }}-${{ matrix.v8-versions }}-v8-build
134+
94135 - name : Build extension
95136 run : |
96137 phpize
@@ -102,12 +143,12 @@ jobs:
102143 if : failure()
103144 uses : actions/upload-artifact@v4
104145 with :
105- name : phpt-test-results
146+ name : phpt-test-results-on-${{ runner.os }}-${{ matrix.v8-versions }}-${{ matrix.php-versions }}
106147 path : |
107148 php_test_results*.txt
108149 tests/*.out
109150
110- alpine :
151+ alpine-package-manager-apk :
111152 runs-on : ubuntu-latest
112153
113154 steps :
@@ -135,7 +176,50 @@ jobs:
135176 if : failure()
136177 uses : actions/upload-artifact@v4
137178 with :
138- name : phpt-test-results
179+ name : phpt-test-results-on-alpine
180+ path : |
181+ php_test_results*.txt
182+ tests/*.out
183+
184+ macos-package-manager-brew :
185+ strategy :
186+ matrix :
187+ php-versions :
188+ - ' 8.2'
189+ - ' 8.3'
190+ - ' 8.4'
191+
192+ runs-on : macos-latest
193+
194+ steps :
195+ - name : Checkout code
196+ uses : actions/checkout@v2
197+
198+ - name : Setup PHP
199+ uses : shivammathur/setup-php@v2
200+ with :
201+ php-version : ${{ matrix.php-versions }}
202+ coverage : none
203+
204+ - name : Set up Homebrew
205+ uses : Homebrew/actions/setup-homebrew@master
206+
207+ - name : Install dependencies
208+ run : |
209+ brew install v8
210+
211+ - name : Build extension
212+ run : |
213+ phpize
214+ ./configure --with-v8js=/opt/homebrew CPPFLAGS="-DV8_COMPRESS_POINTERS -DV8_ENABLE_SANDBOX"
215+ make
216+ make test
217+
218+ - name : Archive test results
219+ if : failure()
220+ uses : actions/upload-artifact@v4
221+ with :
222+ name : phpt-test-results-on-macos-brew-${{ matrix.php-versions }}
139223 path : |
140224 php_test_results*.txt
141225 tests/*.out
0 commit comments