Skip to content

Merge pull request #168 from Automattic/release/0.7.0 #147

Merge pull request #168 from Automattic/release/0.7.0

Merge pull request #168 from Automattic/release/0.7.0 #147

Workflow file for this run

name: Run PHPUnit
on:
# Run on all pushes and on all pull requests.
# Prevent the "push" build from running when there are only irrelevant changes.
push:
paths-ignore:
- "**.md"
pull_request:
# Allow manually triggering the workflow.
workflow_dispatch:
# Cancels all previous workflow runs for the same branch that have not yet completed.
concurrency:
# The concurrency group contains the workflow name and the branch name.
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
name: WP ${{ matrix.wordpress }} on PHP ${{ matrix.php }}
runs-on: ubuntu-latest
env:
WP_VERSION: ${{ matrix.wordpress }}
strategy:
matrix:
php: [ '7.4', '8.2' ]
wordpress: [ '5.7', '6.3' ]
allowed_failure: [false]
coverage: [false]
include:
# Check upcoming WP.
- php: '8.2'
wordpress: 'trunk'
allowed_failure: true
coverage: false
# Check upcoming PHP.
- php: '8.3'
wordpress: 'latest'
allowed_failure: true
coverage: false
# Code coverage on latest PHP and WP.
- php: '8.2'
wordpress: 'latest'
allowed_failure: false
coverage: true
exclude:
# WordPress 5.7 doesn't support PHP 8.2.
- php: '8.2'
wordpress: '5.7'
fail-fast: false
continue-on-error: ${{ matrix.allowed_failure }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup PHP ${{ matrix.php }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: ${{ matrix.coverage && 'xdebug' || 'none' }}
- 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"
- name: Install Composer dependencies
uses: ramsey/composer-install@v2
- name: Start MySQL Service
run: sudo systemctl start mysql.service
- name: Setting mysql_native_password for PHP <= 7.3
if: ${{ matrix.php <= 7.3 }}
run: mysql -u root -proot -e "ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root';"
- name: Prepare environment for integration tests
run: composer prepare-ci --no-interaction
- name: Run integration tests
if: ${{ matrix.coverage == false }}
run: composer test --no-interaction
- name: Run integration tests with code coverage
if: ${{ matrix.coverage == true }}
run: composer coverage-ci --no-interaction
- name: Send coverage report to Codecov
if: ${{ success() && matrix.coverage == true }}
uses: codecov/codecov-action@v3
with:
files: ./clover.xml
fail_ci_if_error: true
verbose: true