fix: make reusable workflow resilient to missing test runners
Detect whether pest, phpunit, or pint are installed before running them. Repos without test runners will skip gracefully instead of failing with "No such file or directory". Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
9604b08d61
commit
d231c72661
1 changed files with 16 additions and 5 deletions
|
|
@ -48,12 +48,23 @@ jobs:
|
|||
|
||||
- name: Run Pint
|
||||
if: inputs.pint
|
||||
run: vendor/bin/pint --test
|
||||
run: |
|
||||
if [ -f vendor/bin/pint ]; then
|
||||
vendor/bin/pint --test
|
||||
else
|
||||
echo "Pint not installed, skipping"
|
||||
fi
|
||||
|
||||
- name: Run tests
|
||||
run: |
|
||||
FLAGS="--ci"
|
||||
if [ "${{ inputs.coverage }}" = "true" ]; then
|
||||
FLAGS="$FLAGS --coverage"
|
||||
if [ -f vendor/bin/pest ]; then
|
||||
FLAGS="--ci"
|
||||
if [ "${{ inputs.coverage }}" = "true" ]; then
|
||||
FLAGS="$FLAGS --coverage"
|
||||
fi
|
||||
vendor/bin/pest $FLAGS
|
||||
elif [ -f vendor/bin/phpunit ]; then
|
||||
vendor/bin/phpunit
|
||||
else
|
||||
echo "No test runner found (pest or phpunit), skipping tests"
|
||||
fi
|
||||
vendor/bin/pest $FLAGS
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue