Skip to content

chore: standardize composer scripts #134

chore: standardize composer scripts

chore: standardize composer scripts #134

Workflow file for this run

name: Unit Tests
on:
push:
paths-ignore:
- '**.md'
- '**.txt'
pull_request:
paths-ignore:
- '**.md'
- '**.txt'
workflow_dispatch:
jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php: ['7.4', '8.1', '8.2', '8.3']
wp: ['latest']
mysql: ['8.0']
include:
- php: '8.3'
wp: '6.6'
mysql: '8.0'
- php: '8.4'
wp: 'latest'
mysql: '8.0'
experimental: true
- php: '8.5'
wp: 'latest'
mysql: '8.0'
experimental: true
name: "PHP ${{ matrix.php }} - WP ${{ matrix.wp }} - MySQL ${{ matrix.mysql }}"
continue-on-error: ${{ matrix.experimental == true }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup MySQL
uses: ankane/setup-mysql@v1
with:
mysql-version: ${{ matrix.mysql }}
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: mysqli
coverage: none
- name: Set PHPUnit version
run: |
if [[ "${{ matrix.php }}" > "8.0" ]]; then
echo "PHPUNIT=9.*" >> $GITHUB_ENV
else
echo "PHPUNIT=5.7.*||6.*||7.5.*||8.5.*" >> $GITHUB_ENV
fi
- name: Set up PHPUnit
run: composer require --no-update phpunit/phpunit:"$PHPUNIT"
- name: Install dependencies for PHP < 8.0
if: ${{ matrix.php < 8.0 }}
uses: ramsey/composer-install@v3
- name: Install dependencies for PHP >= 8.0
if: ${{ matrix.php >= 8.0 }}
uses: ramsey/composer-install@v3
with:
composer-options: --ignore-platform-reqs
- name: Set up WordPress test environment
run: |
sudo apt-get install -y subversion
bash phpunit/install.sh wordpress_test root '' 127.0.0.1:3306 ${{ matrix.wp }}
- name: Run tests (single site)
run: vendor/bin/phpunit
- name: Run tests (multisite)
env:
WP_MULTISITE: 1
run: vendor/bin/phpunit