1+ name : Code Coverage
2+
3+ on :
4+ workflow_call :
5+ inputs :
6+ phpVersion :
7+ type : string
8+ required : true
9+ phpExtensions :
10+ type : string
11+ required : true
12+ tools :
13+ type : string
14+ required : true
15+ secrets :
16+ GH_TOKEN :
17+ required : true
18+ CODECOV_TOKEN :
19+ required : true
20+
21+ jobs :
22+ run :
23+ name : Code Coverage
24+ runs-on : ubuntu-latest
25+ steps :
26+ - name : Checkout
27+ uses : actions/checkout@v6
28+ - name : Install PHP
29+ uses : shivammathur/setup-php@v2
30+ with :
31+ php-version : ${{ inputs.phpVersion }}
32+ extensions : ${{ inputs.phpExtensions }}
33+ tools : ${{ inputs.tools }}
34+ env :
35+ GITHUB_TOKEN : ${{ secrets.GH_TOKEN }}
36+ - name : Install composer dependencies
37+ run : composer install --no-interaction --no-progress --prefer-dist
38+ - name : Run PHPUnit unit tests with coverage and test results
39+ run : phpunit --testsuite unit --coverage-clover=coverage-unit.xml --log-junit junit.xml
40+ - name : Upload unit coverage to Codecov
41+ uses : codecov/codecov-action@v5
42+ with :
43+ files : ./coverage-unit.xml
44+ flags : unit
45+ token : ${{ secrets.CODECOV_TOKEN }}
46+ - name : Run PHPUnit integration tests with coverage and test results
47+ run : phpunit --testsuite integration --coverage-clover=coverage-integration.xml --log-junit junit.xml
48+ - name : Upload integration coverage to Codecov
49+ uses : codecov/codecov-action@v5
50+ with :
51+ files : ./coverage-integration.xml
52+ flags : integration
53+ token : ${{ secrets.CODECOV_TOKEN }}
54+ - name : Run PHPUnit smoke tests with coverage and test results
55+ run : phpunit --testsuite smoke --coverage-clover=coverage-smoke.xml --log-junit junit.xml
56+ - name : Upload smoke coverage to Codecov
57+ uses : codecov/codecov-action@v5
58+ with :
59+ files : ./coverage-smoke.xml
60+ flags : smoke
61+ token : ${{ secrets.CODECOV_TOKEN }}
62+ - name : Upload test results to Codecov
63+ if : ${{ !cancelled() }}
64+ uses : codecov/test-results-action@v1
65+ with :
66+ token : ${{ secrets.CODECOV_TOKEN }}
0 commit comments