@@ -4,7 +4,6 @@ on: # Build any PRs and main branch changes
4
4
pull_request :
5
5
types :
6
6
- opened
7
- - edited
8
7
- synchronize
9
8
push :
10
9
branches : [ master ]
@@ -18,8 +17,6 @@ concurrency:
18
17
env :
19
18
TEST_OUTPUT_STYLE : pretty
20
19
COMPOSER_OPTIONS : --optimize-autoloader
21
- CODACY_CACHE_PATH : ~/.cache/codacy
22
- CODACY_BIN : ~/.cache/codacy/codacy.sh
23
20
24
21
jobs :
25
22
tests :
@@ -49,13 +46,13 @@ jobs:
49
46
50
47
- name : Setup PHP ${{ matrix.php-version }}
51
48
uses : shivammathur/setup-php@v2
49
+ env :
50
+ update : true # Always use latest available patch for the version
51
+ fail-fast : true # step will fail if an extension or tool fails to set up
52
52
with :
53
53
php-version : ' ${{ matrix.php-version }}'
54
54
tools : composer
55
55
coverage : ${{ env.COVERAGE_TYPE }}
56
- env :
57
- # Always use latest available patch for the version
58
- update : true
59
56
60
57
- name : Setup cache
61
58
id : cache
64
61
path : |
65
62
~/.composer
66
63
./vendor
67
- ${{ env.CODACY_CACHE_PATH }}
68
64
# Clear the cache if composer json (as composer.lock is in the repo) has been updated
69
65
key : tests-${{ matrix.php-version }}-${{ matrix.composer-flag }}-${{ hashFiles('composer.json') }}
70
66
71
- - name : Download codacy binary
72
- if : steps.cache.outputs.cache-hit != 'true'
73
- run : |
74
- mkdir -p ${{ env.CODACY_CACHE_PATH }} \
75
- && curl -LN https://coverage.codacy.com/get.sh -o ${{ env.CODACY_BIN }} \
76
- && chmod +x ${{ env.CODACY_BIN }} \
77
- && ${{ env.CODACY_BIN }} download
78
-
79
67
- name : Build
80
68
run : |
81
69
composer update ${{ env.COMPOSER_OPTIONS }} ${{ matrix.composer-flag }} \
@@ -84,34 +72,41 @@ jobs:
84
72
- name : Tests
85
73
run : make test-unit && make test-functional
86
74
87
- # Upload to codacy first as codecov action always remove coverage files despite move_coverage_to_trash at false
88
- # And only if it's not a PR from a fork => Can't work as codacy secret is not accessible in that context
89
- - name : Upload coverages to Codacy
90
- if : ${{ (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == 'yoanm/php-jsonrpc-http-server-openapi-doc-sdk') && env.COVERAGE_TYPE == 'xdebug' }}
91
- run : ${{ env.CODACY_BIN }} report -r build/coverage-phpunit/unit.clover -r build/coverage-behat/clover.xml -r build/coverage-phpunit/functional.clover -t ${{ secrets.CODACY_PROJECT_TOKEN }} --partial
92
-
93
- # See the reports at https://codecov.io/gh/yoanm/php-jsonrpc-http-server-openapi-doc-sdk
94
- - name : Upload unit tests coverage to codecov
75
+ - name : Create "unit tests" reports group
95
76
if : ${{ env.COVERAGE_TYPE == 'xdebug' }}
96
- uses : codecov/codecov-action@v3
77
+ id : unit-tests-coverage-group
78
+ uses : yoanm/tmp-reports-group-workspace/.github/actions/create-action@develop
97
79
with :
98
- file : " build/coverage-phpunit/unit.clover"
99
- name : " unit-tests-${{ matrix.php-version }}"
100
- flags : " unit-tests,php-${{ matrix.php-version }}"
101
- fail_ci_if_error : true
102
- move_coverage_to_trash : false
103
- verbose : ${{ runner.debug == '1' }}
104
-
105
- - name : Upload functional tests coverage to codecov
80
+ name : unit-tests
81
+ format : clover
82
+ files : build/coverage-phpunit/unit.clover
83
+ flags : |
84
+ unit-tests
85
+ php-${{ matrix.php-version }}
86
+ path : build/coverage-groups
87
+
88
+ - name : Create "functional tests" coverage group
106
89
if : ${{ env.COVERAGE_TYPE == 'xdebug' }}
107
- uses : codecov/codecov-action@v3
90
+ id : functional-tests-coverage-group
91
+ uses : yoanm/tmp-reports-group-workspace/.github/actions/create-action@develop
108
92
with :
109
- files : " build/coverage-behat/clover.xml,build/coverage-phpunit/functional.clover"
110
- name : " functional-tests-${{ matrix.php-version }}"
111
- flags : " functional-tests,php-${{ matrix.php-version }}"
112
- fail_ci_if_error : true
113
- move_coverage_to_trash : false
114
- verbose : ${{ runner.debug == '1' }}
93
+ name : functional-tests
94
+ format : clover
95
+ files : |
96
+ build/coverage-phpunit/functional.clover
97
+ build/coverage-behat/clover.xml
98
+ flags : |
99
+ functional-tests
100
+ php-${{ matrix.php-version }}
101
+ path : build/coverage-groups
102
+
103
+ - name : Upload coverage reports
104
+ if : ${{ env.COVERAGE_TYPE == 'xdebug' }}
105
+ uses : actions/upload-artifact@v4
106
+ with :
107
+ name : coverage-groups-php${{ matrix.php-version }}
108
+ path : build/coverage-groups
109
+ if-no-files-found : error
115
110
116
111
static-checks :
117
112
name : Static checks
@@ -148,31 +143,6 @@ jobs:
148
143
if : ${{ github.event_name == 'pull_request' }}
149
144
uses : actions/dependency-review-action@v1
150
145
151
- finalize-codacy-coverage-report :
152
- runs-on : ubuntu-latest
153
- name : Finalize Codacy coverage report
154
- if : ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == 'yoanm/php-jsonrpc-http-server-openapi-doc-sdk' }}
155
- needs : [ tests ]
156
- steps :
157
- - name : Setup cache
158
- id : cache
159
- uses : actions/cache@v3
160
- with :
161
- path : |
162
- ${{ env.CODACY_CACHE_PATH }}
163
- key : codacy-final
164
-
165
- - name : Download codacy binary
166
- if : steps.cache.outputs.cache-hit != 'true'
167
- run : |
168
- mkdir -p ${{ env.CODACY_CACHE_PATH }} \
169
- && curl -LN https://coverage.codacy.com/get.sh -o ${{ env.CODACY_BIN }} \
170
- && chmod +x ${{ env.CODACY_BIN }} \
171
- && ${{ env.CODACY_BIN }} download
172
-
173
- - name : Finalize reporting
174
- run : ${{ env.CODACY_BIN }} final -t ${{ secrets.CODACY_PROJECT_TOKEN }}
175
-
176
146
nightly-tests :
177
147
name : Nightly - PHP ${{ matrix.php-version }}
178
148
runs-on : ubuntu-latest
0 commit comments