@@ -4,7 +4,6 @@ on: # Build any PRs and main branch changes
44 pull_request :
55 types :
66 - opened
7- - edited
87 - synchronize
98 push :
109 branches : [ master ]
@@ -18,8 +17,6 @@ concurrency:
1817env :
1918 TEST_OUTPUT_STYLE : pretty
2019 COMPOSER_OPTIONS : --optimize-autoloader
21- CODACY_CACHE_PATH : ~/.cache/codacy
22- CODACY_BIN : ~/.cache/codacy/codacy.sh
2320
2421jobs :
2522 tests :
@@ -65,13 +62,13 @@ jobs:
6562
6663 - name : Setup PHP ${{ matrix.php-version }}
6764 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
6868 with :
6969 php-version : ' ${{ matrix.php-version }}'
7070 tools : composer
7171 coverage : ${{ env.COVERAGE_TYPE }}
72- env :
73- # Always use latest available patch for the version
74- update : true
7572
7673 - name : Setup cache
7774 id : cache
8077 path : |
8178 ~/.composer
8279 ./vendor
83- ${{ env.CODACY_CACHE_PATH }}
8480 # Clear the cache if composer json (as composer.lock is in the repo) has been updated
8581 key : tests-${{ matrix.php-version }}-${{ matrix.symfony-version }}-${{ matrix.composer-flag }}-${{ hashFiles('composer.json') }}
8682
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-
9583 - name : Build
9684 run : |
9785 SF_VERSION=${{ matrix.symfony-version }}
@@ -105,34 +93,41 @@ jobs:
10593 - name : Tests
10694 run : make test-unit && make test-functional
10795
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
11697 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
118100 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
127110 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
129113 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
136131
137132 static-checks :
138133 name : Static checks
@@ -169,31 +164,6 @@ jobs:
169164 if : ${{ github.event_name == 'pull_request' }}
170165 uses : actions/dependency-review-action@v1
171166
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-
197167 nightly-tests :
198168 name : Nightly - Symfony ${{ matrix.symfony-version }}
199169 runs-on : ubuntu-latest
0 commit comments