Skip to content

Commit 8c09980

Browse files
committed
Improve
1 parent 04f6923 commit 8c09980

File tree

1 file changed

+29
-87
lines changed

1 file changed

+29
-87
lines changed

.github/workflows/CI.yml

+29-87
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ concurrency:
1717
env:
1818
# Cache params
1919
CACHE_VERSION: 2022061905 # To be able to create a new cache (YYYYMMDDXX)
20-
COVERAGE_OUTPUT_STYLE: clover
2120
TEST_OUTPUT_STYLE: pretty
2221
COMPOSER_OPTIONS: --optimize-autoloader
2322
CODACY_CACHE_PATH: ~/.cache/codacy
@@ -35,6 +34,7 @@ jobs:
3534
with:
3635
php-version: '8.1'
3736
tools: composer
37+
coverage: none
3838
env:
3939
# Always use latest available patch for the version
4040
update: true
@@ -59,28 +59,44 @@ jobs:
5959
uses: actions/dependency-review-action@v1
6060

6161
tests:
62-
name: UTs & FTs - PHP ${{ matrix.php-version }} / Symfony ${{ matrix.symfony-version }}
62+
name: UTs & FTs - Symfony ${{ matrix.symfony-version }}
6363
runs-on: ubuntu-latest
64+
env:
65+
COVERAGE_TYPE: none
6466
strategy:
6567
fail-fast: true
6668
max-parallel: 4
6769
matrix:
6870
php-version:
6971
- '7.3' # Lowest supported
72+
- '7.4' # Latest php 7 version
73+
- '8.0' # First php 8 version
7074
- '8.1' # Latest supported
7175
symfony-version:
7276
- '4.4' # Lowest LTS
7377
- '5.4' # Latest LTS
78+
exclude:
79+
# Run all symfony version only on Lowest and Latest php versions, run it only one time for others
80+
- php-version: '8.0'
81+
symfony-version: '4.4'
82+
- php-version: '7.4'
83+
symfony-version: '5.4'
7484
steps:
7585
- name: Check out code
7686
uses: actions/checkout@v2
7787

88+
- name: Enable coverage
89+
if: ${{ matrix.php-version == '8.1' }}
90+
run: |
91+
echo "COVERAGE_OUTPUT_STYLE=clover" >> $GITHUB_ENV
92+
echo "COVERAGE_TYPE=xdebug" >> $GITHUB_ENV
93+
7894
- name: Setup PHP
7995
uses: shivammathur/setup-php@v2
8096
with:
8197
php-version: '${{ matrix.php-version }}'
8298
tools: composer
83-
coverage: xdebug
99+
coverage: ${{ env.COVERAGE_TYPE }}
84100
env:
85101
# Always use latest available patch for the version
86102
update: true
@@ -107,7 +123,7 @@ jobs:
107123
108124
- name: Build
109125
run: |
110-
composer require \
126+
composer require -W \
111127
symfony/http-foundation:^${{ matrix.symfony-version }} \
112128
symfony/http-kernel:^${{ matrix.symfony-version }} \
113129
symfony/config:^${{ matrix.symfony-version }} \
@@ -121,13 +137,16 @@ jobs:
121137

122138
# See the reports at https://codecov.io/gh/yoanm/symfony-jsonrpc-http-server
123139
- name: Upload unit tests coverage to codecov
140+
if: ${{ env.COVERAGE_TYPE == 'xdebug' }}
124141
uses: codecov/codecov-action@v3
125142
with:
126143
file: "build/coverage-phpunit/unit.clover"
127144
name: "unit-tests-${{ matrix.php-version }}-${{ matrix.symfony-version }}"
128145
flags: "unit-tests,php-${{ matrix.php-version }},sf-${{ matrix.symfony-version }}"
129146
fail_ci_if_error: true
147+
130148
- name: Upload functional tests coverage to codecov
149+
if: ${{ env.COVERAGE_TYPE == 'xdebug' }}
131150
uses: codecov/codecov-action@v3
132151
with:
133152
files: "build/coverage-behat/clover.xml,build/coverage-phpunit/functional.clover"
@@ -136,6 +155,7 @@ jobs:
136155
fail_ci_if_error: true
137156

138157
- name: Upload coverages to Codacy
158+
if: ${{ env.COVERAGE_TYPE == 'xdebug' }}
139159
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
140160

141161
finalize-codacy-coverage-report:
@@ -162,77 +182,16 @@ jobs:
162182
- name: Finalize reporting
163183
run: ${{ env.CODACY_BIN }} final -t ${{ secrets.CODACY_PROJECT_TOKEN }}
164184

