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