Skip to content

Commit 2f4e920

Browse files
committed
Tests
1 parent 9abc618 commit 2f4e920

File tree

1 file changed

+29
-6
lines changed

1 file changed

+29
-6
lines changed

.github/workflows/tests.yml

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,18 @@ on:
66

77
jobs:
88
e2e:
9+
name: PHP ${{ matrix.php }} - WP ${{ matrix.wordpress }}
910
runs-on: ubuntu-latest
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
php: [ '7.4', '8.0', '8.1', '8.2' ]
15+
wordpress: [ '5.9', '6.0', '6.3', '6.5.3' ]
16+
exclude:
17+
# Exclude older PHP versions with newer WordPress
18+
- php: '7.4'
19+
wordpress: '6.5.3'
20+
1021
services:
1122
mysql:
1223
image: mysql:8.0
@@ -21,7 +32,7 @@ jobs:
2132
--health-retries=5
2233
2334
env:
24-
WP_VERSION: 6.5.3
35+
WP_VERSION: ${{ matrix.wordpress }}
2536
WP_SITE_URL: http://localhost:8888
2637
WP_DB_NAME: wordpress
2738
WP_DB_USER: root
@@ -35,7 +46,10 @@ jobs:
3546
- name: Set up PHP
3647
uses: shivammathur/setup-php@v2
3748
with:
38-
php-version: 8.2
49+
php-version: ${{ matrix.php }}
50+
extensions: mysqli, zip, gd
51+
coverage: none
52+
tools: wp-cli
3953

4054
- name: Install dependencies
4155
run: |
@@ -47,7 +61,7 @@ jobs:
4761
uses: actions/cache@v3
4862
with:
4963
path: wordpress
50-
key: wp-${{ env.WP_VERSION }}
64+
key: wp-${{ matrix.wordpress }}-php-${{ matrix.php }}
5165

5266
- name: Download WordPress
5367
if: steps.cache-wordpress.outputs.cache-hit != 'true'
@@ -63,12 +77,11 @@ jobs:
6377
sed -i "s/username_here/${WP_DB_USER}/" wordpress/wp-config.php
6478
sed -i "s/password_here/${WP_DB_PASS}/" wordpress/wp-config.php
6579
sed -i "s/localhost/${WP_DB_HOST}/" wordpress/wp-config.php
80+
# Add WP_DEBUG settings
81+
sed -i "/define( 'DB_COLLATE', '' );/a define( 'WP_DEBUG', true );\ndefine( 'WP_DEBUG_LOG', true );" wordpress/wp-config.php
6682
6783
- name: Install WordPress
6884
run: |
69-
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
70-
chmod +x wp-cli.phar
71-
sudo mv wp-cli.phar /usr/local/bin/wp
7285
wp core install \
7386
--url="${WP_SITE_URL}" \
7487
--title="Test Site" \
@@ -108,3 +121,13 @@ jobs:
108121
109122
- name: Run Playwright tests
110123
run: npx playwright test
124+
125+
- name: Upload test results
126+
if: always()
127+
uses: actions/upload-artifact@v4
128+
with:
129+
name: test-results-php${{ matrix.php }}-wp${{ matrix.wordpress }}
130+
path: |
131+
playwright-report/
132+
test-results/
133+
retention-days: 30

0 commit comments

Comments
 (0)