Ensure MacOS support by tests #20
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test building extension | |
on: | |
pull_request: | |
branches: | |
- php8 | |
push: | |
branches: | |
- php8 | |
permissions: | |
contents: read | |
jobs: | |
self-built-v8-cache-warmup: | |
strategy: | |
matrix: | |
operating-system: # &self-built-v8-operating-systems | |
- ubuntu-latest | |
# - windows-latest | |
- macos-latest | |
v8-versions: # &self-built-v8-v8-versions | |
- 10.9.194 | |
# - 11.9.172 | |
- 12.9.203 | |
# - 13.1.104 | |
runs-on: ${{ matrix.operating-system }} | |
steps: | |
- name: Prepare cache folder v8 ${{ matrix.v8-versions }} | |
run: | | |
sudo mkdir -p /opt/v8/self-built/{lib,include} | |
sudo chown -R $(id -u):$(id -g) /opt/v8/self-built | |
- 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/[email protected] | |
- name: Build v8 ${{ matrix.v8-versions }} | |
if: steps.v8-build-cache.outputs.cache-hit != 'true' | |
run: | | |
# Store extra tools somewhere undisturbing | |
cd "$(mktemp -d)" | |
ARCH=$(uname -m) | |
fetch --nohooks --no-history v8 | |
cd v8 | |
git fetch --tag origin refs/tags/${{ matrix.v8-versions }} | |
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 ${ARCH}.release -- is_component_build=true use_custom_libcxx=false treat_warnings_as_errors=false | |
# Build | |
ninja -C out.gn/${ARCH}.release/ | |
if [[ "${{ runner.os }}" == "macOS" ]]; then | |
LIB_EXT=dylib | |
else | |
LIB_EXT=so | |
fi | |
cp out.gn/${ARCH}.release/lib*.${LIB_EXT} out.gn/${ARCH}.release/*_blob.bin out.gn/${ARCH}.release/icudtl.dat /opt/v8/self-built/lib/ | |
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 }} | |
self-built-v8: | |
needs: self-built-v8-cache-warmup | |
strategy: | |
matrix: | |
operating-system: # *self-built-v8-operating-systems | |
- ubuntu-latest | |
# - windows-latest | |
- macos-latest | |
v8-versions: # *self-built-v8-v8-versions | |
- 10.9.194 | |
# - 11.9.172 | |
- 12.9.203 | |
# - 13.1.104 | |
php-versions: | |
# - '8.1' | |
- '8.2' | |
- '8.3' | |
- '8.4' | |
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: Download cache v8 ${{ matrix.v8-versions }} build | |
uses: actions/cache/restore@v4 | |
with: | |
path: /opt/v8/self-built | |
key: ${{ runner.os }}-${{ matrix.v8-versions }}-v8-build | |
- name: Build extension | |
run: | | |
phpize | |
./configure --with-v8js=/opt/v8/self-built LDFLAGS="-lstdc++" CPPFLAGS="-DV8_COMPRESS_POINTERS -DV8_ENABLE_SANDBOX" | |
make | |
make test | |
- name: Archive test results | |
if: failure() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: phpt-test-results-on-${{ runner.os }}-${{ matrix.v8-versions }}-${{ matrix.php-versions }} | |
path: | | |
php_test_results*.txt | |
tests/*.out | |
alpine-package-manager-apk: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Setup latest Alpine Linux | |
uses: jirutka/setup-alpine@v1 | |
- name: Install dependencies | |
run: | | |
cat /etc/alpine-release | |
apk add php83-dev nodejs-dev g++ make | |
shell: alpine.sh --root {0} | |
- name: Build extension | |
run: | | |
phpize | |
./configure | |
make | |
make test | |
shell: alpine.sh {0} | |
- name: Archive test results | |
if: failure() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: phpt-test-results-on-alpine | |
path: | | |
php_test_results*.txt | |
tests/*.out | |
macos-package-manager-brew: | |
strategy: | |
matrix: | |
php-versions: | |
- '8.2' | |
- '8.3' | |
- '8.4' | |
runs-on: macos-latest | |
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: Set up Homebrew | |
uses: Homebrew/actions/setup-homebrew@master | |
- name: Install dependencies | |
run: | | |
brew install v8 | |
- name: Build extension | |
run: | | |
phpize | |
./configure --with-v8js=/opt/homebrew CPPFLAGS="-DV8_COMPRESS_POINTERS -DV8_ENABLE_SANDBOX" | |
make | |
make test | |
- name: Archive test results | |
if: failure() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: phpt-test-results-on-macos-brew-${{ matrix.php-versions }} | |
path: | | |
php_test_results*.txt | |
tests/*.out |