Skip to content

Commit 01b5948

Browse files
authored
Merge pull request #535 from JoshuaBehrens/feature/ci-tests
Add github workflow to test building and testing the extension
2 parents 4605c5b + fee0f81 commit 01b5948

File tree

2 files changed

+92
-0
lines changed

2 files changed

+92
-0
lines changed

.github/workflows/build-test.yml

+91
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
name: Test building extension
2+
3+
on:
4+
- push
5+
6+
permissions:
7+
contents: read
8+
9+
jobs:
10+
build:
11+
strategy:
12+
matrix:
13+
operating-system:
14+
- ubuntu-latest
15+
# - windows-latest
16+
# - macos-latest
17+
php-versions:
18+
# - '8.1'
19+
# - '8.2'
20+
- '8.3'
21+
# - '8.4'
22+
v8-versions:
23+
- 10.9.194
24+
# - 11.9.172
25+
- 12.9.203
26+
# - 13.1.104
27+
28+
runs-on: ${{ matrix.operating-system }}
29+
30+
steps:
31+
- name: Checkout code
32+
uses: actions/checkout@v2
33+
34+
- name: Setup PHP
35+
uses: shivammathur/setup-php@v2
36+
with:
37+
php-version: ${{ matrix.php-versions }}
38+
coverage: none
39+
40+
- name: Restore cache v8 ${{ matrix.v8-versions }} build
41+
id: v8-build-cache
42+
uses: actions/cache/restore@v4
43+
with:
44+
path: /opt/v8/self-built
45+
key: ${{ runner.os }}-${{ matrix.v8-versions }}-v8-build
46+
47+
- name: Setup Google depot tools
48+
# only needed, when v8 needs to be built
49+
if: steps.v8-build-cache.outputs.cache-hit != 'true'
50+
uses: newkdev/[email protected]
51+
52+
- name: Build v8 ${{ matrix.v8-versions }}
53+
if: steps.v8-build-cache.outputs.cache-hit != 'true'
54+
run: |
55+
# Store extra tools somewhere undisturbing
56+
cd "$(mktemp -d)"
57+
58+
fetch v8
59+
cd v8
60+
61+
git checkout ${{ matrix.v8-versions }}
62+
gclient sync -D
63+
64+
# Setup GN
65+
# Warnings are no errors - @see https://issues.chromium.org/issues/42203398#comment9
66+
tools/dev/v8gen.py -vv x64.release -- is_component_build=true use_custom_libcxx=false treat_warnings_as_errors=false
67+
68+
# Build
69+
ninja -C out.gn/x64.release/
70+
71+
# Install to /opt/v8/self-built
72+
sudo mkdir -p /opt/v8/self-built/{lib,include}
73+
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/
74+
sudo cp -R include/* /opt/v8/self-built/include/
75+
76+
# Go back to origin
77+
cd "${GITHUB_WORKSPACE}"
78+
79+
- name: Save v8 ${{ matrix.v8-versions }} build cache
80+
if: steps.v8-build-cache.outputs.cache-hit != 'true'
81+
uses: actions/cache/save@v4
82+
with:
83+
path: /opt/v8/self-built
84+
key: ${{ steps.v8-build-cache.outputs.cache-primary-key }}
85+
86+
- name: Build extension
87+
run: |
88+
phpize
89+
./configure --with-v8js=/opt/v8/self-built LDFLAGS="-lstdc++" CPPFLAGS="-DV8_COMPRESS_POINTERS -DV8_ENABLE_SANDBOX"
90+
make
91+
make test

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ V8Js
22
====
33

44
[![Build Status](https://travis-ci.org/phpv8/v8js.svg?branch=php7)](https://travis-ci.org/phpv8/v8js)
5+
[![Test building extension](https://github.com/JoshuaBehrens/v8js/actions/workflows/build-test.yml/badge.svg)](https://github.com/JoshuaBehrens/v8js/actions/workflows/build-test.yml)
56
[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/phpv8/v8js/master/LICENSE)
67
[![Join the chat at https://gitter.im/phpv8/v8js](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/phpv8/v8js?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
78

0 commit comments

Comments
 (0)