@@ -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 }}
@@ -107,34 +95,43 @@ jobs:
10795 - name : Tests
10896 run : make test-unit && make test-functional
10997
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
11899 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
120102 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
129113 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
131116 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
138135
139136 static-checks :
140137 name : Static checks
@@ -171,31 +168,6 @@ jobs:
171168 if : ${{ github.event_name == 'pull_request' }}
172169 uses : actions/dependency-review-action@v1
173170
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-
199171 nightly-tests :
200172 name : Nightly - Symfony ${{ matrix.symfony-version }}
201173 runs-on : ubuntu-latest
0 commit comments