Skip to content

Establish CI infrastructure and test framework #1

Establish CI infrastructure and test framework

Establish CI infrastructure and test framework #1

Workflow file for this run

name: Run PHPUnit
on:
pull_request:
paths:
- '.github/workflows/integration.yml'
- '**.php'
- 'phpunit.xml.dist'
- 'composer.json'
push:
branches:
- develop
- trunk
paths:
- '.github/workflows/integration.yml'
- '**.php'
- 'phpunit.xml.dist'
- 'composer.json'
workflow_dispatch:
permissions:
contents: read
# Cancels all previous workflow runs for the same branch that have not yet completed.
concurrency:
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:
include:
# Check lowest supported WP version, with the lowest supported PHP.
- wordpress: '6.4'
php: '8.2'
# Check latest WP with the highest supported PHP.
- wordpress: 'latest'
php: 'latest'
fail-fast: false
steps:
- name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
- name: Install wordpress environment
run: npm install -g @wordpress/env
- name: Setup PHP ${{ matrix.php }}
uses: shivammathur/setup-php@9e72090525849c5e82e596468b86eb55e9cc5401 # v2.32.0
with:
php-version: ${{ matrix.php }}
- name: Install Composer dependencies
uses: ramsey/composer-install@a2636af0004bc8c888fa8eb1db5b4e1a4ffc4d4a # v3.1.0
with:
composer-options: --ignore-platform-req=php+
- 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: Setup wp-env
run: wp-env start
env:
WP_ENV_CORE: WordPress/WordPress#${{ matrix.wordpress == 'latest' && 'master' || matrix.wordpress }}
- name: Run integration tests (single site)
run: composer test:integration
- name: Run integration tests (multisite)
run: composer test:integration-ms