From d231c72661e84da7bac65227203597135261ccf5 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 23 Feb 2026 04:55:04 +0000 Subject: [PATCH] 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 --- .forgejo/workflows/php-test.yml | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/.forgejo/workflows/php-test.yml b/.forgejo/workflows/php-test.yml index c42658a..6a929cd 100644 --- a/.forgejo/workflows/php-test.yml +++ b/.forgejo/workflows/php-test.yml @@ -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