Skip to content

Merge pull request #252 from 10up/fix/248-validate-composer-dependencies #664

Merge pull request #252 from 10up/fix/248-validate-composer-dependencies

Merge pull request #252 from 10up/fix/248-validate-composer-dependencies #664

Workflow file for this run

name: PHP Unit Testing
on:
push:
branches:
- trunk
- 'release/**'
# Only run if PHP-related files changed.
paths:
- '.github/workflows/php-test.yml'
- '**.php'
- '.wp-env.json'
- '**/package.json'
- 'package-lock.json'
- 'phpunit.xml.dist'
- 'composer.json'
- 'composer.lock'
pull_request:
branches:
- trunk
- 'release/**'
- 'feature/**'
# Only run if PHP-related files changed.
paths:
- '.github/workflows/php-test.yml'
- '**.php'
- '.wp-env.json'
- '**/package.json'
- 'package-lock.json'
- 'phpunit.xml.dist'
- 'composer.json'
- 'composer.lock'
types:
- opened
- reopened
- synchronize
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
jobs:
php-test:
name: PHP ${{ matrix.php }} - WP ${{ matrix.wordpress }}${{ matrix.experimental && ' (experimental)' || '' }}
runs-on: ubuntu-latest
timeout-minutes: 20
strategy:
fail-fast: true
matrix:
php:
- '7.0'
- '7.1'
- '7.2'
- '7.3'
- '7.4'
- '8.0'
- '8.1'
- '8.2'
wordpress: [ 'latest' ]
include:
- php: '8.0'
wordpress: '6.0'
- php: '8.0'
wordpress: '6.1'
- php: '8.2'
wordpress: 'trunk'
experimental: true
env:
WP_ENV_PHP_VERSION: ${{ matrix.php }}
WP_ENV_CORE: ${{ matrix.wordpress == 'trunk' && 'WordPress/WordPress' || format( 'https://wordpress.org/wordpress-{0}.zip', matrix.wordpress ) }}
steps:
- uses: actions/checkout@v3
- uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
- name: Setup Node.js (.nvmrc)
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: npm
- name: npm install
run: npm ci
- name: Install WordPress
run: npm run wp-env start
- name: Running php unit tests
run: npm run test-php
- name: Running multisite unit tests
run: npm run test-php-multisite