Skip to content

Commit 7eb1762

Browse files
committed
Fix
1 parent c40daac commit 7eb1762

File tree

2 files changed

+97
-20
lines changed

2 files changed

+97
-20
lines changed

.github/workflows/reusable-CI-workflow.yml

Lines changed: 95 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ jobs:
2020
php-min: ${{ steps.fetch-php-versions.outputs.min }}
2121
php-max: ${{ steps.fetch-php-versions.outputs.max }}
2222
php-next: ${{ steps.fetch-php-versions.outputs.next }}
23+
symfony-min: ${{ steps.fetch-symfony-versions.outputs.min }}
24+
symfony-max: ${{ steps.fetch-symfony-versions.outputs.max }}
25+
symfony-next: ${{ steps.fetch-symfony-versions.outputs.next }}
2326
steps:
2427
- name: Fetch supported versions file
2528
id: fetch-file
@@ -34,6 +37,13 @@ jobs:
3437
path: ${{ steps.fetch-file.outputs.path }}
3538
dependency: php
3639

40+
- name: Fetch Symfony supported versions
41+
id: fetch-symfony-versions
42+
uses: yoanm/gha-supported-versions-parser@v1
43+
with:
44+
path: ${{ steps.fetch-file.outputs.path }}
45+
dependency: symfony
46+
3747
tests:
3848
name: ${{ matrix.job-name }}
3949
needs: [fetch-supported-versions]
@@ -49,8 +59,29 @@ jobs:
4959
include:
5060
- job-name: Up to date versions # => Highest versions allowed by composer config
5161
php-version: '${{ needs.fetch-supported-versions.outputs.php-max }}'
62+
symfony-version: '${{ needs.fetch-supported-versions.outputs.symfony-max }}'
63+
## Fix - behat/gherkin => Avoid issue with behat <-> gherkin packages (See https://github.com/Behat/Gherkin/issues/317)
64+
pkg-extra-constraints: behat/gherkin:~4.12.0
65+
- job-name: Up to date versions - Special case - Symfony 5.4
66+
php-version: '${{ needs.fetch-supported-versions.outputs.php-max }}'
67+
symfony-version: '5.4'
68+
## Fix - behat/gherkin => Avoid issue with behat <-> gherkin packages (See https://github.com/Behat/Gherkin/issues/317)
69+
# Fix - symfony/yaml - Avoid issue with Sf YAML 6.4+ and Framework bundle
70+
pkg-extra-constraints: behat/gherkin:~4.12.0 symfony/yaml:~6.4.0
5271
- job-name: Bare minimum # => Lowest versions allowed by composer config
5372
php-version: '${{ needs.fetch-supported-versions.outputs.php-min }}'
73+
symfony-version: '${{ needs.fetch-supported-versions.outputs.symfony-min }}'
74+
- job-name: Bare minimum - Special case - Symfony 5.4
75+
php-version: '${{ needs.fetch-supported-versions.outputs.php-min }}'
76+
symfony-version: '5.4'
77+
- job-name: Late migration - PHP # => Highest symfony version with lowest php version allowed by composer config
78+
php-version: ${{ ( needs.fetch-supported-versions.outputs.symfony-max == '6.4' && needs.fetch-supported-versions.outputs.php-min == '8.0' ) && '8.1' || needs.fetch-supported-versions.outputs.php-min }} # Fix - Sf 6.4 require php 8.1 minimum !
79+
symfony-version: '${{ needs.fetch-supported-versions.outputs.symfony-max }}'
80+
- job-name: Late migration - Symfony # => Lowest symfony version with highest php version allowed by composer config
81+
php-version: '${{ needs.fetch-supported-versions.outputs.php-max }}'
82+
symfony-version: '${{ needs.fetch-supported-versions.outputs.symfony-min }}'
83+
# Fix - behat/gherkin => Avoid issue with behat <-> gherkin packages (See https://github.com/Behat/Gherkin/issues/317)
84+
pkg-extra-constraints: behat/gherkin:~4.12.0
5485
steps:
5586
- name: Check out code
5687
uses: actions/checkout@v4
@@ -77,16 +108,21 @@ jobs:
77108
id: composer-cache
78109
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
79110

80-
- name: Setup cache for PHP ${{ steps.setup-php.outputs.php-version }}
111+
- name: Setup cache for PHP ${{ steps.setup-php.outputs.php-version }} & Symfony ${{ matrix.symfony-version }}
81112
uses: actions/cache@v4
82113
with:
83114
path: |
84115
${{ steps.composer-cache.outputs.dir }}
85116
# Clear the cache if composer.json (as composer.lock is not available) has been updated
86-
key: tests-php${{ steps.setup-php.outputs.php-version }}-${{ hashFiles('composer.json') }}
117+
key: tests-php${{ steps.setup-php.outputs.php-version }}-sf${{ matrix.symfony-version }}-${{ hashFiles('composer.json') }}
87118

