Skip to content

Commit 2236be3

Browse files
committed
Use Playground compile-extension helper
1 parent a310cbc commit 2236be3

6 files changed

Lines changed: 143 additions & 338 deletions

File tree

.github/workflows/wasm-spike.yml

Lines changed: 24 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ on:
1616
playground-ref:
1717
description: 'wordpress-playground branch/tag/SHA to build against'
1818
required: false
19-
default: 'adamziel/compile-extension-rust-recipe'
19+
default: 'trunk'
2020

2121
jobs:
2222
build-and-load:
@@ -39,8 +39,28 @@ jobs:
3939
uses: actions/checkout@v4
4040
with:
4141
repository: WordPress/wordpress-playground
42-
ref: ${{ github.event.inputs.playground-ref || 'adamziel/compile-extension-rust-recipe' }}
42+
ref: ${{ github.event.inputs.playground-ref || 'trunk' }}
4343
path: wordpress-playground
44+
sparse-checkout-cone-mode: false
45+
sparse-checkout: |
46+
/package.json
47+
/package-lock.json
48+
/nx.json
49+
/tsconfig.base.json
50+
/packages/meta/
51+
/packages/nx-extensions/
52+
/packages/php-wasm/cli-util/
53+
/packages/php-wasm/compile-extension/
54+
/packages/php-wasm/compile/
55+
/packages/php-wasm/fs-journal/
56+
/packages/php-wasm/logger/
57+
/packages/php-wasm/node/
58+
/packages/php-wasm/node-builds/8-4/
59+
/packages/php-wasm/progress/
60+
/packages/php-wasm/scopes/
61+
/packages/php-wasm/stream-compression/
62+
/packages/php-wasm/universal/
63+
/packages/php-wasm/util/
4464
4565
- name: Set up Node
4666
uses: actions/setup-node@v4
@@ -51,25 +71,7 @@ jobs:
5171

5272
- name: Install Playground deps
5373
working-directory: wordpress-playground
54-
run: npm ci
55-
56-
- name: Resolve PHP release for ${{ matrix.php }}
57-
id: php-release
58-
working-directory: wordpress-playground
59-
run: |
60-
# Mirror @php-wasm/compile-extension's resolvePHPRelease() by
61-
# parsing its source map so we tag the image with the exact same
62-
# PHP_VERSION value the CLI would use.
63-
RELEASE=$(node -e "
64-
const fs=require('fs');
65-
const src=fs.readFileSync('./packages/php-wasm/compile-extension/src/compile.ts','utf8');
66-
const map=Object.fromEntries([...src.matchAll(/'(\d+\.\d+)':\s*'(\d+\.\d+\.\d+)'/g)].map(m=>[m[1],m[2]]));
67-
const r=map['${{ matrix.php }}'];
68-
if (!r) { process.exit(1); }
69-
console.log(r);
70-
")
71-
echo "release=$RELEASE" >> "$GITHUB_OUTPUT"
72-
echo "Resolved PHP ${{ matrix.php }} -> $RELEASE"
74+
run: npm ci --ignore-scripts
7375

7476
- name: Configure Docker DNS
7577
run: |
@@ -85,31 +87,12 @@ jobs:
8587
sleep 2
8688
done
8789
88-
- name: Build playground-php-wasm:base image
89-
working-directory: wordpress-playground/packages/php-wasm/compile
90-
run: make base-image
91-
92-
- name: Build per-version compile-extension image
93-
working-directory: wordpress-playground/packages/php-wasm
94-
env:
95-
IMAGE_TAG: playground-php-wasm:compile-extension-php${{ matrix.php == '8.4' && '8-4' || matrix.php == '8.3' && '8-3' || matrix.php == '8.2' && '8-2' || matrix.php == '8.1' && '8-1' || matrix.php == '8.0' && '8-0' || matrix.php == '7.4' && '7-4' || matrix.php == '7.3' && '7-3' || matrix.php == '7.2' && '7-2' || matrix.php }}-${{ matrix.async-mode }}
96-
run: |
97-
JSPI_FLAG=no
98-
if [ "${{ matrix.async-mode }}" = "jspi" ]; then JSPI_FLAG=yes; fi
99-
docker build \
100-
-f compile-extension/docker/Dockerfile.ext \
101-
. \
102-
--tag "$IMAGE_TAG" \
103-
--progress=plain \
104-
--build-arg "PHP_VERSION=${{ steps.php-release.outputs.release }}" \
105-
--build-arg "JSPI=$JSPI_FLAG"
106-
docker images | grep playground-php-wasm
107-
10890
- name: Build wp_mysql_parser side module
10991
working-directory: sqlite-database-integration/packages/php-ext-wp-mysql-parser/wasm-spike
11092
env:
11193
PHP_VERSION: ${{ matrix.php }}
11294
ASYNC_MODE: ${{ matrix.async-mode }}
95+
PLAYGROUND_REPO: ${{ github.workspace }}/wordpress-playground
11396
run: bash build-in-docker-rust.sh
11497

11598
- name: Verify build artifacts exist

0 commit comments

Comments
 (0)