Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions .github/workflows/image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
wp_version: ['6.0', '6.1', '6.2', '6.3', '6.4', '6.5', '6.6', '6.7', '6.8']
php_version: ['7.4', '8.0', '8.1', '8.2', '8.3']
wp_version: ['6.0', '6.1', '6.2', '6.3', '6.4', '6.5', '6.6', '6.7', '6.8', '6.9', '7.0']
php_version: ['7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5']
steps:
-
name: Checkout
Expand Down Expand Up @@ -42,5 +42,4 @@ jobs:
tags: |
humanmade/plugin-tester:wp-${{ matrix.wp_version }}-php${{ matrix.php_version }}
${{ matrix.php_version == '7.4' && format('humanmade/plugin-tester:wp-{0}', matrix.wp_version) || '' }}
${{ matrix.php_version == '7.4' && matrix.wp_version == '6.8' && 'humanmade/plugin-tester:latest' || '' }}

${{ matrix.php_version == '7.4' && matrix.wp_version == '7.0' && 'humanmade/plugin-tester:latest' || '' }}
51 changes: 51 additions & 0 deletions Dockerfile.php8.4
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
FROM public.ecr.aws/docker/library/alpine:3.21

ARG WP_VERSION

RUN apk add -u --no-cache \
composer \
curl \
git \
imagemagick \
mysql \
mysql-client \
php84 \
php84-curl \
php84-dom \
php84-exif \
php84-mysqli \
php84-pecl-imagick \
php84-simplexml \
php84-tokenizer \
php84-xml \
php84-xmlwriter

RUN apk add --no-cache php84-pear php84-dev gcc musl-dev make \
&& pecl84 install pcov && echo extension=pcov.so > /etc/php84/conf.d/pcov.ini \
&& apk del php84-pear php84-dev gcc musl-dev make

# Create php symlink to php84
RUN ln -sf /usr/bin/php84 /usr/bin/php

RUN curl -fsSL -o /tmp/wordpress.tar.gz https://wordpress.org/wordpress-${WP_VERSION}.tar.gz \
&& mkdir /wordpress \
&& tar --strip-components=1 -zxmf /tmp/wordpress.tar.gz -C /wordpress \
&& rm /tmp/wordpress.tar.gz

RUN curl -fsSL -o /tmp/wp-phpunit.tar.gz https://github.com/wp-phpunit/wp-phpunit/archive/${WP_VERSION}.0.tar.gz \
&& mkdir /wp-phpunit \
&& tar --strip-components=1 -zxmf /tmp/wp-phpunit.tar.gz -C /wp-phpunit \
&& rm /tmp/wp-phpunit.tar.gz

RUN mysql_install_db --user=mysql --ldata=/var/lib/mysql
RUN sh -c 'mysqld_safe --datadir=/var/lib/mysql &' && sleep 4 && mysql -u root -e "CREATE DATABASE wordpress"

ENV WP_DEVELOP_DIR=/wp-phpunit
ENV WP_PHPUNIT__TESTS_CONFIG=/wp-tests-config.php

VOLUME ["/code"]
WORKDIR /code
COPY ./docker-entrypoint.sh /entrypoint.sh
COPY ./wp-tests-config.php /wp-tests-config.php
RUN chmod 755 /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
51 changes: 51 additions & 0 deletions Dockerfile.php8.5
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
FROM public.ecr.aws/docker/library/alpine:edge

ARG WP_VERSION

RUN apk add -u --no-cache \
composer \
curl \
git \
imagemagick \
mysql \
mysql-client \
php85 \
php85-curl \
php85-dom \
php85-exif \
php85-mysqli \
php85-pecl-imagick \
php85-simplexml \
php85-tokenizer \
php85-xml \
php85-xmlwriter

RUN apk add --no-cache php85-pear php85-dev gcc musl-dev make \
&& pecl85 install pcov && echo extension=pcov.so > /etc/php85/conf.d/pcov.ini \
&& apk del php85-pear php85-dev gcc musl-dev make

# Create php symlink to php85
RUN ln -sf /usr/bin/php85 /usr/bin/php

RUN curl -fsSL -o /tmp/wordpress.tar.gz https://wordpress.org/wordpress-${WP_VERSION}.tar.gz \
&& mkdir /wordpress \
&& tar --strip-components=1 -zxmf /tmp/wordpress.tar.gz -C /wordpress \
&& rm /tmp/wordpress.tar.gz

RUN curl -fsSL -o /tmp/wp-phpunit.tar.gz https://github.com/wp-phpunit/wp-phpunit/archive/${WP_VERSION}.0.tar.gz \
&& mkdir /wp-phpunit \
&& tar --strip-components=1 -zxmf /tmp/wp-phpunit.tar.gz -C /wp-phpunit \
&& rm /tmp/wp-phpunit.tar.gz

RUN mysql_install_db --user=mysql --ldata=/var/lib/mysql
RUN sh -c 'mysqld_safe --datadir=/var/lib/mysql &' && sleep 4 && mysql -u root -e "CREATE DATABASE wordpress"

ENV WP_DEVELOP_DIR=/wp-phpunit
ENV WP_PHPUNIT__TESTS_CONFIG=/wp-tests-config.php

VOLUME ["/code"]
WORKDIR /code
COPY ./docker-entrypoint.sh /entrypoint.sh
COPY ./wp-tests-config.php /wp-tests-config.php
RUN chmod 755 /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

Simple Docker image for running unit tests for WordPress plugins.

**Supports multiple PHP versions:** 7.4, 8.0, 8.1, 8.2, 8.3
**Supports multiple PHP versions:** 7.4, 8.0, 8.1, 8.2, 8.3, 8.4, 8.5

To run the tests for your plugin, run this in your plugin directory:

Expand All @@ -15,19 +15,19 @@ docker run --rm -v "$PWD:/code" humanmade/plugin-tester
You can also specify a specific WordPress and PHP version combination:

```sh
docker run --rm -v "$PWD:/code" humanmade/plugin-tester:wp-6.8-php8.3
docker run --rm -v "$PWD:/code" humanmade/plugin-tester:wp-7.0-php8.5
```

Available tags follow the pattern `wp-{version}-php{version}`, e.g.:
- `humanmade/plugin-tester:wp-6.8-php7.4`
- `humanmade/plugin-tester:wp-6.7-php8.2`
- `humanmade/plugin-tester:wp-6.6-php8.1`
- `humanmade/plugin-tester:wp-7.0-php7.4`
- `humanmade/plugin-tester:wp-6.9-php8.4`
- `humanmade/plugin-tester:wp-6.8-php8.5`
- etc.

WordPress-only tags are also available (defaulting to PHP 7.4):
- `humanmade/plugin-tester:wp-7.0`
- `humanmade/plugin-tester:wp-6.9`
- `humanmade/plugin-tester:wp-6.8`
- `humanmade/plugin-tester:wp-6.7`
- `humanmade/plugin-tester:wp-6.6`
- etc.

The `latest` tag uses the newest WordPress version with PHP 7.4.
Expand Down Expand Up @@ -99,11 +99,11 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
wp_version: ['6.6', '6.7', '6.8']
php_version: ['7.4', '8.1', '8.2', '8.3']
wp_version: ['6.8', '6.9', '7.0']
php_version: ['7.4', '8.3', '8.4', '8.5']
exclude:
# Exclude PHP 7.4 with WordPress 6.8 for example
- wp_version: '6.8'
# Exclude PHP 7.4 with WordPress 7.0 for example
- wp_version: '7.0'
php_version: '7.4'
steps:
- name: Checkout code
Expand Down
Loading