Skip to content

Commit ca8548f

Browse files
committed
Harmonize CI
1 parent b00264c commit ca8548f

File tree

3 files changed

+45
-24
lines changed

3 files changed

+45
-24
lines changed

.github/workflows/CI.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,23 @@ on: # Build any PRs and main branch changes
77
- opened
88
- synchronize
99
paths-ignore:
10+
# >>> CI Pre-check
1011
# In case of updates to those workflows, they must be pre-checked by `pre-check-CI-updates.yml` rather than this workflow !
1112
# Any updates on those workflows are expected to be restricted to those workflows only ! (no update on code for instance)
1213
- '.github/workflows/pre-check-CI-updates.yml'
1314
- '.github/workflows/reusable-CI-workflow.yml'
1415
- '.github/workflows/reusable-coverage-upload-workflow.yml'
16+
# <<< CI Pre-check
17+
# >>> Irrelevant files (no impact whatsoever on this GHWorkflow)
18+
- '.github/workflows/coverage-upload.yml' # Executed for on master (workflow_run), no impact here
19+
- '.github/workflows/dependabot-PRs.yml' # Executed for dependabot PRs, no impact here
20+
- '**/*.md'
21+
- '**/LICENSE'
22+
- '**/CODEOWNERS'
23+
- '**/.remarkrc*'
24+
- '**/.editorconfig'
25+
- '**/.scrutinizer.yml'
26+
# <<< Irrelevant files
1527
push:
1628
branches: [ master ]
1729
schedule:

.github/workflows/auto-merge-dependabot.yml renamed to .github/workflows/dependabot-PRs.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: PR auto-merge
1+
name: Dependabot PRs
22
on: pull_request
33

44
permissions:
@@ -7,11 +7,12 @@ permissions:
77

88
jobs:
99
dependabot:
10+
name: Auto-merge & Labels
11+
if: github.event.pull_request.user.login == 'dependabot[bot]' && github.repository == 'yoanm/symfony-jsonrpc-http-server-openapi-doc'
1012
runs-on: ubuntu-latest
1113
permissions:
1214
contents: write
1315
pull-requests: write
14-
if: github.event.pull_request.user.login == 'dependabot[bot]' && github.repository == 'yoanm/symfony-jsonrpc-http-server-openapi-doc'
1516
steps:
1617
- name: Dependabot metadata
1718
id: metadata

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

Lines changed: 30 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ jobs:
4545
dependency: symfony
4646

4747
tests:
48-
name: ${{ matrix.job-name }}
48+
name: PHP ${{ matrix.php-version }} & Sf ${{ matrix.symfony-version }} - ${{ matrix.job-name }}
4949
needs: [fetch-supported-versions]
5050
runs-on: ubuntu-latest
5151
permissions:
@@ -61,28 +61,28 @@ jobs:
6161
php-version: '${{ needs.fetch-supported-versions.outputs.php-max }}'
6262
symfony-version: '${{ needs.fetch-supported-versions.outputs.symfony-max }}'
6363
# 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
64+
pkg-extra-constraints: --with 'behat/gherkin:~4.12.0'
65+
- job-name: Up to date versions - Sf 5.4 case
6666
php-version: '${{ needs.fetch-supported-versions.outputs.php-max }}'
6767
symfony-version: '5.4'
6868
# Fix - behat/gherkin => Avoid issue with behat <-> gherkin packages (See https://github.com/Behat/Gherkin/issues/317)
6969
# Fix - symfony/yaml - Avoid issue with Sf YAML 6.4+ and Framework bundle
70-
pkg-extra-constraints: behat/gherkin:~4.12.0 ${{ ( needs.fetch-supported-versions.outputs.symfony-max == '6.4' ) && 'symfony/yaml:~6.4.0' || '' }}
70+
pkg-extra-constraints: --with 'behat/gherkin:~4.12.0' ${{ ( needs.fetch-supported-versions.outputs.symfony-max == '6.4' ) && '--with "symfony/yaml:~6.4.0"' || '' }}
7171
- job-name: Bare minimum # => Lowest versions allowed by composer config
7272
php-version: '${{ needs.fetch-supported-versions.outputs.php-min }}'
7373
symfony-version: '${{ needs.fetch-supported-versions.outputs.symfony-min }}'
74-
- job-name: Bare minimum - Special case - Symfony 5.4
74+
- job-name: Bare minimum - Sf 5.4 case
7575
php-version: '${{ needs.fetch-supported-versions.outputs.php-min }}'
7676
symfony-version: '5.4'
77-
- job-name: Late migration - PHP # => Highest symfony version with lowest php version allowed by composer config
77+
- job-name: Late PHP migration # => Highest symfony version with lowest php version allowed by composer config
7878
# Fix - Sf 6.4 require php 8.1 minimum !
7979
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 }}
8080
symfony-version: '${{ needs.fetch-supported-versions.outputs.symfony-max }}'
81-
- job-name: Late migration - Symfony # => Lowest symfony version with highest php version allowed by composer config
81+
- job-name: Late Symfony migration # => Lowest symfony version with highest php version allowed by composer config
8282
php-version: '${{ needs.fetch-supported-versions.outputs.php-max }}'
8383
symfony-version: '${{ needs.fetch-supported-versions.outputs.symfony-min }}'
8484
# Fix - behat/gherkin => Avoid issue with behat <-> gherkin packages (See https://github.com/Behat/Gherkin/issues/317)
85-
pkg-extra-constraints: behat/gherkin:~4.12.0
85+
pkg-extra-constraints: --with 'behat/gherkin:~4.12.0'
8686
steps:
8787
- name: Check out code
8888
uses: actions/checkout@v5
@@ -119,11 +119,14 @@ jobs:
119119

