Skip to content

Commit d93ba9f

Browse files
committed
Improve CI
1 parent 44b3ae8 commit d93ba9f

File tree

2 files changed

+55
-60
lines changed

2 files changed

+55
-60
lines changed

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

Lines changed: 51 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -2,49 +2,39 @@ name: 'CI reusable workflow'
22

33
on:
44
workflow_call:
5-
inputs:
6-
# >>>> Dummy env-inputs
7-
# Goal here is just to have access to variable values
8-
# in order to build job matrix as `env` variable is not available there
9-
php-min-version:
10-
default: '8.0'
11-
description: Lowest PHP version to assess (e.g Lowest supported version including security support)
12-
required: false
13-
type: string
14-
php-max-version:
15-
default: '8.4'
16-
description: Highest PHP version to assess (e.g Highest supported version)
17-
required: false
18-
type: string
19-
php-next-version:
20-
default: '8.5'
21-
description: Next (currently not supported) PHP version to assess (e.g Current dev version)
22-
required: false
23-
type: string
24-
symfony-min-version:
25-
default: '4.4'
26-
description: Lowest Symfony version to assess (e.g Lowest supported version - usually LTS including security support)
27-
required: false
28-
type: string
29-
symfony-max-version:
30-
default: '6.4'
31-
description: Highest Symfony version to assess (e.g Highest supported version)
32-
required: false
33-
type: string
34-
symfony-next-version:
35-
default: '7.0'
36-
description: Next (currently not supported) Symfony version to assess (e.g Current dev version)
37-
required: false
38-
type: string
39-
# <<<< Dummy env-inputs
405

416
env:
427
COMPOSER_PREFER_STABLE: '1'
438
TEST_OUTPUT_STYLE: pretty
449

4510
jobs:
11+
fetch-supported-versions:
12+
name: Fetch supported versions
13+
runs-on: ubuntu-latest
14+
outputs:
15+
php-min: ${{ steps.fetch-php-versions.outputs.min }}
16+
php-max: ${{ steps.fetch-php-versions.outputs.max }}
17+
php-next: ${{ steps.fetch-php-versions.outputs.next }}
18+
symfony-min: ${{ steps.fetch-symfony-versions.outputs.min }}
19+
symfony-max: ${{ steps.fetch-symfony-versions.outputs.max }}
20+
symfony-next: ${{ steps.fetch-symfony-versions.outputs.next }}
21+
steps:
22+
- name: Fetch PHP supported versions
23+
id: fetch-php-versions
24+
uses: yoanm/gha-supported-versions-parser@feature/init
25+
with:
26+
dependency: php
27+
path: .github/workflows/supported-versions.json
28+
- name: Fetch Symfony supported versions
29+
id: fetch-symfony-versions
30+
uses: yoanm/gha-supported-versions-parser@feature/init
31+
with:
32+
dependency: symfony
33+
path: .github/workflows/supported-versions.json
34+
4635
tests:
4736
name: ${{ matrix.job-name }}
37+
needs: [fetch-supported-versions]
4838
runs-on: ubuntu-latest
4939
env:
5040
COVERAGE_TYPE: none
@@ -54,28 +44,28 @@ jobs:
5444
matrix:
5545
include:
5646
- job-name: Up to date versions # => Highest versions allowed by composer config
57-
php-version: '${{ inputs.php-max-version }}'
58-
symfony-version: '${{ inputs.symfony-max-version }}'
47+
php-version: '${{ needs.fetch-supported-versions.outputs.php-max }}'
48+
symfony-version: '${{ needs.fetch-supported-versions.outputs.symfony-max }}'
5949
## Fix - behat/gherkin => Avoid issue with behat <-> gherkin packages (See https://github.com/Behat/Gherkin/issues/317)
6050
pkg-extra-constraints: behat/gherkin:~4.12.0
6151
- job-name: Up to date versions - Special case - Symfony 5.4
62-
php-version: '${{ inputs.php-max-version }}'
52+
php-version: '${{ needs.fetch-supported-versions.outputs.php-max }}'
6353
symfony-version: '5.4'
6454
## Fix - behat/gherkin => Avoid issue with behat <-> gherkin packages (See https://github.com/Behat/Gherkin/issues/317)
6555
# Fix - symfony/yaml - Avoid issue with Sf YAML 6.4+ and Framework bundle
6656
pkg-extra-constraints: behat/gherkin:~4.12.0 symfony/yaml:~6.4.0
6757
- job-name: Bare minimum # => Lowest versions allowed by composer config
68-
php-version: '${{ inputs.php-min-version }}'
69-
symfony-version: '${{ inputs.symfony-min-version }}'
58+
php-version: '${{ needs.fetch-supported-versions.outputs.php-min }}'
59+
symfony-version: '${{ needs.fetch-supported-versions.outputs.symfony-min }}'
7060
- job-name: Bare minimum - Special case - Symfony 5.4
71-
php-version: '${{ inputs.php-min-version }}'
61+
php-version: '${{ needs.fetch-supported-versions.outputs.php-min }}'
7262
symfony-version: '5.4'
7363
- job-name: Late migration - PHP # => Highest symfony version with lowest php version allowed by composer config
74-
php-version: ${{ ( inputs.symfony-max-version == '6.4' && inputs.php-min-version == '8.0' ) && '8.1' || inputs.php-min-version }} # Fix - Sf 6.4 require php 8.1 minimum !
75-
symfony-version: '${{ inputs.symfony-max-version }}'
64+
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 !
65+
symfony-version: '${{ needs.fetch-supported-versions.outputs.symfony-max }}'
7666
- job-name: Late migration - Symfony # => Lowest symfony version with highest php version allowed by composer config
77-
php-version: '${{ inputs.php-max-version }}'
78-
symfony-version: '${{ inputs.symfony-min-version }}'
67+
php-version: '${{ needs.fetch-supported-versions.outputs.php-max }}'
68+
symfony-version: '${{ needs.fetch-supported-versions.outputs.symfony-min }}'
7969
# Fix - behat/gherkin => Avoid issue with behat <-> gherkin packages (See https://github.com/Behat/Gherkin/issues/317)
8070
pkg-extra-constraints: behat/gherkin:~4.12.0
8171
steps:
@@ -85,7 +75,7 @@ jobs:
8575
# Enable coverage only for specific version(s) !
8676
# Usually highest version(s), plus additional ones in case of code used only with specific versions
8777
- name: Enable coverage
88-
if: ${{ matrix.php-version == inputs.php-max-version }}
78+
if: ${{ matrix.php-version == needs.fetch-supported-versions.outputs.php-max }}
8979
run: |
9080
echo "COVERAGE_TYPE=xdebug" >> $GITHUB_ENV
9181
@@ -165,10 +155,11 @@ jobs:
165155