165-
# Test against others impactful php versions (without coverage)
166-
tests-extra-versions:
167-
name: UTs & FTs - PHP ${{ matrix.php-version }} / Symfony ${{ matrix.symfony-version }}
168-
runs-on: ubuntu-latest
169-
needs: [ tests ]
170-
strategy:
171-
fail-fast: true
172-
max-parallel: 4
173-
matrix:
174-
include:
175-
- php-version: '7.4' # Latest php 7 version
176-
symfony-version: '4.4'
177-
- php-version: '8.0' # First php 8 version
178-
symfony-version: '5.4'
179-
steps:
180-
- name: Check out code
181-
uses: actions/checkout@v2
182-
183-
- name: Setup PHP
184-
uses: shivammathur/setup-php@v2
185-
with:
186-
php-version: '${{ matrix.php-version }}'
187-
tools: composer
188-
env:
189-
# Always use latest available patch for the version
190-
update: true
191-
192-
- name: Setup cache
193-
id: cache
194-
uses: actions/cache@v2
195-
with:
196-
path: |
197-
~/.composer
198-
./vendor
199-
${{ env.CODACY_CACHE_PATH }}
200-
build/behat-code-coverage-cache
201-
# Clear the cache if composer json (as composer.lock is in the repo) has been updated
202-
key: ${{ env.CACHE_VERSION }}-tests-${{ matrix.php-version }}-${{ matrix.symfony-version }}-${{ hashFiles('composer.json') }}
203-
204-
- name: Download codacy binary
205-
if: steps.cache.outputs.cache-hit != 'true'
206-
run: |
207-
mkdir -p ${{ env.CODACY_CACHE_PATH }} \
208-
&& curl -LN https://coverage.codacy.com/get.sh -o ${{ env.CODACY_BIN }} \
209-
&& chmod +x ${{ env.CODACY_BIN }} \
210-
&& ${{ env.CODACY_BIN }} download
211-
212-
- name: Build
213-
run: |
214-
composer require \
215-
symfony/http-foundation:^${{ matrix.symfony-version }} \
216-
symfony/http-kernel:^${{ matrix.symfony-version }} \
217-
symfony/config:^${{ matrix.symfony-version }} \
218-
symfony/dependency-injection:^${{ matrix.symfony-version }} \
219-
symfony/event-dispatcher:^${{ matrix.symfony-version }} \
220-
symfony/routing:^${{ matrix.symfony-version }} \
221-
&& make build
222-
223-
- name: Tests
224-
run: make test-unit && make test-functional
225-
226185
# Perform tests against current php dev version and next Symfony minor version to manage
227186
nightly-tests:
228-
name: Nightly - PHP ${{ matrix.php-version }} / Symfony ${{ matrix.symfony-version }}
229-
needs: [ tests ]
187+
name: Nightly - Symfony ${{ matrix.symfony-version }}
188+
needs: [ static-tests, tests ]
230189
runs-on: ubuntu-latest
231190
env:
232191
COMPOSER_OPTIONS: '--optimize-autoloader --ignore-platform-req=php+'
233192
strategy:
234193
fail-fast: false
235-
max-parallel: 2
194+
max-parallel: 4
236195
matrix:
237196
php-version:
238197
- '8.2' # Current php dev version
@@ -252,7 +211,7 @@ jobs:
252211
with:
253212
php-version: '${{ matrix.php-version }}'
254213
tools: composer
255-
coverage: xdebug
214+
coverage: none
256215
env:
257216
# Always use latest available patch for the version
258217
update: true
@@ -271,7 +230,7 @@ jobs:
271230

272231
- name: Build
273232
run: |
274-
composer require ${COMPOSER_OPTIONS} \
233+
composer require -W ${COMPOSER_OPTIONS} \
275234
symfony/http-foundation:^${{ matrix.symfony-version }} \
276235
symfony/http-kernel:^${{ matrix.symfony-version }} \
277236
symfony/config:^${{ matrix.symfony-version }} \
@@ -282,20 +241,3 @@ jobs:
282241
283242
- name: Test
284243
run: make test-unit && make test-functional
285-
286-
# See the reports at https://codecov.io/gh/yoanm/symfony-jsonrpc-http-server
287-
- name: Upload unit tests coverage to codecov
288-
uses: codecov/codecov-action@v3
289-
with:
290-
file: "build/coverage-phpunit/unit.clover"
291-
name: "unit-tests-${{ matrix.php-version }}-${{ matrix.symfony-version }}"
292-
flags: "nightly,unit-tests,php-${{ matrix.php-version }},sf-${{ matrix.symfony-version }}"
293-
fail_ci_if_error: false
294-
295-
- name: Upload functional tests coverage to codecov
296-
uses: codecov/codecov-action@v3
297-
with:
298-
files: "build/coverage-behat/clover.xml,build/coverage-phpunit/functional.clover"
299-
name: "functional-tests-${{ matrix.php-version }}-${{ matrix.symfony-version }}"
300-
flags: "nightly,functional-tests,php-${{ matrix.php-version }},sf-${{ matrix.symfony-version }}"
301-
fail_ci_if_error: false

0 commit comments

Comments
 (0)