@@ -12,21 +12,21 @@ jobs:
1212 fail-fast : false
1313 matrix :
1414 # php: [ '7.4', '8.0', '8.1', '8.2' ]
15- php : [ ' 8.2', ' 8.3', ' 8.4' ]
15+ php : [" 8.2", " 8.3", " 8.4" ]
1616 # wordpress: [ '5.9', '6.0', '6.3', '6.7', '6.8' ]
17- wordpress : [ ' 6.7', ' 6.8' ]
17+ wordpress : [" 6.7", " 6.8" ]
1818 exclude :
1919 # Exclude older PHP versions with newer WordPress
20- - php : ' 7.4'
21- wordpress : ' 6.5.3'
20+ - php : " 7.4"
21+ wordpress : " 6.5.3"
2222
2323 services :
2424 mysql :
2525 image : mysql:8.0
2626 env :
2727 MYSQL_DATABASE : wordpress
2828 MYSQL_ROOT_PASSWORD : root
29- ports : [ 3306:3306 ]
29+ ports : [3306:3306]
3030 options : >-
3131 --health-cmd="mysqladmin ping -h 127.0.0.1 -uroot -proot"
3232 --health-interval=10s
@@ -42,133 +42,133 @@ jobs:
4242 WP_DB_HOST : 127.0.0.1
4343
4444 steps :
45- - name : Check MySQL tables
46- run : |
47- echo "Listing databases:"
48- mysql -h 127.0.0.1 -uroot -proot -e "SHOW DATABASES;"
49-
50- echo "Checking if 'wordpress' database has any tables:"
51- mysql -h 127.0.0.1 -uroot -proot -D wordpress -e "SHOW TABLES;" || echo "No tables found (yet)."
52-
53- - name : Checkout plugin
54- uses : actions/checkout@v4
55-
56- - name : Set up PHP
57- uses : shivammathur/setup-php@v2
58- with :
59- # Note: Specified version is only for running tests,
60- # as the WordPress PHP version is set inside the FrankenPHP Dockerfile.
61- php-version : 8.4
62- extensions : mysqli, zip, gd
63- coverage : none
64- tools : wp-cli
65-
66- - name : Cache WordPress archive
67- id : cache-wordpress
68- uses : actions/cache@v3
69- with :
70- path : /tmp/wp
71- key : wp-${{ matrix.wordpress }}
72-
73- - name : Download WordPress
74- if : steps.cache-wordpress.outputs.cache-hit != 'true'
75- run : |
76- mkdir -p /tmp/wp
77- curl -O https://wordpress.org/wordpress-${WP_VERSION}.tar.gz
78- tar -xzf wordpress-${WP_VERSION}.tar.gz --strip-components=1 -C /tmp/wp
79- rm wordpress-${WP_VERSION}.tar.gz
80-
81- - name : Set up Docker Buildx
82- uses : docker/setup-buildx-action@v3
83-
84- - name : Build FrankenPHP image (with cache)
85- id : build
86- uses : docker/build-push-action@v6
87- env :
88- DOCKER_BUILD_SUMMARY : false
89- with :
90- context : .
91- file : .github/docker/Dockerfile
92- tags : frankenphp-${{ matrix.php }}
93- load : true
94- build-args : |
95- PHP_VERSION=${{ matrix.php }}
96- cache-from : type=gha
97- cache-to : type=gha,mode=max
98-
99- - name : Start FrankenPHP server
100- run : |
101- docker run -d \
102- --name frankenphp \
103- --network host \
104- -p 8100:8100 \
105- -v /tmp/wp:/var/www/html \
106- -v $GITHUB_WORKSPACE:/var/www/html/wp-content/plugins/simpleanalytics \
107- -v $GITHUB_WORKSPACE/Caddyfile:/etc/frankenphp/Caddyfile \
108- frankenphp-${{ matrix.php }}
109-
110- - name : Install WordPress
111- run : |
112- rm -f /tmp/wp/wp-config.php
113- wp config create \
114- --dbname="$WP_DB_NAME" \
115- --dbuser="$WP_DB_USER" \
116- --dbpass="$WP_DB_PASS" \
117- --dbhost="$WP_DB_HOST" \
118- --path=/tmp/wp \
119- --skip-check
120- wp core install \
121- --url="${WP_SITE_URL}" \
122- --title="Test Site" \
123- --admin_user=admin \
124- --admin_password=admin \
125- 45+ - name : Check MySQL tables
46+ run : |
47+ echo "Listing databases:"
48+ mysql -h 127.0.0.1 -uroot -proot -e "SHOW DATABASES;"
49+
50+ echo "Checking if 'wordpress' database has any tables:"
51+ mysql -h 127.0.0.1 -uroot -proot -D wordpress -e "SHOW TABLES;" || echo "No tables found (yet)."
52+
53+ - name : Checkout plugin
54+ uses : actions/checkout@v4
55+
56+ - name : Set up PHP
57+ uses : shivammathur/setup-php@v2
58+ with :
59+ # Note: Specified version is only for running tests,
60+ # as the WordPress PHP version is set inside the FrankenPHP Dockerfile.
61+ php-version : 8.4
62+ extensions : mysqli, zip, gd
63+ coverage : none
64+ tools : wp-cli
65+
66+ - name : Cache WordPress archive
67+ id : cache-wordpress
68+ uses : actions/cache@v3
69+ with :
70+ path : /tmp/wp
71+ key : wp-${{ matrix.wordpress }}
72+
73+ - name : Download WordPress
74+ if : steps.cache-wordpress.outputs.cache-hit != 'true'
75+ run : |
76+ mkdir -p /tmp/wp
77+ curl -O https://wordpress.org/wordpress-${WP_VERSION}.tar.gz
78+ tar -xzf wordpress-${WP_VERSION}.tar.gz --strip-components=1 -C /tmp/wp
79+ rm wordpress-${WP_VERSION}.tar.gz
80+
81+ - name : Set up Docker Buildx
82+ uses : docker/setup-buildx-action@v3
83+
84+ - name : Build FrankenPHP image (with cache)
85+ id : build
86+ uses : docker/build-push-action@v6
87+ env :
88+ DOCKER_BUILD_SUMMARY : false
89+ with :
90+ context : .
91+ file : .github/docker/Dockerfile
92+ tags : frankenphp-${{ matrix.php }}
93+ load : true
94+ build-args : |
95+ PHP_VERSION=${{ matrix.php }}
96+ cache-from : type=gha
97+ cache-to : type=gha,mode=max
98+
99+ - name : Start FrankenPHP server
100+ run : |
101+ docker run -d \
102+ --name frankenphp \
103+ --network host \
104+ -p 8100:8100 \
105+ -v /tmp/wp:/var/www/html \
106+ -v $GITHUB_WORKSPACE:/var/www/html/wp-content/plugins/simpleanalytics \
107+ -v $GITHUB_WORKSPACE/Caddyfile:/etc/frankenphp/Caddyfile \
108+ frankenphp-${{ matrix.php }}
109+
110+ - name : Install WordPress
111+ run : |
112+ rm -f /tmp/wp/wp-config.php
113+ wp config create \
114+ --dbname="$WP_DB_NAME" \
115+ --dbuser="$WP_DB_USER" \
116+ --dbpass="$WP_DB_PASS" \
117+ --dbhost="$WP_DB_HOST" \
126118 --path=/tmp/wp \
127- --skip-email \
128- --allow-root
129- wp user create author [email protected] --role=author --user_pass=author --path=/tmp/wp 130- wp user create editor [email protected] --role=editor --user_pass=editor --path=/tmp/wp 131- wp user create subscriber [email protected] --role=subscriber --user_pass=subscriber --path=/tmp/wp 132-
133- - name : Show current config values
134- run : wp config list --path=/tmp/wp --allow-root
135-
136- - name : Install pnpm
137- uses : pnpm/action-setup@v4
138- with :
139- version : 10
140-
141- - name : Setup Node
142- uses : actions/setup-node@v4
143- with :
144- node-version : lts/*
145- cache : " pnpm"
146-
147- - name : Install pnpm dependencies
148- run : pnpm install
149-
150- - name : Cache composer dependencies
151- uses : actions/cache@v3
152- with :
153- path : vendor
154- key : composer-${{ hashFiles('composer.lock') }}
155-
156- - name : Run composer install
157- run : composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist
158-
159- - name : Run Pest tests
160- run : ./vendor/bin/phpunit
161-
162- - name : Upload test results
163- if : always()
164- uses : actions/upload-artifact@v4
165- with :
166- name : test-results-php${{ matrix.php }}-wp${{ matrix.wordpress }}
167- path : var/browser
168- retention-days : 30
169-
170- - name : Show FrankenPHP logs
171- if : always()
172- run : |
173- echo "=== FrankenPHP logs ==="
174- docker logs frankenphp || echo "No logs found"
119+ --skip-check
120+ wp core install \
121+ --url="${WP_SITE_URL}" \
122+ --title="Test Site" \
123+ --admin_user=admin \
124+ --admin_password=admin \
125+ 126+ --path=/tmp/wp \
127+ --skip-email \
128+ --allow-root
129+ wp user create author [email protected] --role=author --user_pass=author --path=/tmp/wp 130+ wp user create editor [email protected] --role=editor --user_pass=editor --path=/tmp/wp 131+ wp user create subscriber [email protected] --role=subscriber --user_pass=subscriber --path=/tmp/wp 132+
133+ - name : Show current config values
134+ run : wp config list --path=/tmp/wp --allow-root
135+
136+ - name : Install pnpm
137+ uses : pnpm/action-setup@v4
138+ with :
139+ version : 10
140+
141+ - name : Setup Node
142+ uses : actions/setup-node@v4
143+ with :
144+ node-version : lts/*
145+ cache : " pnpm"
146+
147+ - name : Install pnpm dependencies
148+ run : pnpm install
149+
150+ - name : Cache composer dependencies
151+ uses : actions/cache@v3
152+ with :
153+ path : vendor
154+ key : composer-${{ hashFiles('composer.lock') }}
155+
156+ - name : Run composer install
157+ run : composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist
158+
159+ - name : Run PHPUnit tests
160+ run : ./vendor/bin/phpunit
161+
162+ - name : Upload test results
163+ if : always()
164+ uses : actions/upload-artifact@v4
165+ with :
166+ name : test-results-php${{ matrix.php }}-wp${{ matrix.wordpress }}
167+ path : var/browser
168+ retention-days : 30
169+
170+ - name : Show FrankenPHP logs
171+ if : always()
172+ run : |
173+ echo "=== FrankenPHP logs ==="
174+ docker logs frankenphp || echo "No logs found"
0 commit comments