PHP Test Workflow v3 Upgrade Guide
Overview
The PHP test workflow has been significantly simplified in v3, removing several configuration options and consolidating the testing approach.
Breaking Changes
Removed Input Parameters
The following input parameters have been removed in v3:
enforceCoverage- Coverage enforcement is no longer configurableminCodeCoverage- Minimum coverage percentage is no longer configurablerunParallel- Parallel execution is no longer configurable
Changed Input Parameters
phpVersion: Default changed from'8.2'to'8.3'
Removed Job
The separate TestWithCodeCov job has been removed. CodeCov functionality is now integrated into the main Test job.
Migration Steps
1. Update Workflow Calls
Before (v2):
uses: ./.github/workflows/php_test.yml
with:
enforceCoverage: true
minCodeCoverage: 85
runParallel: true
phpVersion: '8.2'
After (v3):
uses: ./.github/workflows/php_test.yml
with:
phpVersion: '8.3' # Optional, defaults to 8.3
2. Update Test Command
The workflow now uses composer run test instead of directly calling Pest with various flags. Ensure your composer.json has a test script defined:
{
"scripts": {
"test": "pest --parallel --coverage-clover coverage.xml --log-junit junit.xml"
}
}
3. CodeCov Integration
CodeCov uploads are now conditional based on the useCodeCov input parameter:
- Coverage upload only happens when
useCodeCov: true - Test results upload only happens when
useCodeCov: true
Key Improvements
- Simplified Configuration: Fewer input parameters to manage
- Consolidated Testing: Single job handles both regular testing and CodeCov
- Composer-based Testing: Uses
composer run testfor better project-specific configuration - Updated PHP Default: Uses PHP 8.3 by default
- Conditional CodeCov: CodeCov uploads only occur when explicitly enabled
Migration Checklist
- [ ] Remove
enforceCoverage,minCodeCoverage, andrunParallelparameters from workflow calls - [ ] Update
phpVersionto'8.3'or remove to use default - [ ] Add
testscript tocomposer.jsonwith desired Pest or PHPUnit configuration - [ ] Ensure
useCodeCov: trueis set if CodeCov integration is needed - [ ] Test the updated workflow to ensure it works as expected