@@ -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 :
@@ -65,13 +62,13 @@ jobs:
65
62
66
63
- name : Setup PHP ${{ matrix.php-version }}
67
64
uses : shivammathur/setup-php@v2
65
+ env :
66
+ update : true # Always use latest available patch for the version
67
+ fail-fast : true # step will fail if an extension or tool fails to set up
68
68
with :
69
69
php-version : ' ${{ matrix.php-version }}'
70
70
tools : composer
71
71
coverage : ${{ env.COVERAGE_TYPE }}
72
- env :
73
- # Always use latest available patch for the version
74
- update : true
75
72
76
73
- name : Setup cache
77
74
id : cache
80
77
path : |
81
78
~/.composer
82
79
./vendor
83
- ${{ env.CODACY_CACHE_PATH }}
84
80
# Clear the cache if composer json (as composer.lock is in the repo) has been updated
85
81
key : tests-${{ matrix.php-version }}-${{ matrix.symfony-version }}-${{ matrix.composer-flag }}-${{ hashFiles('composer.json') }}
86
82
87
- - name : Download codacy binary
88
- if : steps.cache.outputs.cache-hit != 'true'
89
- run : |
90
- mkdir -p ${{ env.CODACY_CACHE_PATH }} \
91
- && curl -LN https://coverage.codacy.com/get.sh -o ${{ env.CODACY_BIN }} \
92
- && chmod +x ${{ env.CODACY_BIN }} \
93
- && ${{ env.CODACY_BIN }} download
94
-
95
83
- name : Build
96
84
run : |
97
85
SF_VERSION=${{ matrix.symfony-version }}
@@ -105,34 +93,41 @@ jobs:
105
93
- name : Tests
106
94
run : make test-unit && make test-functional
107
95
108
- # Upload to codacy first as codecov action always remove coverage files despite move_coverage_to_trash at false
109
- # And only if it's not a PR from a fork => Can't work as codacy secret is not accessible in that context
110
- - name : Upload coverages to Codacy
111
- if : ${{ (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == 'yoanm/php-jsonrpc-params-symfony-validator-sdk') && env.COVERAGE_TYPE == 'xdebug' }}
112
- 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
113
-
114
- # See the reports at https://codecov.io/gh/yoanm/php-jsonrpc-params-symfony-validator-sdk
115
- - name : Upload unit tests coverage to codecov
96
+ - name : Create "unit tests" reports group
116
97
if : ${{ env.COVERAGE_TYPE == 'xdebug' }}
117
- uses : codecov/codecov-action@v3
98
+ id : unit-tests-coverage-group
99
+ uses : yoanm/tmp-reports-group-workspace/.github/actions/create-action@develop
118
100
with :
119
- file : " build/coverage-phpunit/unit.clover"
120
- name : " unit-tests-${{ matrix.php-version }}-${{ matrix.symfony-version }}"
121
- flags : " unit-tests,php-${{ matrix.php-version }},sf-${{ matrix.symfony-version }}"
122
- fail_ci_if_error : true
123
- move_coverage_to_trash : false
124
- verbose : ${{ runner.debug == '1' }}
125
-
126
- - name : Upload functional tests coverage to codecov
101
+ name : unit-tests
102
+ format : clover
103
+ files : build/coverage-phpunit/unit.clover
104
+ flags : |
105
+ unit-tests
106
+ php-${{ matrix.php-version }}
107
+ path : build/coverage-groups
108
+
109
+ - name : Create "functional tests" coverage group
127
110
if : ${{ env.COVERAGE_TYPE == 'xdebug' }}
128
- uses : codecov/codecov-action@v3
111
+ id : functional-tests-coverage-group
112
+ uses : yoanm/tmp-reports-group-workspace/.github/actions/create-action@develop
129
113
with :
130
- files : " build/coverage-behat/clover.xml,build/coverage-phpunit/functional.clover"
131
- name : " functional-tests-${{ matrix.php-version }}-${{ matrix.symfony-version }}"
132
- flags : " functional-tests,php-${{ matrix.php-version }},sf-${{ matrix.symfony-version }}"
133
- fail_ci_if_error : true
134
- move_coverage_to_trash : false
135
- verbose : ${{ runner.debug == '1' }}
114
+ name : functional-tests
115
+ format : clover
116
+ files : |
117
+ build/coverage-phpunit/functional.clover
118
+ build/coverage-behat/clover.xml
119
+ flags : |
120
+ functional-tests
121
+ php-${{ matrix.php-version }}
122
+ path : build/coverage-groups
123
+
124
+ - name : Upload coverage reports
125
+ if : ${{ env.COVERAGE_TYPE == 'xdebug' }}
126
+ uses : actions/upload-artifact@v4
127
+ with :
128
+ name : coverage-groups-php${{ matrix.php-version }}-sf${{ matrix.symfony-version }}
129
+ path : build/coverage-groups
130
+ if-no-files-found : error
136
131
137
132
static-checks :
138
133
name : Static checks
@@ -169,31 +164,6 @@ jobs:
169
164
if : ${{ github.event_name == 'pull_request' }}
170
165
uses : actions/dependency-review-action@v1
171
166
172
- finalize-codacy-coverage-report :
173
- runs-on : ubuntu-latest
174
- name : Finalize Codacy coverage report
175
- if : ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == 'yoanm/php-jsonrpc-params-symfony-validator-sdk' }}
176
- needs : [ tests ]
177
- steps :
178
- - name : Setup cache
179
- id : cache
180
- uses : actions/cache@v3
181
- with :
182
- path : |
183
- ${{ env.CODACY_CACHE_PATH }}
184
- key : codacy-final
185
-
186
- - name : Download codacy binary
187
- if : steps.cache.outputs.cache-hit != 'true'
188
- run : |
189
- mkdir -p ${{ env.CODACY_CACHE_PATH }} \
190
- && curl -LN https://coverage.codacy.com/get.sh -o ${{ env.CODACY_BIN }} \
191
- && chmod +x ${{ env.CODACY_BIN }} \
192
- && ${{ env.CODACY_BIN }} download
193
-
194
- - name : Finalize reporting
195
- run : ${{ env.CODACY_BIN }} final -t ${{ secrets.CODACY_PROJECT_TOKEN }}
196
-
197
167
nightly-tests :
198
168
name : Nightly - Symfony ${{ matrix.symfony-version }}
199
169
runs-on : ubuntu-latest
0 commit comments