120120
- name: Build with PHP ${{ steps.setup-php.outputs.php-version }} & Symfony ${{ matrix.symfony-version }}
121121
run: |
122+
# Rely on "composer update --with" rather than "composer require" !
123+
# => it ensures the tested version is actually allowed by constraints
124+
# ("composer require" would override those constraints, which may not produce something actually installable by end-user)
122125
SF_CONSTRAINT="~${{ matrix.symfony-version }}.0"
123-
composer require -W \
124-
symfony/config:${SF_CONSTRAINT} \
125-
symfony/dependency-injection:${SF_CONSTRAINT} \
126-
symfony/http-kernel:${SF_CONSTRAINT} \
126+
composer update --no-install --with-all-dependencies --minimal-changes \
127+
--with "symfony/config:${SF_CONSTRAINT}" \
128+
--with "symfony/dependency-injection:${SF_CONSTRAINT}" \
129+
--with "symfony/http-kernel:${SF_CONSTRAINT}" \
127130
${{ matrix.pkg-extra-constraints }} \
128131
&& make build
129132
@@ -203,11 +206,14 @@ jobs:
203206

204207
- name: Build with PHP ${{ steps.setup-php.outputs.php-version }} & Symfony ${{ env.SYMFONY_VERSION }}
205208
run: |
209+
# Rely on "composer update --with" rather than "composer require" !
210+
# => it ensures the tested version is actually allowed by constraints
211+
# ("composer require" would override those constraints, which may not produce something actually installable by end-user)
206212
SF_CONSTRAINT="~${{ env.SYMFONY_VERSION }}.0"
207-
composer require -W \
208-
symfony/config:${SF_CONSTRAINT} \
209-
symfony/dependency-injection:${SF_CONSTRAINT} \
210-
symfony/http-kernel:${SF_CONSTRAINT} \
213+
composer update --no-install --with-all-dependencies --minimal-changes \
214+
--with "symfony/config:${SF_CONSTRAINT}" \
215+
--with "symfony/dependency-injection:${SF_CONSTRAINT}" \
216+
--with "symfony/http-kernel:${SF_CONSTRAINT}" \
211217
&& make build
212218
213219
- name: ComposerRequireChecker
@@ -218,7 +224,7 @@ jobs:
218224
uses: actions/dependency-review-action@v4
219225

220226
nightly-tests:
221-
name: Nightly - ${{ matrix.job-name }}
227+
name: Nightly - PHP ${{ matrix.php-version }} & Sf ${{ matrix.symfony-version }} - ${{ matrix.job-name }}
222228
needs: [ fetch-supported-versions, tests ]
223229
if: ${{ github.event_name == 'push' || ( github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'with-nightly-tests') ) }}
224230
runs-on: ubuntu-latest
@@ -231,23 +237,23 @@ jobs:
231237
fail-fast: false
232238
matrix:
233239
include:
234-
- job-name: PHP - With highest supported Symfony versions
240+
- job-name: PHP with highest supported Symfony versions
235241
php-version: ${{ needs.fetch-supported-versions.outputs.php-next }}
236242
symfony-version: ${{ needs.fetch-supported-versions.outputs.symfony-max }}
237243
# Fix - behat/gherkin => Avoid issue with behat <-> gherkin packages (See https://github.com/Behat/Gherkin/issues/317)
238244
pkg-extra-constraints: behat/gherkin:~4.12.0
239-
- job-name: PHP - With lowest supported Symfony versions
245+
- job-name: PHP with lowest supported Symfony versions
240246
php-version: ${{ needs.fetch-supported-versions.outputs.php-next }}
241247
symfony-version: ${{ needs.fetch-supported-versions.outputs.symfony-min }}
242248
# Fix - behat/gherkin => Avoid issue with behat <-> gherkin packages (See https://github.com/Behat/Gherkin/issues/317)
243249
pkg-extra-constraints: behat/gherkin:~4.12.0
244-
- job-name: Symfony - With highest supported PHP version
250+
- job-name: Symfony with highest supported PHP version
245251
php-version: ${{ needs.fetch-supported-versions.outputs.php-max }}
246252
symfony-version: ${{ needs.fetch-supported-versions.outputs.symfony-next }}
247253
# Fix - behat/gherkin => Avoid issue with behat <-> gherkin packages (See https://github.com/Behat/Gherkin/issues/317)
248254
# Fix - symfony/framework-bundle - Framework bundle <7.0 require php 8.1 minimum !
249255
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' || '' }}
250-
- job-name: Symfony - With lowest supported PHP version
256+
- job-name: Symfony with lowest supported PHP version
251257
# Fix - Sf 7.0 require php 8.1 minimum, most of deps require 8.2 !
252258
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 }}
253259
symfony-version: ${{ needs.fetch-supported-versions.outputs.symfony-next }}
@@ -284,9 +290,11 @@ jobs:
284290

285291
- name: Build with PHP ${{ steps.setup-php.outputs.php-version }} & Symfony ${{ matrix.symfony-version }}
286292
run: |
293+
# For nightly builds, rely on "composer require" rather than "composer update --with" !
294+
# => tested version is likely outside of constraints, in that case "composer update --with" would fail
287295
SF_CONSTRAINT="~${{ matrix.symfony-version }}.0@dev"
288296
composer config minimum-stability dev \
289-
&& composer require -W \
297+
&& composer require --no-install --with-all-dependencies --minimal-changes \
290298
symfony/config:${SF_CONSTRAINT} \
291299
symfony/dependency-injection:${SF_CONSTRAINT} \
292300
symfony/http-kernel:${SF_CONSTRAINT} \

0 commit comments

Comments
 (0)