Skip to content

Split functional & unit tests into reusable workflows#228

Merged
swissspidy merged 8 commits intomainfrom
add/reusable-split
Mar 26, 2026
Merged

Split functional & unit tests into reusable workflows#228
swissspidy merged 8 commits intomainfrom
add/reusable-split

Conversation

@swissspidy
Copy link
Copy Markdown
Member

No description provided.

@swissspidy swissspidy requested a review from a team as a code owner March 26, 2026 08:40
Copilot AI review requested due to automatic review settings March 26, 2026 08:40
@gemini-code-assist

This comment was marked as resolved.

@github-actions

This comment was marked as resolved.

@github-actions github-actions bot added the enhancement New feature or request label Mar 26, 2026

This comment was marked as resolved.

swissspidy and others added 2 commits March 26, 2026 10:45
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 6 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 369 to +379
if: ${{ needs.prepare-unit.outputs.matrix != '' }}
name: Unit test - PHP ${{ matrix.php }}${{ matrix.coverage && ' (with coverage)' || '' }} ${{ startsWith( matrix.os, 'windows' ) && '(Windows)' || '' }} ${{ startsWith( matrix.os, 'macos' ) && '(macOS)' || '' }}
name: Unit
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.prepare-unit.outputs.matrix) }}
runs-on: ${{ matrix.os || 'ubuntu-22.04' }}

continue-on-error: ${{ matrix.php == 'nightly' }}

steps:
- name: Check out source code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6

- name: Set up PHP environment
uses: shivammathur/setup-php@accd6127cb78bee3e8082180cb391013d204ef9f # v2
with:
php-version: '${{ matrix.php }}'
ini-values: zend.assertions=1, error_reporting=-1, display_errors=On
extensions: zip
coverage: ${{ matrix.coverage && 'xdebug' || 'none' }}
tools: composer,cs2pr
env:
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Install Composer dependencies & cache dependencies
uses: "ramsey/composer-install@65e4f84970763564f46a70b8a54b90d033b3bdda" # v3
env:
COMPOSER_ROOT_VERSION: dev-${{ github.event.repository.default_branch }}
with:
# Bust the cache at least once a month - output format: YYYY-MM.
custom-cache-suffix: $(date -u "+%Y-%m")

# PHPUnit 10+ may fail a test run when the "old" configuration format is used.
# Luckily, there is a build-in migration tool since PHPUnit 9.3.
- name: Migrate PHPUnit configuration for PHPUnit 10+
if: ${{ matrix.php >= 8.2 || matrix.php == 'nightly' }}
continue-on-error: true
run: composer phpunit -- --migrate-configuration

- name: Setup problem matcher to provide annotations for PHPUnit
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"

- name: Run PHPUnit with coverage
if: ${{ matrix.coverage }}
run: |
composer phpunit -- --coverage-clover build/logs/unit-coverage.xml

- name: Run PHPUnit
if: ${{ ! matrix.coverage }}
# For example TestBehatTags.php in wp-cli-tests depends on the db type.
env:
WP_CLI_TEST_DBTYPE: 'sqlite'
run: |
composer phpunit

- name: Upload code coverage report
if: ${{ matrix.coverage }}
uses: codecov/codecov-action@1af58845a975a7985b0beb0cbe6fbbb71a41dbad # v5.5.3
with:
directory: build/logs
flags: unit
token: ${{ secrets.CODECOV_TOKEN }}
uses: ./.github/workflows/reusable-unit.yml
secrets: inherit
with:
php: ${{ matrix.php }}
coverage: ${{ matrix.coverage }}
os: ${{ matrix.os }}
Copy link

Copilot AI Mar 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The caller job name was reduced to a constant (Unit). With a matrix strategy, this makes it difficult to identify which PHP/OS combination failed from the job list. Consider including the matrix values in name: here (you can still reference matrix.* even when the job uses a reusable workflow).

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@swissspidy swissspidy merged commit 94f687b into main Mar 26, 2026
13 checks passed
@swissspidy swissspidy deleted the add/reusable-split branch March 26, 2026 19:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request scope:testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants