Intelligently retries failed PHPUnit tests with their dependencies instead of running the full test suite.
Please note that this action is not a drop-in replacement for standard PHPUnit retries.
Originally designed for Appwrite Cloud's internal test infrastructure and may require minor adjustments for other
setups.
- uses: itznotabug/php-retry@v1
with:
command: vendor/bin/phpunit tests/
test_dir: testsWith Docker:
- uses: itznotabug/php-retry@v1
with:
command: docker compose exec -T appwrite test /usr/src/code/tests/e2e
test_dir: vendor/appwrite/server-ce/tests/e2e- Runs your PHPUnit command with
--log-junit - On failure, parses JUnit XML to identify failed tests
- Analyzes
@dependsannotations to build dependency graph - Retries only failed tests + dependencies using
--filter
Example: If 3 out of 100 tests fail, retry attempts run only those 3 + their dependencies instead of all 100.
| Input | Required | Default | Description |
|---|---|---|---|
command |
Yes | - | PHPUnit command to execute |
test_dir |
Yes | - | Test directory in workspace |
max_attempts |
No | 3 |
Maximum retry attempts (1-10) |
retry_wait_seconds |
No | 10 |
Seconds to wait between retries |
shell |
No | bash |
Shell: bash, sh, pwsh, python, cmd, powershell |
timeout_minutes |
No | 30 |
Timeout per attempt (0 = no timeout) |
github_token |
No | - | GitHub token for PR comments (requires pull-requests: write and content: read) |
job_id |
No | - | Job ID to build URLs for Job logs |
- Requires PHPUnit 9.x or later
test_dirmust be workspace path, not container path- Works with vendor test paths (e.g.,
vendor/company/pkg/tests/)