Skip to content

Commit d5ddec4

Browse files
committed
Adapt the WordPress environments, plugin build, and CI workflows
The SQLite driver now loads the MySQL parser as a Composer dependency, and the native parser extension bound to the old grammar is gone: - Install the driver Composer dependencies in the WordPress test setup and mount the package vendor directory and the parser package into the WordPress containers. - Bundle the driver's production Composer dependencies into the plugin zip, resolving the path-repository symlink into a real copy of the parser package. - Run the driver test workflow against changes to the parser package and drop the native parser extension jobs and setup scripts. - Install the driver Composer dependencies in the lexer benchmark workflow.
1 parent 62057df commit d5ddec4

8 files changed

Lines changed: 75 additions & 342 deletions

.github/workflows/lexer-benchmark.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,12 @@ jobs:
3838
php-version: '8.4'
3939
coverage: none
4040

41+
- name: Install Composer dependencies (mysql-on-sqlite)
42+
uses: ramsey/composer-install@v3
43+
with:
44+
working-directory: packages/mysql-on-sqlite
45+
composer-options: "--optimize-autoloader"
46+
4147
- name: Benchmark base vs PR
4248
env:
4349
BASE_SHA: ${{ github.event.pull_request.base.sha }}

.github/workflows/mysql-proxy-tests.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,15 @@ jobs:
3535
composer-options: "--optimize-autoloader"
3636
working-directory: packages/mysql-proxy
3737

38+
# The proxy tests run the SQLite driver, which loads its own Composer
39+
# dependencies (wordpress/mysql-parser).
40+
- name: Install Composer dependencies (mysql-on-sqlite)
41+
uses: ramsey/composer-install@v3
42+
with:
43+
ignore-cache: "yes"
44+
composer-options: "--optimize-autoloader"
45+
working-directory: packages/mysql-on-sqlite
46+
3847
- name: Run MySQL Proxy tests
3948
run: composer run test
4049
working-directory: packages/mysql-proxy

.github/workflows/phpunit-tests.yml

Lines changed: 14 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ on:
77
paths:
88
- '.github/workflows/phpunit-tests.yml'
99
- 'packages/mysql-on-sqlite/**'
10-
- 'packages/php-ext-wp-mysql-parser/**'
10+
- 'packages/mysql-parser/**'
1111
- 'composer.json'
1212
- 'composer.lock'
1313
pull_request:
1414
paths:
1515
- '.github/workflows/phpunit-tests.yml'
1616
- 'packages/mysql-on-sqlite/**'
17-
- 'packages/php-ext-wp-mysql-parser/**'
17+
- 'packages/mysql-parser/**'
1818
- 'composer.json'
1919
- 'composer.lock'
2020
workflow_dispatch:
@@ -29,10 +29,7 @@ permissions: {}
2929

3030
jobs:
3131
test:
32-
# The pure-PHP parser is exercised across the full PHP/SQLite range; the
33-
# native Rust parser extension is exercised on PHP 8.0+ (its minimum). Both
34-
# run the same mysql-on-sqlite suite, just with a different parser engine.
35-
name: PHP ${{ matrix.php }}${{ matrix.extension && ' + ext-wp-mysql-parser' || '' }} / SQLite ${{ matrix.sqlite }}
32+
name: PHP ${{ matrix.php }} / SQLite ${{ matrix.sqlite }}
3633
runs-on: ubuntu-latest
3734
timeout-minutes: 30
3835
permissions:
@@ -41,24 +38,17 @@ jobs:
4138
fail-fast: false
4239
matrix:
4340
include:
44-
# Pure-PHP parser, across the supported PHP versions, each pinned to a
45-
# representative SQLite version spanning the supported range.
46-
- { php: '7.2', sqlite: '3.27.0', extension: false } # minimum with WP_SQLITE_UNSAFE_ENABLE_UNSUPPORTED_VERSIONS
47-
- { php: '7.3', sqlite: '3.31.1', extension: false } # Ubuntu 20.04 LTS
48-
- { php: '7.4', sqlite: '3.34.1', extension: false } # Debian 11 (Bullseye)
49-
- { php: '8.0', sqlite: '3.37.0', extension: false } # minimum supported version (STRICT tables)
50-
- { php: '8.1', sqlite: '3.40.1', extension: false } # Debian 12 (Bookworm)
51-
- { php: '8.2', sqlite: '3.45.1', extension: false } # Ubuntu 24.04 LTS
52-
- { php: '8.3', sqlite: '3.46.1', extension: false } # Debian 13 (Trixie)
53-
- { php: '8.4', sqlite: '3.51.2', extension: false } # First 2026 release
54-
- { php: '8.5', sqlite: 'latest', extension: false }
55-
# Native Rust parser extension (requires PHP 8.0+).
56-
- { php: '8.0', sqlite: '3.37.0', extension: true }
57-
- { php: '8.1', sqlite: '3.40.1', extension: true }
58-
- { php: '8.2', sqlite: '3.45.1', extension: true }
59-
- { php: '8.3', sqlite: '3.46.1', extension: true }
60-
- { php: '8.4', sqlite: '3.51.2', extension: true }
61-
- { php: '8.5', sqlite: 'latest', extension: true }
41+
# All supported PHP versions, each pinned to a representative SQLite
42+
# version spanning the supported range.
43+
- { php: '7.2', sqlite: '3.27.0' } # minimum with WP_SQLITE_UNSAFE_ENABLE_UNSUPPORTED_VERSIONS
44+
- { php: '7.3', sqlite: '3.31.1' } # Ubuntu 20.04 LTS
45+
- { php: '7.4', sqlite: '3.34.1' } # Debian 11 (Bullseye)
46+
- { php: '8.0', sqlite: '3.37.0' } # minimum supported version (STRICT tables)
47+
- { php: '8.1', sqlite: '3.40.1' } # Debian 12 (Bookworm)
48+
- { php: '8.2', sqlite: '3.45.1' } # Ubuntu 24.04 LTS
49+
- { php: '8.3', sqlite: '3.46.1' } # Debian 13 (Trixie)
50+
- { php: '8.4', sqlite: '3.51.2' } # First 2026 release
51+
- { php: '8.5', sqlite: 'latest' }
6252