88-
- name: Build with PHP ${{ steps.setup-php.outputs.php-version }}
89-
run: make build
119+
- name: Build with PHP ${{ steps.setup-php.outputs.php-version }} & Symfony ${{ matrix.symfony-version }}
120+
run: |
121+
SF_CONSTRAINT="~${{ matrix.symfony-version }}.0"
122+
composer require -W \
123+
symfony/validator:${SF_CONSTRAINT} \
124+
${{ matrix.pkg-extra-constraints }} \
125+
&& make build
90126
91127
- name: Tests
92128
run: make test-unit && make test-functional
@@ -101,6 +137,7 @@ jobs:
101137
flags: |
102138
unit-tests
103139
php-${{ matrix.php-version }}
140+
sf-${{ matrix.symfony-version }}
104141
path: build/coverage-groups
105142

106143
- name: Create "functional tests" reports group
@@ -115,13 +152,14 @@ jobs:
115152
flags: |
116153
functional-tests
117154
php-${{ matrix.php-version }}
155+
sf-${{ matrix.symfony-version }}
118156
path: build/coverage-groups
119157

120158
- name: Upload coverage reports
121159
if: ${{ env.COVERAGE_TYPE == 'xdebug' }}
122160
uses: actions/upload-artifact@v4
123161
with:
124-
name: coverage-groups-php${{ steps.setup-php.outputs.php-version }}
162+
name: coverage-groups-php${{ steps.setup-php.outputs.php-version }}-sf${{ matrix.symfony-version }}
125163
path: build/coverage-groups
126164
if-no-files-found: error
127165

@@ -133,6 +171,7 @@ jobs:
133171
contents: read
134172
env:
135173
PHP_VERSION: ${{ needs.fetch-supported-versions.outputs.php-max }}
174+
SYMFONY_VERSION: ${{ needs.fetch-supported-versions.outputs.symfony-max }}
136175
steps:
137176
- uses: actions/checkout@v4
138177

@@ -151,16 +190,20 @@ jobs:
151190
id: composer-cache
152191
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
153192

154-
- name: Setup cache for PHP ${{ steps.setup-php.outputs.php-version }}
193+
- name: Setup cache for PHP ${{ steps.setup-php.outputs.php-version }} & Symfony ${{ env.SYMFONY_VERSION }}
155194
uses: actions/cache@v4
156195
with:
157196
path: |
158197
${{ steps.composer-cache.outputs.dir }}
159198
# Clear the cache if composer.json (as composer.lock is not available) has been updated
160-
key: tests-php${{ steps.setup-php.outputs.php-version }}-${{ hashFiles('composer.json') }}
199+
key: tests-php${{ steps.setup-php.outputs.php-version }}-sf${{ env.SYMFONY_VERSION }}-${{ hashFiles('composer.json') }}
161200

162-
- name: Build with PHP ${{ steps.setup-php.outputs.php-version }}
163-
run: make build
201+
- name: Build with PHP ${{ steps.setup-php.outputs.php-version }} & Symfony ${{ env.SYMFONY_VERSION }}
202+
run: |
203+
SF_CONSTRAINT="~${{ env.SYMFONY_VERSION }}.0"
204+
composer require -W \
205+
symfony/validator:${SF_CONSTRAINT} \
206+
&& make build
164207
165208
- name: ComposerRequireChecker
166209
uses: docker://webfactory/composer-require-checker:4.5.0
@@ -170,45 +213,78 @@ jobs:
170213
uses: actions/dependency-review-action@v4
171214

