Skip to content

Update yoast/phpunit-polyfills requirement from ^1.1 to ^2.0 #187

Update yoast/phpunit-polyfills requirement from ^1.1 to ^2.0

Update yoast/phpunit-polyfills requirement from ^1.1 to ^2.0 #187

Workflow file for this run

name: PHPUnit
on:
push:
branches:
- master
pull_request:
jobs:
phpunit:
name: PHPUnit${{ matrix.coverage && ' with coverage' || '' }} (PHP ${{ matrix.php }}, WordPress ${{ matrix.wordpress }}, GlotPress ${{ matrix.glotpress }})
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.experimental }}
services:
mysql:
image: mysql:5.7
ports:
- 3306/tcp
env:
MYSQL_ROOT_PASSWORD: password
# Set health checks to wait until mysql has started
options: >-
--health-cmd "mysqladmin ping"
--health-interval 10s
--health-timeout 5s
--health-retries 3
strategy:
matrix:
os: [ ubuntu-latest ]
php: [ '8.1' ]
wordpress: [ 'latest' ]
glotpress: [ 'latest' ]
experimental: [ false ]
include:
- os: ubuntu-latest
php: '8.2'
wordpress: 'latest'
glotpress: 'latest'
experimental: false
coverage: true
- os: ubuntu-latest
php: '8.2'
wordpress: 'nightly'
glotpress: 'develop'
experimental: true
- os: ubuntu-latest
php: '8.3'
wordpress: 'nightly'
glotpress: 'develop'
experimental: true
steps:
- name: Check out Git repository
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: ${{ matrix.coverage && 'xdebug' || 'none' }}
tools: composer
- name: Install PHP dependencies
uses: ramsey/composer-install@v3
- name: Make Composer packages available globally
run: |
echo "${PWD}/vendor/bin" >> $GITHUB_PATH
- name: Install WP-CLI
run: |
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
chmod +x wp-cli.phar
mkdir -p bin
mv wp-cli.phar bin/wp
echo "WP_CLI_BIN_DIR=${PWD}/bin" >> $GITHUB_ENV
- name: Install WordPress test setup
env:
WP_VERSION: ${{ matrix.wordpress }}
GP_VERSION: ${{ matrix.glotpress }}
MYSQL_PORT: ${{ job.services.mysql.ports[3306] }}
run: bash bin/install-wp-tests.sh wordpress_test root password "127.0.0.1:$MYSQL_PORT" "$WP_VERSION" "$GP_VERSION"
- name: Setup problem matchers for PHPUnit
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
- name: Run tests
if: ${{ ! matrix.coverage }}
run: composer run-script phpunit
- name: Run tests with code coverage
if: ${{ matrix.coverage }}
run: composer run-script phpunit -- --coverage-clover coverage-clover-${{ github.sha }}.xml
- name: Upload coverage to Codecov
if: ${{ matrix.coverage }}
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: coverage-clover-${{ github.sha }}.xml
flags: php