11name : ' CI'
2+
23on : # Build any PRs and main branch changes
34 workflow_dispatch : # Allows to run the workflow manually from the Actions tab
45 pull_request :
56 types :
67 - opened
7- - edited
88 - synchronize
99 push :
1010 branches : [ master ]
@@ -18,8 +18,6 @@ concurrency:
1818env :
1919 TEST_OUTPUT_STYLE : pretty
2020 COMPOSER_OPTIONS : --optimize-autoloader
21- CODACY_CACHE_PATH : ~/.cache/codacy
22- CODACY_BIN : ~/.cache/codacy/codacy.sh
2321
2422jobs :
2523 tests :
@@ -65,13 +63,13 @@ jobs:
6563
6664 - name : Setup PHP ${{ matrix.php-version }}
6765 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
6869 with :
6970 php-version : ' ${{ matrix.php-version }}'
7071 tools : composer
7172 coverage : ${{ env.COVERAGE_TYPE }}
72- env :
73- # Always use latest available patch for the version
74- update : true
7573
7674 - name : Setup cache
7775 id : cache
8078 path : |
8179 ~/.composer
8280 ./vendor
83- ${{ env.CODACY_CACHE_PATH }}
8481 # Clear the cache if composer json (as composer.lock is in the repo) has been updated
8582 key : tests-${{ matrix.php-version }}-${{ matrix.symfony-version }}-${{ matrix.composer-flag }}-${{ hashFiles('composer.json') }}
8683
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-
9584 - name : Build
9685 run : |
9786 SF_VERSION=${{ matrix.symfony-version }}
@@ -110,39 +99,45 @@ jobs:
11099 - name : Tests
111100 run : make test-unit && make test-functional
112101
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-http-server') && 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-http-server
120- - name : Upload unit tests coverage to codecov
102+ - name : Create "unit tests" reports group
121103 if : ${{ env.COVERAGE_TYPE == 'xdebug' }}
122- uses : codecov/codecov-action@v3
104+ id : unit-tests-coverage-group
105+ uses : yoanm/tmp-reports-group-workspace/.github/actions/create-action@develop
123106 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+ path : build/coverage-groups
114+
115+ - name : Create "functional tests" coverage group
116+ if : ${{ env.COVERAGE_TYPE == 'xdebug' }}
117+ id : functional-tests-coverage-group
118+ uses : yoanm/tmp-reports-group-workspace/.github/actions/create-action@develop
119+ with :
120+ name : functional-tests
121+ format : clover
122+ files : |
123+ build/coverage-phpunit/functional.clover
124+ build/coverage-behat/clover.xml
125+ flags : |
126+ functional-tests
127+ php-${{ matrix.php-version }}
128+ path : build/coverage-groups
129+
130+ - name : Upload coverage reports
132131 if : ${{ env.COVERAGE_TYPE == 'xdebug' }}
133- uses : codecov/codecov-action@v3
132+ uses : actions/upload-artifact@v4
134133 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' }}
134+ name : coverage-groups-php${{ matrix.php-version }}-sf${{ matrix.symfony-version }}
135+ path : build/coverage-groups
136+ if-no-files-found : error
141137
142138 static-checks :
143139 name : Static checks
144140 runs-on : ubuntu-latest
145- needs : [ tests ]
146141 steps :
147142 - uses : actions/checkout@v3
148143
@@ -175,31 +170,6 @@ jobs:
175170 if : ${{ github.event_name == 'pull_request' }}
176171 uses : actions/dependency-review-action@v1
177172
178- finalize-codacy-coverage-report :
179- runs-on : ubuntu-latest
180- name : Finalize Codacy coverage report
181- if : ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == 'yoanm/symfony-jsonrpc-http-server' }}
182- needs : [ tests ]
183- steps :
184- - name : Setup cache
185- id : cache
186- uses : actions/cache@v3
187- with :
188- path : |
189- ${{ env.CODACY_CACHE_PATH }}
190- key : codacy-final
191-
192- - name : Download codacy binary
193- if : steps.cache.outputs.cache-hit != 'true'
194- run : |
195- mkdir -p ${{ env.CODACY_CACHE_PATH }} \
196- && curl -LN https://coverage.codacy.com/get.sh -o ${{ env.CODACY_BIN }} \
197- && chmod +x ${{ env.CODACY_BIN }} \
198- && ${{ env.CODACY_BIN }} download
199-
200- - name : Finalize reporting
201- run : ${{ env.CODACY_BIN }} final -t ${{ secrets.CODACY_PROJECT_TOKEN }}
202-
203173 nightly-tests :
204174 name : Nightly - Symfony ${{ matrix.symfony-version }}
205175 runs-on : ubuntu-latest
0 commit comments