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
6 changes: 3 additions & 3 deletions .github/workflows/image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
strategy:
matrix:
wp_version: ['6.0', '6.1', '6.2', '6.3', '6.4', '6.5', '6.6', '6.7', '6.8']
php_version: ['8.0', '8.1', '8.2', '8.3']
php_version: ['7.4', '8.0', '8.1', '8.2', '8.3']
steps:
-
name: Checkout
Expand Down Expand Up @@ -41,6 +41,6 @@ jobs:
push: ${{ github.ref == 'refs/heads/master' }}
tags: |
humanmade/plugin-tester:wp-${{ matrix.wp_version }}-php${{ matrix.php_version }}
${{ matrix.php_version == '8.0' && format('humanmade/plugin-tester:wp-{0}', matrix.wp_version) || '' }}
${{ matrix.php_version == '8.0' && matrix.wp_version == '6.8' && 'humanmade/plugin-tester:latest' || '' }}
${{ 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' || '' }}

51 changes: 51 additions & 0 deletions Dockerfile.php7.4
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
FROM public.ecr.aws/docker/library/alpine:3.13

ARG WP_VERSION

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

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

# Create php symlink to php7
RUN ln -sf /usr/bin/php7 /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"]
8 changes: 4 additions & 4 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:** 8.0, 8.1, 8.2, 8.3
**Supports multiple PHP versions:** 7.4, 8.0, 8.1, 8.2, 8.3

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

Expand All @@ -19,18 +19,18 @@ docker run --rm -v "$PWD:/code" humanmade/plugin-tester:wp-6.8-php8.3
```

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

WordPress-only tags are also available (defaulting to PHP 8.0):
WordPress-only tags are also available (defaulting to PHP 7.4):
- `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 8.0.
The `latest` tag uses the newest WordPress version with PHP 7.4.

You will need `phpunit/phpunit` specified as a Composer dependency of your plugin. Additional arguments can be passed to PHPUnit on the CLI directly, e.g.:

Expand Down
Loading