Skip to content

Commit 75b0872

Browse files
committed
fix: Avoid running PHPUnit when not needed
1 parent 4e65506 commit 75b0872

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

.github/workflows/php-unit-tests.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,22 @@ jobs:
5555
with:
5656
fetch-depth: 0
5757

58+
- name: Check existence of composer.json & phpunit.xml.dist files
59+
id: check_files
60+
uses: andstor/file-existence-action@v3
61+
with:
62+
files: "composer.json, phpunit.xml.dist, phpunit.xml"
63+
5864
- name: Composer setup
5965
uses: Humanoidfr/humanoid-github-workflows/.github/actions/composer@main
6066
with:
6167
PHP_VERSION: ${{ inputs.PHP_VERSION }}
6268
COMPOSER_CONFIG: ${{ vars.COMPOSER_CONFIG_JSON }}
6369

6470
- name: Set up problem matchers for PHPUnit
71+
if: steps.check_files.outputs.files_exists == 'true'
6572
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
6673

6774
- name: Run PHPUnit
75+
if: steps.check_files.outputs.files_exists == 'true'
6876
run: ./vendor/bin/phpunit ${{ inputs.PHPUNIT_ARGS }}

0 commit comments

Comments
 (0)