0
0
mirror of https://github.com/phpv8/v8js.git synced 2024-10-18 13:28:41 +00:00

Merge pull request #535 from JoshuaBehrens/feature/ci-tests

Add github workflow to test building and testing the extension
This commit is contained in:
Stefan Siegl 2024-09-28 21:41:13 +02:00 committed by GitHub
commit 01b5948a94
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 92 additions and 0 deletions

91
.github/workflows/build-test.yml vendored Normal file
View File

@ -0,0 +1,91 @@
name: Test building extension
on:
- push
permissions:
contents: read
jobs:
build:
strategy:
matrix:
operating-system:
- ubuntu-latest
# - windows-latest
# - macos-latest
php-versions:
# - '8.1'
# - '8.2'
- '8.3'
# - '8.4'
v8-versions:
- 10.9.194
# - 11.9.172
- 12.9.203
# - 13.1.104
runs-on: ${{ matrix.operating-system }}
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
coverage: none
- name: Restore cache v8 ${{ matrix.v8-versions }} build
id: v8-build-cache
uses: actions/cache/restore@v4
with:
path: /opt/v8/self-built
key: ${{ runner.os }}-${{ matrix.v8-versions }}-v8-build
- name: Setup Google depot tools
# only needed, when v8 needs to be built
if: steps.v8-build-cache.outputs.cache-hit != 'true'
uses: newkdev/setup-depot-tools@v1.0.1
- name: Build v8 ${{ matrix.v8-versions }}
if: steps.v8-build-cache.outputs.cache-hit != 'true'
run: |
# Store extra tools somewhere undisturbing
cd "$(mktemp -d)"
fetch v8
cd v8
git checkout ${{ matrix.v8-versions }}
gclient sync -D
# Setup GN
# Warnings are no errors - @see https://issues.chromium.org/issues/42203398#comment9
tools/dev/v8gen.py -vv x64.release -- is_component_build=true use_custom_libcxx=false treat_warnings_as_errors=false
# Build
ninja -C out.gn/x64.release/
# Install to /opt/v8/self-built
sudo mkdir -p /opt/v8/self-built/{lib,include}
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/
sudo cp -R include/* /opt/v8/self-built/include/
# Go back to origin
cd "${GITHUB_WORKSPACE}"
- name: Save v8 ${{ matrix.v8-versions }} build cache
if: steps.v8-build-cache.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: /opt/v8/self-built
key: ${{ steps.v8-build-cache.outputs.cache-primary-key }}
- name: Build extension
run: |
phpize
./configure --with-v8js=/opt/v8/self-built LDFLAGS="-lstdc++" CPPFLAGS="-DV8_COMPRESS_POINTERS -DV8_ENABLE_SANDBOX"
make
make test

View File

@ -2,6 +2,7 @@ V8Js
==== ====
[![Build Status](https://travis-ci.org/phpv8/v8js.svg?branch=php7)](https://travis-ci.org/phpv8/v8js) [![Build Status](https://travis-ci.org/phpv8/v8js.svg?branch=php7)](https://travis-ci.org/phpv8/v8js)
[![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)
[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/phpv8/v8js/master/LICENSE) [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/phpv8/v8js/master/LICENSE)
[![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) [![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)