diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index 0a59a38f..4fe2ad45 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -12,19 +12,14 @@ permissions: contents: read jobs: - build: + self-built-v8-cache-warmup: strategy: matrix: - operating-system: + operating-system: # &self-built-v8-operating-systems - ubuntu-latest # - windows-latest -# - macos-latest - php-versions: -# - '8.1' -# - '8.2' - - '8.3' -# - '8.4' - v8-versions: + - macos-latest + v8-versions: # &self-built-v8-v8-versions - 10.9.194 # - 11.9.172 - 12.9.203 @@ -33,14 +28,10 @@ jobs: 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: 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 @@ -60,23 +51,27 @@ jobs: # Store extra tools somewhere undisturbing cd "$(mktemp -d)" - fetch v8 + 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 x64.release -- is_component_build=true use_custom_libcxx=false treat_warnings_as_errors=false + 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/x64.release/ + ninja -C out.gn/${ARCH}.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/ + 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}" @@ -88,6 +83,44 @@ jobs: 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 @@ -99,12 +132,12 @@ jobs: if: failure() uses: actions/upload-artifact@v4 with: - name: phpt-test-results + name: phpt-test-results-on-${{ runner.os }}-${{ matrix.v8-versions }}-${{ matrix.php-versions }} path: | php_test_results*.txt tests/*.out - alpine: + alpine-package-manager-apk: runs-on: ubuntu-latest steps: @@ -132,7 +165,50 @@ jobs: if: failure() uses: actions/upload-artifact@v4 with: - name: phpt-test-results + 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 diff --git a/README.MacOS.md b/README.MacOS.md index 9a11c82a..2ee44059 100644 --- a/README.MacOS.md +++ b/README.MacOS.md @@ -16,7 +16,7 @@ cd /tmp git clone https://github.com/phpv8/v8js.git cd v8js phpize -./configure --with-v8js=/opt/homebrew CPPFLAGS="-DV8_COMPRESS_POINTERS" +./configure --with-v8js=/opt/homebrew CPPFLAGS="-DV8_COMPRESS_POINTERS -DV8_ENABLE_SANDBOX" make -j4 make test make install diff --git a/v8js_object_export.cc b/v8js_object_export.cc index 2792058c..8027d380 100644 --- a/v8js_object_export.cc +++ b/v8js_object_export.cc @@ -675,7 +675,7 @@ v8::Local v8js_named_property_callback(v8::Isolate *isolate, v8::Loca ce = scope = object->ce; /* First, check the (case-insensitive) method table */ - php_strtolower(lower, name_len); + zend_str_tolower(lower, name_len); method_name = zend_string_init(lower, name_len, 0); // toString() -> __tostring()