-
Notifications
You must be signed in to change notification settings - Fork 59
170 lines (152 loc) · 6.28 KB
/
wasm-spike.yml
File metadata and controls
170 lines (152 loc) · 6.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
name: WASM extension build
on:
push:
branches:
- main
paths:
- 'packages/php-ext-wp-mysql-parser/**'
- '.github/workflows/wasm-spike.yml'
pull_request:
paths:
- 'packages/php-ext-wp-mysql-parser/**'
- '.github/workflows/wasm-spike.yml'
workflow_dispatch:
inputs:
playground-ref:
description: 'wordpress-playground branch/tag/SHA to build against'
required: false
default: 'trunk'
jobs:
base-image:
name: Build shared Playground base image
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Check out wordpress-playground
uses: actions/checkout@v4
with:
repository: WordPress/wordpress-playground
ref: ${{ github.event.inputs.playground-ref || 'trunk' }}
path: wordpress-playground
sparse-checkout: |
packages/php-wasm/compile/base-image
- name: Build Playground base image
run: |
docker build \
-f wordpress-playground/packages/php-wasm/compile/base-image/Dockerfile \
--tag playground-php-wasm:base \
wordpress-playground/packages/php-wasm/compile/base-image
- name: Save Playground base image
run: docker save --output "${RUNNER_TEMP}/playground-php-wasm-base.tar" playground-php-wasm:base
- name: Upload Playground base image
uses: actions/upload-artifact@v4
with:
name: playground-php-wasm-base-image
path: ${{ runner.temp }}/playground-php-wasm-base.tar
if-no-files-found: error
retention-days: 1
build-and-load:
name: Build wp_mysql_parser.so and load it in Playground (PHP ${{ matrix.php }})
needs: base-image
runs-on: ubuntu-latest
timeout-minutes: 60
strategy:
fail-fast: false
max-parallel: 6
matrix:
# The Rust WASM path uses ext-php-rs 0.15, which depends on PHP 8
# Zend APIs. PHP 7.4 cannot be added here by extending the matrix.
php: ['8.5', '8.4', '8.3', '8.2', '8.1', '8.0']
async-mode: ['jspi']
steps:
- name: Check out sqlite-database-integration
uses: actions/checkout@v4
with:
path: sqlite-database-integration
- name: Check out wordpress-playground
uses: actions/checkout@v4
with:
repository: WordPress/wordpress-playground
ref: ${{ github.event.inputs.playground-ref || 'trunk' }}
path: wordpress-playground
sparse-checkout-cone-mode: false
sparse-checkout: |
/package.json
/package-lock.json
/nx.json
/tsconfig.base.json
/packages/meta/
/packages/nx-extensions/
/packages/php-wasm/cli-util/
/packages/php-wasm/compile-extension/
/packages/php-wasm/compile/
/packages/php-wasm/fs-journal/
/packages/php-wasm/logger/
/packages/php-wasm/node/
/packages/php-wasm/node-builds/8-0/
/packages/php-wasm/node-builds/8-1/
/packages/php-wasm/node-builds/8-2/
/packages/php-wasm/node-builds/8-3/
/packages/php-wasm/node-builds/8-4/
/packages/php-wasm/node-builds/8-5/
/packages/php-wasm/progress/
/packages/php-wasm/scopes/
/packages/php-wasm/stream-compression/
/packages/php-wasm/universal/
/packages/php-wasm/util/
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: '24'
cache: 'npm'
cache-dependency-path: wordpress-playground/package-lock.json
- name: Download Playground base image
uses: actions/download-artifact@v4
with:
name: playground-php-wasm-base-image
path: ${{ runner.temp }}/playground-base-image
- name: Load Playground base image
run: docker load --input "${RUNNER_TEMP}/playground-base-image/playground-php-wasm-base.tar"
- name: Install Playground deps
working-directory: wordpress-playground
run: npm ci --ignore-scripts
- name: Build wp_mysql_parser side module
working-directory: sqlite-database-integration/packages/php-ext-wp-mysql-parser/wasm-spike
env:
PHP_VERSION: ${{ matrix.php }}
ASYNC_MODE: ${{ matrix.async-mode }}
COMPILE_EXTENSION_PACKAGE: '@php-wasm/compile-extension@3.1.27'
PLAYGROUND_REPO: ${{ github.workspace }}/wordpress-playground
SKIP_BASE_IMAGE_BUILD: '1'
run: bash build-in-docker-rust.sh
- name: Verify build artifacts exist
working-directory: sqlite-database-integration/packages/php-ext-wp-mysql-parser/wasm-spike
run: |
test -f dist/wp_mysql_parser-php${{ matrix.php }}-${{ matrix.async-mode }}.so
test -f dist/manifest.json
test -f dist/libwp_mysql_parser.a
ls -lh dist/
- name: Verify manifest references the built side module
working-directory: sqlite-database-integration/packages/php-ext-wp-mysql-parser/wasm-spike
run: |
SOURCE_PATH=$(node -e "console.log(require('./dist/manifest.json').artifacts[0].sourcePath)")
EXPECTED="wp_mysql_parser-php${{ matrix.php }}-${{ matrix.async-mode }}.so"
echo "manifest sourcePath: $SOURCE_PATH"
echo "expected artifact: $EXPECTED"
test "$SOURCE_PATH" = "$EXPECTED"
test -f "dist/$SOURCE_PATH"
node -e "const artifact = require('./dist/manifest.json').artifacts[0]; if ('file' in artifact || 'sha256' in artifact) { throw new Error('manifest uses retired artifact fields'); }"
- name: Load the extension in Playground and parse a query
working-directory: sqlite-database-integration/packages/php-ext-wp-mysql-parser/wasm-spike
env:
PLAYGROUND_REPO: ${{ github.workspace }}/wordpress-playground
PHP_VERSION: ${{ matrix.php }}
run: node run-spike.mjs
- name: Upload artifacts on success
if: success()
uses: actions/upload-artifact@v4
with:
name: wp_mysql_parser-php${{ matrix.php }}-${{ matrix.async-mode }}
path: sqlite-database-integration/packages/php-ext-wp-mysql-parser/wasm-spike/dist/
if-no-files-found: error
retention-days: 14