Skip to content

Commit 6a4382d

Browse files
committed
feat: Refactor file existence checks in PHP Unit Tests workflow
1 parent 9b972c4 commit 6a4382d

File tree

1 file changed

+19
-6
lines changed

1 file changed

+19
-6
lines changed

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

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,26 +60,39 @@ jobs:
6060
with:
6161
fetch-depth: 0
6262

63-
- name: Check existence of composer.json & phpunit.xml.dist files
64-
id: check_files
63+
- name: Check existence of composer.json
64+
id: check_composer
6565
uses: andstor/file-existence-action@v3
6666
with:
67-
files: "composer.json, phpunit.xml.dist, phpunit.xml"
67+
files: "composer.json"
68+
69+
- name: Check existence of phpunit.xml.dist
70+
id: check_phpunit_dist
71+
uses: andstor/file-existence-action@v3
72+
with:
73+
files: "phpunit.xml.dist"
74+
75+
- name: Check existence of phpunit.xml
76+
id: check_phpunit
77+
uses: andstor/file-existence-action@v3
78+
with:
79+
files: "phpunit.xml"
6880

6981
- name: Composer setup
82+
if: steps.check_composer.outputs.files_exists == 'true' && (steps.check_phpunit_dist.outputs.files_exists == 'true' || steps.check_phpunit.outputs.files_exists == 'true')
7083
uses: Humanoidfr/humanoid-github-workflows/.github/actions/composer@main
7184
with:
7285
PHP_VERSION: ${{ inputs.PHP_VERSION }}
7386
COMPOSER_CONFIG: ${{ vars.COMPOSER_CONFIG_JSON }}
7487

7588
- name: Install Testkit package
76-
if: ${{ inputs.TESTKIT == true && steps.check_files.outputs.files_exists == 'true' }}
89+
if: inputs.TESTKIT == true && steps.check_composer.outputs.files_exists == 'true' && (steps.check_phpunit_dist.outputs.files_exists == 'true' || steps.check_phpunit.outputs.files_exists == 'true')
7790
run: composer require --dev mantle-framework/testkit
7891

7992
- name: Set up problem matchers for PHPUnit
80-
if: steps.check_files.outputs.files_exists == 'true'
93+
if: steps.check_composer.outputs.files_exists == 'true' && (steps.check_phpunit_dist.outputs.files_exists == 'true' || steps.check_phpunit.outputs.files_exists == 'true')
8194
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
8295

8396
- name: Run PHPUnit
84-
if: steps.check_files.outputs.files_exists == 'true'
97+
if: steps.check_composer.outputs.files_exists == 'true' && (steps.check_phpunit_dist.outputs.files_exists == 'true' || steps.check_phpunit.outputs.files_exists == 'true')
8598
run: ./vendor/bin/phpunit ${{ inputs.PHPUNIT_ARGS }}

0 commit comments

Comments
 (0)