172215
nightly-tests:
173-
name: Nightly
216+
name: Nightly - ${{ matrix.job-name }}
174217
needs: [ fetch-supported-versions, tests ]
175218
if: ${{ github.event_name == 'push' || ( github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'with-nightly-tests') ) }}
176219
runs-on: ubuntu-latest
220+
continue-on-error: true
177221
permissions:
178222
contents: read
179-
continue-on-error: true
180223
env:
181-
PHP_VERSION: ${{ needs.fetch-supported-versions.outputs.php-next }}
182224
COMPOSER_IGNORE_PLATFORM_REQ: 'php+'
225+
strategy:
226+
fail-fast: false
227+
matrix:
228+
include:
229+
- job-name: PHP - With highest supported Symfony versions
230+
php-version: ${{ needs.fetch-supported-versions.outputs.php-next }}
231+
symfony-version: ${{ needs.fetch-supported-versions.outputs.symfony-max }}
232+
# Fix - behat/gherkin => Avoid issue with behat <-> gherkin packages (See https://github.com/Behat/Gherkin/issues/317)
233+
pkg-extra-constraints: behat/gherkin:~4.12.0
234+
- job-name: PHP - With lowest supported Symfony versions
235+
php-version: ${{ needs.fetch-supported-versions.outputs.php-next }}
236+
symfony-version: ${{ needs.fetch-supported-versions.outputs.symfony-min }}
237+
# Fix - behat/gherkin => Avoid issue with behat <-> gherkin packages (See https://github.com/Behat/Gherkin/issues/317)
238+
pkg-extra-constraints: behat/gherkin:~4.12.0
239+
- job-name: Symfony - With highest supported PHP version
240+
php-version: ${{ needs.fetch-supported-versions.outputs.php-max }}
241+
symfony-version: ${{ needs.fetch-supported-versions.outputs.symfony-next }}
242+
# Fix - behat/gherkin => Avoid issue with behat <-> gherkin packages (See https://github.com/Behat/Gherkin/issues/317)
243+
# Fix - symfony/framework-bundle - Framework bundle <7.0 require php 8.1 minimum !
244+
pkg-extra-constraints: behat/gherkin:~4.12.0 ${{ ( needs.fetch-supported-versions.outputs.symfony-next == '7.0' && needs.fetch-supported-versions.outputs.php-max == '8.4' ) && 'symfony/framework-bundle:~7.0.0@dev' || '' }}
245+
- job-name: Symfony - With lowest supported PHP version
246+
# Fix - Sf 7.0 require php 8.1 minimum, most of deps require 8.2 !
247+
php-version: ${{ ( needs.fetch-supported-versions.outputs.symfony-next == '7.0' && needs.fetch-supported-versions.outputs.php-min == '8.0' ) && '8.2' || needs.fetch-supported-versions.outputs.php-min }}
248+
symfony-version: ${{ needs.fetch-supported-versions.outputs.symfony-next }}
249+
# Fix - behat/gherkin => Avoid issue with behat <-> gherkin packages (See https://github.com/Behat/Gherkin/issues/317)
250+
# Fix - symfony/framework-bundle - Framework bundle <7.0 require php 8.1 minimum !
251+
pkg-extra-constraints: behat/gherkin:~4.12.0 ${{ ( needs.fetch-supported-versions.outputs.symfony-next == '7.0' && needs.fetch-supported-versions.outputs.php-min == '8.0' ) && 'symfony/framework-bundle:~7.0.0@dev' || '' }}
252+
183253
steps:
184254
- name: Check out code
185-
uses: actions/checkout@v5
255+
uses: actions/checkout@v4
186256

187-
- name: Setup PHP ${{ env.PHP_VERSION }}
257+
- name: Setup PHP ${{ matrix.php-version }}
188258
id: setup-php
189259
uses: shivammathur/setup-php@v2
190260
env:
191261
update: true # whether to use latest available patch for the version or not
192262
fail-fast: true # step will fail if an extension or tool fails to set up
193263
with:
194-
php-version: ${{ env.PHP_VERSION }}
264+
php-version: ${{ matrix.php-version }}
195265
tools: composer
196266
coverage: none
197267

198268
- name: Get composer cache directory
199269
id: composer-cache
200270
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
201271

202-
- name: Setup cache for PHP ${{ steps.setup-php.outputs.php-version }}
272+
- name: Setup cache for PHP ${{ steps.setup-php.outputs.php-version }} & Symfony ${{ matrix.symfony-version }}
203273
uses: actions/cache@v4
204274
with:
205275
path: |
206276
${{ steps.composer-cache.outputs.dir }}
207277
# Clear the cache if composer.json (as composer.lock is not available) has been updated
208-
key: tests-php${{ steps.setup-php.outputs.php-version }}-${{ hashFiles('composer.json') }}
278+
key: tests-php${{ steps.setup-php.outputs.php-version }}-sf${{ matrix.symfony-version }}-${{ hashFiles('composer.json') }}
209279

210-
- name: Build with PHP ${{ steps.setup-php.outputs.php-version }}
211-
run: make build
280+
- name: Build with PHP ${{ steps.setup-php.outputs.php-version }} & Symfony ${{ matrix.symfony-version }}
281+
run: |
282+
SF_CONSTRAINT="~${{ matrix.symfony-version }}.0@dev"
283+
composer config minimum-stability dev \
284+
&& composer require -W \
285+
symfony/validator:${SF_CONSTRAINT} \
286+
${{ matrix.pkg-extra-constraints }} \
287+
&& make build
212288
213289
- name: Test
214290
run: make test-unit && make test-functional
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
{
2-
"php": {"min": "8.0", "max": "8.2", "next": "8.3"}
2+
"php": {"min": "8.0", "max": "8.2", "next": "8.3"},
3+
"symfony": {"min": "4.4", "max": "6.0", "next": "6.3"}
34
}

0 commit comments

Comments
 (0)