6353
steps:
6454
- name: Checkout repository
@@ -124,29 +114,6 @@ jobs:
124114
exit 1
125115
fi
126116
127-
- name: Set up Rust
128-
if: matrix.extension
129-
uses: dtolnay/rust-toolchain@stable
130-
131-
- name: Cache Rust build
132-
if: matrix.extension
133-
uses: Swatinem/rust-cache@v2
134-
with:
135-
workspaces: packages/php-ext-wp-mysql-parser
136-
# Segregate by PHP version: the extension links against the PHP headers
137-
# of the matrix's php-config, so a build cached for one PHP version is
138-
# ABI-incompatible with another (Zend module API mismatch on load).
139-
key: php-${{ matrix.php }}
140-
141-
- name: Install native build dependencies
142-
if: matrix.extension
143-
run: |
144-
sudo apt-get update
145-
sudo apt-get install -y libclang-dev
146-
echo "PHP_CONFIG=$(command -v php-config)" >> "$GITHUB_ENV"
147-
LIBCLANG_SO="$(find /usr/lib -name 'libclang.so*' | head -n 1)"
148-
echo "LIBCLANG_PATH=$(dirname "$LIBCLANG_SO")" >> "$GITHUB_ENV"
149-
150117
- name: Install Composer dependencies (root)
151118
uses: ramsey/composer-install@v3
152119
with:
@@ -160,29 +127,6 @@ jobs:
160127
ignore-cache: "yes"
161128
composer-options: "--optimize-autoloader"
162129

163-
- name: Check Rust formatting
164-
if: ${{ matrix.extension && matrix.php == '8.2' }}
165-
run: cargo fmt --check
166-
working-directory: packages/php-ext-wp-mysql-parser
167-
168-
- name: Build parser extension
169-
if: matrix.extension
170-
run: cargo build --release
171-
working-directory: packages/php-ext-wp-mysql-parser
172-
173-
- name: Verify native parser extension
174-
if: matrix.extension
175-
run: php -d extension="$GITHUB_WORKSPACE/packages/php-ext-wp-mysql-parser/target/release/libwp_mysql_parser.so" tests/tools/verify-native-parser-extension.php
176-
working-directory: packages/mysql-on-sqlite
177-
178-
- name: Run PHPUnit suite with parser extension
179-
if: matrix.extension
180-
env:
181-
WP_SQLITE_REQUIRE_NATIVE_PARSER_EXTENSION: '1'
182-
run: php -d extension="$GITHUB_WORKSPACE/packages/php-ext-wp-mysql-parser/target/release/libwp_mysql_parser.so" ./vendor/bin/phpunit -c ./phpunit.xml.dist
183-
working-directory: packages/mysql-on-sqlite
184-
185130
- name: Run PHPUnit suite
186-
if: ${{ ! matrix.extension }}
187131
run: php ./vendor/bin/phpunit -c ./phpunit.xml.dist
188132
working-directory: packages/mysql-on-sqlite

.github/workflows/wp-tests-phpunit-native-extension-setup.sh

Lines changed: 0 additions & 211 deletions
This file was deleted.

0 commit comments

Comments
 (0)