166156
static-checks:
167157
name: Static analysis
158+
needs: [fetch-supported-versions]
168159
runs-on: ubuntu-latest
169160
env:
170-
PHP_VERSION: ${{ inputs.php-max-version }}
171-
SYMFONY_VERSION: ${{ inputs.symfony-max-version }}
161+
PHP_VERSION: ${{ needs.fetch-supported-versions.outputs.php-max }}
162+
SYMFONY_VERSION: ${{ needs.fetch-supported-versions.outputs.symfony-max }}
172163
steps:
173164
- uses: actions/checkout@v5
174165

@@ -215,38 +206,38 @@ jobs:
215206

216207
nightly-tests:
217208
name: Nightly - ${{ matrix.job-name }}
209+
needs: [ fetch-supported-versions, tests ]
218210
runs-on: ubuntu-latest
211+
continue-on-error: true
219212
env:
220213
COMPOSER_IGNORE_PLATFORM_REQ: 'php+'
221-
continue-on-error: true
222-
needs: [ tests ]
223214
strategy:
224215
fail-fast: false
225216
matrix:
226217
include:
227218
- job-name: PHP - With highest supported Symfony versions
228-
php-version: ${{ inputs.php-next-version }}
229-
symfony-version: ${{ inputs.symfony-max-version }}
219+
php-version: ${{ needs.fetch-supported-versions.outputs.php-next }}
220+
symfony-version: ${{ needs.fetch-supported-versions.outputs.symfony-max }}
230221
# Fix - behat/gherkin => Avoid issue with behat <-> gherkin packages (See https://github.com/Behat/Gherkin/issues/317)
231222
pkg-extra-constraints: behat/gherkin:~4.12.0
232223
- job-name: PHP - With lowest supported Symfony versions
233-
php-version: ${{ inputs.php-next-version }}
234-
symfony-version: ${{ inputs.symfony-min-version }}
224+
php-version: ${{ needs.fetch-supported-versions.outputs.php-next }}
225+
symfony-version: ${{ needs.fetch-supported-versions.outputs.symfony-min }}
235226
# Fix - behat/gherkin => Avoid issue with behat <-> gherkin packages (See https://github.com/Behat/Gherkin/issues/317)
236227
pkg-extra-constraints: behat/gherkin:~4.12.0
237228
- job-name: Symfony - With highest supported PHP version
238-
php-version: ${{ inputs.php-max-version }}
239-
symfony-version: ${{ inputs.symfony-next-version }}
229+
php-version: ${{ needs.fetch-supported-versions.outputs.php-max }}
230+
symfony-version: ${{ needs.fetch-supported-versions.outputs.symfony-next }}
240231
# Fix - behat/gherkin => Avoid issue with behat <-> gherkin packages (See https://github.com/Behat/Gherkin/issues/317)
241232
# Fix - symfony/framework-bundle - Framework bundle <7.0 require php 8.1 minimum !
242-
pkg-extra-constraints: behat/gherkin:~4.12.0 ${{ ( inputs.symfony-next-version == '7.0' && inputs.php-max-version == '8.4' ) && 'symfony/framework-bundle:~7.0.0@dev' || '' }}
233+
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' || '' }}
243234
- job-name: Symfony - With lowest supported PHP version
244235
# Fix - Sf 7.0 require php 8.1 minimum, most of deps require 8.2 !
245-
php-version: ${{ ( inputs.symfony-next-version == '7.0' && inputs.php-min-version == '8.0' ) && '8.2' || inputs.php-min-version }}
246-
symfony-version: ${{ inputs.symfony-next-version }}
236+
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 }}
237+
symfony-version: ${{ needs.fetch-supported-versions.outputs.symfony-next }}
247238
# Fix - behat/gherkin => Avoid issue with behat <-> gherkin packages (See https://github.com/Behat/Gherkin/issues/317)
248239
# Fix - symfony/framework-bundle - Framework bundle <7.0 require php 8.1 minimum !
249-
pkg-extra-constraints: behat/gherkin:~4.12.0 ${{ ( inputs.symfony-next-version == '7.0' && inputs.php-min-version == '8.0' ) && 'symfony/framework-bundle:~7.0.0@dev' || '' }}
240+
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' || '' }}
250241

251242
steps:
252243
- name: Check out code
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"php": {"min": "8.0", "max": "8.4", "next": "8.5"},
3+
"symfony": {"min": "4.4", "max": "6.4", "next": "7.0"}
4+
}

0 commit comments

Comments
 (0)