Merge pull request #165 from Automattic/refresh #60
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: | |
jobs: | |
test: | |
name: WP ${{ matrix.wordpress }} on PHP ${{ matrix.php }} | |
runs-on: ubuntu-latest | |
env: | |
WP_VERSION: ${{ matrix.wordpress }} | |
strategy: | |
matrix: | |
wordpress: ["5.9", "6.4"] | |
php: ["7.4", "8.3"] | |
include: | |
- php: "8.3" | |
extensions: pcov | |
ini-values: pcov.directory=., "pcov.exclude=\"~(vendor|tests)~\"" | |
coverage: pcov | |
fail-fast: false | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup PHP ${{ matrix.php }} | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
extensions: ${{ matrix.extensions }} | |
ini-values: ${{ matrix.ini-values }} | |
coverage: ${{ matrix.coverage }} | |
- 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@v1 | |
with: | |
composer-options: "${{ matrix.composer-options }}" | |
- name: Start MySQL Service | |
run: sudo systemctl start mysql.service | |
- name: Prepare environment for integration tests | |
run: composer prepare-ci | |
- name: Run integration tests (single site) | |
if: ${{ matrix.php != 8.2 }} | |
run: composer test | |
- name: Run integration tests (single site with code coverage) | |
if: ${{ matrix.php == 8.2 }} | |
run: composer coverage-ci | |
- name: Run integration tests (multisite) | |
run: composer test-ms |