88 push :
99 branches : [main]
1010
11- env :
12- CC_TEST_REPORTER_ID : ${{ secrets.CC_TEST_REPORTER_ID }}
13- CC_TEST_REPORTER_URL : ${{ vars.CC_TEST_REPORTER_URL }}
14-
1511jobs :
16- configs :
12+ prepare :
1713 name : Prepare
18- uses : ./.github/workflows/configure.yml
19- secrets : inherit
20-
21- permissions :
22- contents : read
23- pull-requests : write
14+ uses : feryardiant/actions/.github/workflows/configure.yml@main
15+ secrets :
16+ CC_TEST_REPORTER_ID : ${{ secrets.CC_TEST_REPORTER_ID }}
2417
2518 tests :
2619 name : Test on PHP ${{ matrix.php }} with DB ${{ matrix.db }}
2720 runs-on : ubuntu-latest
28- needs : configs
21+ needs : prepare
2922 outputs :
3023 has-reports : ${{ steps.reports.outputs.has-reports }}
3124
6760 strategy :
6861 fail-fast : false
6962 matrix :
70- php : [8.1, 8.2]
63+ php : [8.1, 8.2, 8.3 ]
7164 db : ['mysql', 'pgsql']
7265
7366 steps :
8780 - name : Cache Composer dependencies
8881 uses : actions/cache@v4
8982 with :
90- path : ${{ needs.configs .outputs.composer-cache }}
83+ path : ${{ needs.prepare .outputs.composer-cache }}
9184 key : ${{ runner.os }}-${{ matrix.php }}-composer-${{ hashFiles('**/composer.lock') }}
9285 restore-keys : ${{ runner.os }}-${{ matrix.php }}-composer-
9386
@@ -98,39 +91,29 @@ jobs:
9891 run : composer test -- --coverage
9992
10093 - name : Generate reports for CodeClimate
94+ if : needs.prepare.outputs.has-codeclimate == 'true'
10195 id : reports
102- if : ${{ github.actor != 'dependabot[bot]' || needs.configs.outputs.should-reports == '1' }}
10396 env :
10497 COVERAGE_FILE : tests/reports/clover.xml
10598 CODECLIMATE_REPORT : tests/reports/codeclimate.${{ matrix.php }}.json
99+ CC_TEST_REPORTER_URL : ${{ vars.CC_TEST_REPORTER_URL }}
106100 run : |
107- if [[ -n \"$CC_TEST_REPORTER_URL\" ]]; then
108- curl -LSs $CC_TEST_REPORTER_URL > ./cc-test-reporter && chmod +x ./cc-test-reporter
109- ./cc-test-reporter format-coverage -t clover -o $CODECLIMATE_REPORT $COVERAGE_FILE
110- echo "has-reports=1" >> $GITHUB_OUTPUT
111- fi
101+ curl -LSs $CC_TEST_REPORTER_URL > ./cc-test-reporter && chmod +x ./cc-test-reporter
102+ ./cc-test-reporter format-coverage -t clover -o $CODECLIMATE_REPORT $COVERAGE_FILE
112103
113104 - name : Upload tests reports
114105 uses : actions/upload-artifact@v4
115- if : ${{ github.actor != 'dependabot[bot]' || needs.configs .outputs.should-reports == '1' }}
106+ if : needs.prepare .outputs.has-codeclimate == 'true'
116107 with :
117- name : test-reports-${{ matrix.php }}-${{ matrix.db }}
108+ name : test-reports-php ${{ matrix.php }}-${{ matrix.db }}
118109 path : tests/reports
119110
120111 reports :
121112 name : Report Test Coverages
122- if : ${{ github.actor != 'dependabot[bot]' && needs.tests.outputs.has-reports == '1' }}
123- runs-on : ubuntu-latest
124- needs : tests
125-
126- steps :
127- - name : Download test reports
128- uses : actions/download-artifact@v4
129- with :
130- pattern : test-reports-*
131- merge-multiple : true
132-
133- - name : Report to CodeClimate
134- run : |
135- curl -LSs $CC_TEST_REPORTER_URL > ./cc-test-reporter && chmod +x ./cc-test-reporter
136- ./cc-test-reporter sum-coverage -o - codeclimate.*.json | ./cc-test-reporter upload-coverage --input -
113+ needs : [prepare, tests]
114+ if : needs.prepare.outputs.should-reports == '1'
115+ uses : feryardiant/actions/.github/workflows/report.yml@main
116+ secrets :
117+ CC_TEST_REPORTER_ID : ${{ secrets.CC_TEST_REPORTER_ID }}
118+ with :
119+ has-codeclimate : ${{ needs.prepare.outputs.has-codeclimate == 'true' }}
0 commit comments