Skip to content

Commit 1b75d2f

Browse files
committed
Formatting
1 parent 71d0a9f commit 1b75d2f

File tree

1 file changed

+134
-134
lines changed

1 file changed

+134
-134
lines changed

.github/workflows/tests.yml

Lines changed: 134 additions & 134 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,20 @@ jobs:
1111
strategy:
1212
fail-fast: true
1313
matrix:
14-
php: ["8.2", "8.3", "8.4"]
15-
wordpress: ["6.7", "6.8"]
14+
php: [ "8.2", "8.3", "8.4" ]
15+
wordpress: [ "6.7", "6.8" ]
1616
exclude:
1717
# Exclude older PHP versions with newer WordPress
18-
- php: "7.4"
19-
wordpress: "6.5.3"
18+
- php: "7.4"
19+
wordpress: "6.5.3"
2020

2121
services:
2222
mysql:
2323
image: mysql:8.0
2424
env:
2525
MYSQL_DATABASE: wordpress
2626
MYSQL_ROOT_PASSWORD: root
27-
ports: [3306:3306]
27+
ports: [ 3306:3306 ]
2828
options: >-
2929
--health-cmd="mysqladmin ping -h 127.0.0.1 -uroot -proot"
3030
--health-interval=10s
@@ -40,133 +40,133 @@ jobs:
4040
WP_DB_HOST: 127.0.0.1
4141

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

0 commit comments

Comments
 (0)