Skip to content

How this plugin handles paths #9

How this plugin handles paths

How this plugin handles paths #9

Workflow file for this run

name: PHP unit tests
on:
push:
branches:
- main
paths:
- '**workflows/php-unit-tests.yml'
- '**.php'
- '**composer.json'
- '**phpunit.xml'
pull_request:
branches:
- main
paths:
- '**workflows/php-unit-tests.yml'
- '**.php'
- '**composer.json'
- '**phpunit.xml'
types:
- opened
- synchronize
- ready_for_review
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
php-unit-tests:
runs-on: ubuntu-latest
services:
mysql:
image: mariadb:latest
env:
MYSQL_USER: root
MYSQL_ALLOW_EMPTY_PASSWORD: true
MYSQL_ROOT_PASSWORD: ''
MYSQL_DATABASE: wordpress_test
ports:
- 3306
options: --health-cmd="healthcheck.sh --connect --innodb_initialized" --health-interval=10s --health-timeout=5s --health-retries=3
continue-on-error: ${{ matrix.experimental }}
strategy:
fail-fast: false
matrix:
php: ['8.1', '8.2']
wp: ['latest', '6.2']
multisite: ['0']
dependency-version: ['highest']
webp: [false]
coverage: [false]
experimental: [false]
include:
# PHP 8.2 / experimental
- php: '8.2'
wp: 'trunk'
dependency-version: 'highest'
multisite: '0'
experimental: true
# PHP 8.3 / experimental
- php: '8.3'
wp: 'trunk'
dependency-version: 'highest'
multisite: '0'
experimental: true
name: PHP ${{ matrix.php }} ${{ matrix.coverage && ' (with coverage)' || '' }} | WP ${{ matrix.wp }} | ${{ matrix.dependency-version }}
steps:
- uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: ${{ matrix.coverage && 'pcov' || 'none' }}
tools: composer:v2
extensions: curl, date, dom, iconv, json, libxml, mysql, ${{ matrix.extensions }}
ini-values: pcov.directory=src
- name: Shutdown default MySQL service
run: sudo service mysql stop
- name: Verify MariaDB connection
run: |
while ! mysqladmin ping -h"127.0.0.1" -P"${{ job.services.mysql.ports[3306] }}" --silent; do
sleep 1
done
- name: Setup problem matchers for PHP
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"
- name: Setup problem matchers for PHPUnit
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
- uses: ramsey/composer-install@v3
with:
dependency-versions: ${{ matrix.dependency-version }}
- name: Install tests
run: bash bin/install-wp-tests.sh wordpress_test root '' 127.0.0.1:${{ job.services.mysql.ports['3306'] }} ${{ matrix.wp }} true
- name: Run tests
if: ${{ !matrix.webp }}
run: composer run test
env:
WP_MULTISITE: ${{ matrix.multisite }}