77 branches :
88 - main
99
10+ concurrency :
11+ group : ${{ github.workflow }}-${{ github.ref }}
12+ cancel-in-progress : true
13+
1014jobs :
1115 e2e :
1216 name : PHP ${{ matrix.php }} - WP ${{ matrix.wordpress }}
1317 runs-on : ubuntu-24.04
18+ timeout-minutes : 20
1419 strategy :
1520 fail-fast : false
1621 matrix :
1722 php : ["8.2", "8.3", "8.4"]
1823 wordpress : ["6.7", "6.8"]
19- exclude :
20- # Exclude older PHP versions with newer WordPress
21- - php : " 7.4"
22- wordpress : " 6.5.3"
23-
24- services :
25- mysql :
26- image : mysql:8.0
27- env :
28- MYSQL_DATABASE : wordpress
29- MYSQL_ROOT_PASSWORD : root
30- ports : [3306:3306]
31- options : >-
32- --health-cmd="mysqladmin ping -h 127.0.0.1 -uroot -proot"
33- --health-interval=10s
34- --health-timeout=5s
35- --health-retries=5
36-
37- env :
38- WP_VERSION : ${{ matrix.wordpress }}
39- WP_SITE_URL : http://localhost:8100
40- WP_DB_NAME : wordpress
41- WP_DB_USER : root
42- WP_DB_PASS : root
43- WP_DB_HOST : 127.0.0.1
4424
4525 steps :
46- - name : Check MySQL tables
47- run : |
48- echo "Listing databases:"
49- mysql -h 127.0.0.1 -uroot -proot -e "SHOW DATABASES;"
50-
51- echo "Checking if 'wordpress' database has any tables:"
52- mysql -h 127.0.0.1 -uroot -proot -D wordpress -e "SHOW TABLES;" || echo "No tables found (yet)."
53-
5426 - name : Checkout plugin
5527 uses : actions/checkout@v6
5628 with :
@@ -59,106 +31,10 @@ jobs:
5931 - name : Set up PHP
6032 uses : shivammathur/setup-php@v2
6133 with :
62- # Note: Specified version is only for running tests,
63- # as the WordPress PHP version is set inside the FrankenPHP Dockerfile.
34+ # Host PHP is used only to run Pest; WordPress PHP is set via WP_ENV_PHP_VERSION below.
6435 php-version : 8.4
6536 extensions : mysqli, zip, gd
6637 coverage : none
67- tools : wp-cli
68-
69- - name : Cache WordPress archive
70- id : cache-wordpress
71- uses : actions/cache@v5
72- with :
73- path : /tmp/wp
74- key : wp-${{ matrix.wordpress }}
75-
76- - name : Download WordPress
77- if : steps.cache-wordpress.outputs.cache-hit != 'true'
78- run : |
79- mkdir -p /tmp/wp
80- curl -O https://wordpress.org/wordpress-${WP_VERSION}.tar.gz
81- tar -xzf wordpress-${WP_VERSION}.tar.gz --strip-components=1 -C /tmp/wp
82- rm wordpress-${WP_VERSION}.tar.gz
83-
84- - name : Set up Docker Buildx
85- uses : docker/setup-buildx-action@v4
86-
87- - name : Build FrankenPHP image (with cache)
88- id : build
89- uses : docker/build-push-action@v7
90- env :
91- DOCKER_BUILD_SUMMARY : false
92- with :
93- context : .
94- file : .github/docker/Dockerfile
95- tags : frankenphp-${{ matrix.php }}
96- load : true
97- build-args : |
98- PHP_VERSION=${{ matrix.php }}
99- cache-from : type=gha
100- cache-to : type=gha,mode=max
101-
102- - name : Start FrankenPHP server
103- run : |
104- docker run -d \
105- --name frankenphp \
106- --network host \
107- -p 8100:8100 \
108- -v /tmp/wp:/var/www/html \
109- -v $GITHUB_WORKSPACE:/var/www/html/wp-content/plugins/simpleanalytics \
110- -v $GITHUB_WORKSPACE/Caddyfile:/etc/frankenphp/Caddyfile \
111- frankenphp-${{ matrix.php }}
112-
113- - name : Wait for FrankenPHP to be ready
114- run : |
115- for i in $(seq 1 30); do
116- curl -s -o /dev/null http://localhost:8100 && echo "Server is up" && exit 0
117- echo "Waiting... ($i/30)"
118- sleep 2
119- done
120- echo "Server did not start in time" && exit 1
121-
122- - name : Verify MySQL is accepting connections
123- run : |
124- for i in $(seq 1 10); do
125- mysql -h 127.0.0.1 -uroot -proot -e "SELECT 1" && echo "MySQL ready" && exit 0
126- echo "Waiting for MySQL... ($i/10)"
127- sleep 2
128- done
129- echo "MySQL not ready" && exit 1
130-
131- - name : Install WordPress
132- run : |
133- rm -f /tmp/wp/wp-config.php
134- wp config create \
135- --dbname="$WP_DB_NAME" \
136- --dbuser="$WP_DB_USER" \
137- --dbpass="$WP_DB_PASS" \
138- --dbhost="$WP_DB_HOST" \
139- --path=/tmp/wp \
140- --skip-check
141- wp config set DISABLE_WP_CRON true --raw --path=/tmp/wp
142- wp core install \
143- --url="${WP_SITE_URL}" \
144- --title="Test Site" \
145- --admin_user=admin \
146- --admin_password=admin \
147- --admin_email=test@example.com \
148- --path=/tmp/wp \
149- --skip-email \
150- --allow-root
151- wp user create author author@local.test --role=author --user_pass=author --path=/tmp/wp --allow-root
152- wp user create editor editor@local.test --role=editor --user_pass=editor --path=/tmp/wp --allow-root
153- wp user create subscriber subscriber@local.test --role=subscriber --user_pass=subscriber --path=/tmp/wp --allow-root
154-
155- - name : Show current config values
156- run : wp config list --path=/tmp/wp --allow-root
157-
158- - name : Warm up WordPress
159- run : |
160- curl -s -o /dev/null -w "wp-login.php: HTTP %{http_code} in %{time_total}s\n" http://localhost:8100/wp-login.php
161- curl -s -o /dev/null -w "homepage: HTTP %{http_code} in %{time_total}s\n" http://localhost:8100/
16238
16339 - name : Install pnpm
16440 uses : pnpm/action-setup@v5
@@ -174,8 +50,17 @@ jobs:
17450 - name : Install pnpm dependencies
17551 run : pnpm install
17652
177- - name : Install Playwright Browsers
178- run : npx playwright install --with-deps
53+ - name : Set WordPress version override
54+ run : |
55+ echo '{"core": "https://wordpress.org/wordpress-${{ matrix.wordpress }}.zip"}' > .wp-env.override.json
56+
57+ - name : Start wp-env
58+ run : pnpm exec wp-env start
59+ env :
60+ WP_ENV_PHP_VERSION : ${{ matrix.php }}
61+
62+ - name : Install Playwright browsers
63+ run : pnpm run tests:install
17964
18065 - name : Cache composer dependencies
18166 uses : actions/cache@v5
19681 name : test-results-php${{ matrix.php }}-wp${{ matrix.wordpress }}
19782 path : tests/Browser/Screenshots
19883 retention-days : 30
199-
200- - name : Show FrankenPHP logs
201- if : always()
202- run : |
203- echo "=== FrankenPHP logs ==="
204- docker logs frankenphp || echo "No logs found"
0 commit comments