Skip to content

Merge branch 'master' of github.com:kimipooh/wp-add-mime-types #13

Merge branch 'master' of github.com:kimipooh/wp-add-mime-types

Merge branch 'master' of github.com:kimipooh/wp-add-mime-types #13

Workflow file for this run

name: wp-add-mime-types plugin test
on:
push:
branches:
- master
tags:
- '*'
pull_request:
branches:
- master
jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
# Notes regarding supported versions in WP:
# The base matrix only contains the PHP versions which are supported on all supported WP versions.
php: ['7.4', '8.0', '8.1', '8.2']
wp: ['latest']
experimental: [false]
include:
# Complement the builds run via the matrix with high/low WP builds for PHP 7.4 and 8.0.
# PHP 8.1 is sort of supported since WP 5.9.
# PHP 8.0 is sort of supported since WP 5.6.
# PHP 7.4 is supported since WP 5.3.
- php: '8.2'
wp: 'latest'
experimental: false
- php: '8.1'
wp: 'latest'
experimental: false
- php: '8.0'
wp: 'latest'
experimental: false
- php: '7.4'
wp: 'latest'
experimental: false
name: "PHP ${{ matrix.php }} - WP ${{ matrix.wp }}"
continue-on-error: ${{ matrix.experimental }}
services:
mysql:
# WP 5.4 is the first WP version which largely supports MySQL 8.0.
# See: https://core.trac.wordpress.org/ticket/49344
# During the setting up of these tests, it became clear that MySQL 8.0
# in combination with PHP < 7.4 is not properly/sufficiently supported
# within WP Core.
# See: https://core.trac.wordpress.org/ticket/52496
image: mysql:${{ ( matrix.wp == 5.3 && '5.6' ) || ( (matrix.wp < 5.4 || matrix.php < 7.4) && '5.7' ) || '8.0' }}
env:
MYSQL_ALLOW_EMPTY_PASSWORD: false
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=10s --health-retries=10
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: none
# The PHP 5.6 and 7.0 images don't include mysql[i] by default.
extensions: mysqli
- name: Set up WordPress
run: phpunit/install.sh wordpress_test root '' 127.0.0.1:3306 ${{ matrix.wp }}
# Remove the PHPUnit requirement for WP 5.9 and higher in favour of letting the Polyfills manage it.
# The Composer command will exit with error code 2 as the package is not removed, so ignore "failure" of this step.
- name: Conditionally remove PHPUnit requirement
if: ${{ ( matrix.wp == 'trunk' || matrix.wp >= 5.9 ) && matrix.wp != 'latest' }}
continue-on-error: true
run: composer remove --dev phpunit/phpunit --no-update || true
# Install dependencies and handle caching in one go.
# @link https://github.com/marketplace/actions/install-composer-dependencies
- name: Install Composer dependencies for PHP < 8.0
if: ${{ matrix.php < 8.0 || ( ( matrix.wp == 'trunk' || matrix.wp >= 5.9 ) && matrix.wp != 'latest' ) }}
uses: "ramsey/composer-install@v1"
# For PHP 8.0 and above on WP 5.2 - 5.8, we need to install with ignore platform reqs as not all dependencies allow it.
- name: Install Composer dependencies for PHP >= 8.0
if: ${{ matrix.php >= 8.0 && ( matrix.wp == 'latest' || ( matrix.wp != 'trunk' && matrix.wp < 5.9 ) ) }}
uses: "ramsey/composer-install@v1"
with:
composer-options: --ignore-platform-reqs
- name: Run the unit tests - single site
run: vendor/bin/phpunit
- name: Run the unit tests - multisite
run: vendor/bin/phpunit
env:
WP_MULTISITE: 1