|
| 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 | + |
| 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 |
0 commit comments