@@ -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 }}
@@ -107,34 +95,43 @@ jobs:
107
95
- name : Tests
108
96
run : make test-unit && make test-functional
109
97
110
- # Upload to codacy first as codecov action always remove coverage files despite move_coverage_to_trash at false
111
- # And only if it's not a PR from a fork => Can't work as codacy secret is not accessible in that context
112
- - name : Upload coverages to Codacy
113
- if : ${{ (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == 'yoanm/php-jsonrpc-params-symfony-constraint-doc-sdk') && env.COVERAGE_TYPE == 'xdebug' }}
114
- 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
115
-
116
- # See the reports at https://codecov.io/gh/yoanm/php-jsonrpc-params-symfony-constraint-doc-sdk
117
- - name : Upload unit tests coverage to codecov
98
+ - name : Create "unit tests" reports group
118
99
if : ${{ env.COVERAGE_TYPE == 'xdebug' }}
119
- uses : codecov/codecov-action@v3
100
+ id : unit-tests-coverage-group
101
+ uses : yoanm/temp-reports-group-workspace/.github/actions/create-action@develop
120
102
with :
121
- file : " build/coverage-phpunit/unit.clover"
122
- name : " unit-tests-${{ matrix.php-version }}-${{ matrix.symfony-version }}"
123
- flags : " unit-tests,php-${{ matrix.php-version }},sf-${{ matrix.symfony-version }}"
124
- fail_ci_if_error : true
125
- move_coverage_to_trash : false
126
- verbose : ${{ runner.debug == '1' }}
127
-
128
- - name : Upload functional tests coverage to codecov
103
+ name : unit-tests
104
+ format : clover
105
+ files : build/coverage-phpunit/unit.clover
106
+ flags : |
107
+ unit-tests
108
+ php-${{ matrix.php-version }}
109
+ sf-${{ matrix.symfony-version }}
110
+ path : build/coverage-groups
111
+
112
+ - name : Create "functional tests" coverage group
129
113
if : ${{ env.COVERAGE_TYPE == 'xdebug' }}
130
- uses : codecov/codecov-action@v3
114
+ id : functional-tests-coverage-group
115
+ uses : yoanm/temp-reports-group-workspace/.github/actions/create-action@develop
131
116
with :
132
- files : " build/coverage-behat/clover.xml,build/coverage-phpunit/functional.clover"
133
- name : " functional-tests-${{ matrix.php-version }}-${{ matrix.symfony-version }}"
134
- flags : " functional-tests,php-${{ matrix.php-version }},sf-${{ matrix.symfony-version }}"
135
- fail_ci_if_error : true
136
- move_coverage_to_trash : false
137
- verbose : ${{ runner.debug == '1' }}
117
+ name : functional-tests
118
+ format : clover
119
+ files : |
120
+ build/coverage-phpunit/functional.clover
121
+ build/coverage-behat/clover.xml
122
+ flags : |
123
+ functional-tests
124
+ php-${{ matrix.php-version }}
125
+ sf-${{ matrix.symfony-version }}
126
+ path : build/coverage-groups
127
+
128
+ - name : Upload coverage reports
129
+ if : ${{ env.COVERAGE_TYPE == 'xdebug' }}
130
+ uses : actions/upload-artifact@v4
131
+ with :
132
+ name : coverage-groups-php${{ matrix.php-version }}-sf${{ matrix.symfony-version }}
133
+ path : build/coverage-groups
134
+ if-no-files-found : error
138
135
139
136
static-checks :
140
137
name : Static checks
@@ -171,31 +168,6 @@ jobs:
171
168
if : ${{ github.event_name == 'pull_request' }}
172
169
uses : actions/dependency-review-action@v1
173
170
174
- finalize-codacy-coverage-report :
175
- runs-on : ubuntu-latest
176
- name : Finalize Codacy coverage report
177
- if : ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == 'yoanm/php-jsonrpc-params-symfony-constraint-doc-sdk' }}
178
- needs : [ tests ]
179
- steps :
180
- - name : Setup cache
181
- id : cache
182
- uses : actions/cache@v3
183
- with :
184
- path : |
185
- ${{ env.CODACY_CACHE_PATH }}
186
- key : codacy-final
187
-
188
- - name : Download codacy binary
189
- if : steps.cache.outputs.cache-hit != 'true'
190
- run : |
191
- mkdir -p ${{ env.CODACY_CACHE_PATH }} \
192
- && curl -LN https://coverage.codacy.com/get.sh -o ${{ env.CODACY_BIN }} \
193
- && chmod +x ${{ env.CODACY_BIN }} \
194
- && ${{ env.CODACY_BIN }} download
195
-
196
- - name : Finalize reporting
197
- run : ${{ env.CODACY_BIN }} final -t ${{ secrets.CODACY_PROJECT_TOKEN }}
198
-
199
171
nightly-tests :
200
172
name : Nightly - Symfony ${{ matrix.symfony-version }}
201
173
runs-on : ubuntu-latest
0 commit comments