2323 - name : Checkout code
2424 uses : actions/checkout@v1
2525
26+ - name : Get changed files
27+ id : changed-files
28+ uses : tj-actions/changed-files@v46
29+ with :
30+ files : |
31+ config
32+ lang
33+ routes
34+ src
35+ tests
36+ composer.json
37+ phpunit.xml.dist
38+ .github/workflows/tests.yaml
39+ **.php
40+
41+ - name : Determine whether tests should run
42+ id : should-run-tests
43+ if : steps.changed-files.outputs.any_modified == 'true' || github.event_name == 'schedule'
44+ run : |
45+ echo "result=true" >> $GITHUB_OUTPUT
46+ echo "result=true" >> $env:GITHUB_OUTPUT
47+
2648 - name : Get changed files (Payments)
2749 id : changed-files-payments
2850 uses : tj-actions/changed-files@v46
@@ -43,21 +65,27 @@ jobs:
4365
4466 - name : Setup PHP
4567 uses : shivammathur/setup-php@v2
68+ if : steps.should-run-tests.outputs.result == 'true'
4669 with :
4770 php-version : ${{ matrix.php }}
4871 extensions : fileinfo, exif, gd, pdo, sqlite, pdo_sqlite, intl
4972
5073 - name : Install dependencies
74+ if : steps.should-run-tests.outputs.result == 'true'
5175 run : |
5276 composer require "illuminate/contracts:${{ matrix.laravel }}" --no-interaction --no-update
5377 composer update --${{ matrix.stability }} --prefer-dist --no-interaction --no-suggest
5478
5579 - name : Execute tests
80+ if : steps.should-run-tests.outputs.result == 'true'
5681 run : vendor/bin/phpunit --exclude-group=payments
5782
5883 - name : Execute tests (Payments)
5984 run : vendor/bin/phpunit --group=payments
60- if : steps.should-run-payment-tests.outputs.result == 'true' && matrix.php == 8.5 && matrix.laravel == '12.*' && matrix.stability == 'prefer-stable'
85+ if : steps.should-run-tests.outputs.result == 'true'
86+ && steps.should-run-payment-tests.outputs.result == 'true'
87+ && matrix.php == 8.5 && matrix.laravel == '12.*'
88+ && matrix.stability == 'prefer-stable'
6189 env :
6290 STRIPE_KEY : ${{ secrets.STRIPE_KEY }}
6391 STRIPE_SECRET : ${{ secrets.STRIPE_SECRET }}
0 commit comments