Skip to content

Commit b226d99

Browse files
committed
Improve CI
1 parent 44b3ae8 commit b226d99

File tree

2 files changed

+51
-58
lines changed

2 files changed

+51
-58
lines changed

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

Lines changed: 47 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -2,47 +2,36 @@ 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 }}
4837
runs-on: ubuntu-latest
@@ -54,28 +43,28 @@ jobs:
5443
matrix:
5544
include:
5645
- 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 }}'
46+
php-version: '${{ needs.fetch-supported-versions.outputs.php-max }}'
47+
symfony-version: '${{ needs.fetch-supported-versions.outputs.symfony-max }}'
5948
## Fix - behat/gherkin => Avoid issue with behat <-> gherkin packages (See https://github.com/Behat/Gherkin/issues/317)
6049
pkg-extra-constraints: behat/gherkin:~4.12.0
6150
- job-name: Up to date versions - Special case - Symfony 5.4
62-
php-version: '${{ inputs.php-max-version }}'
51+
php-version: '${{ needs.fetch-supported-versions.outputs.php-max }}'
6352
symfony-version: '5.4'
6453
## Fix - behat/gherkin => Avoid issue with behat <-> gherkin packages (See https://github.com/Behat/Gherkin/issues/317)
6554
# Fix - symfony/yaml - Avoid issue with Sf YAML 6.4+ and Framework bundle
6655
pkg-extra-constraints: behat/gherkin:~4.12.0 symfony/yaml:~6.4.0
6756
- job-name: Bare minimum # => Lowest versions allowed by composer config
68-
php-version: '${{ inputs.php-min-version }}'
69-
symfony-version: '${{ inputs.symfony-min-version }}'
57+
php-version: '${{ needs.fetch-supported-versions.outputs.php-min }}'
58+
symfony-version: '${{ needs.fetch-supported-versions.outputs.symfony-min }}'
7059
- job-name: Bare minimum - Special case - Symfony 5.4
71-
php-version: '${{ inputs.php-min-version }}'
60+
php-version: '${{ needs.fetch-supported-versions.outputs.php-min }}'
7261
symfony-version: '5.4'
7362
- 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 }}'
63+
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 !
64+
symfony-version: '${{ needs.fetch-supported-versions.outputs.symfony-max }}'
7665
- 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 }}'
66+
php-version: '${{ needs.fetch-supported-versions.outputs.php-max }}'
67+
symfony-version: '${{ needs.fetch-supported-versions.outputs.symfony-min }}'
7968
# Fix - behat/gherkin => Avoid issue with behat <-> gherkin packages (See https://github.com/Behat/Gherkin/issues/317)
8069
pkg-extra-constraints: behat/gherkin:~4.12.0
8170
steps:
@@ -85,7 +74,7 @@ jobs:
8574
# Enable coverage only for specific version(s) !
8675
# Usually highest version(s), plus additional ones in case of code used only with specific versions
8776
- name: Enable coverage
88-
if: ${{ matrix.php-version == inputs.php-max-version }}
77+
if: ${{ matrix.php-version == needs.fetch-supported-versions.outputs.php-max }}
8978
run: |
9079
echo "COVERAGE_TYPE=xdebug" >> $GITHUB_ENV
9180
@@ -167,8 +156,8 @@ jobs:
167156
name: Static analysis
168157
runs-on: ubuntu-latest
169158
env:
170-
PHP_VERSION: ${{ inputs.php-max-version }}
171-
SYMFONY_VERSION: ${{ inputs.symfony-max-version }}
159+
PHP_VERSION: ${{ needs.fetch-supported-versions.outputs.php-max }}
160+
SYMFONY_VERSION: ${{ needs.fetch-supported-versions.outputs.symfony-max }}
172161
steps:
173162
- uses: actions/checkout@v5
174163

@@ -225,28 +214,28 @@ jobs:
225214
matrix:
226215
include:
227216
- job-name: PHP - With highest supported Symfony versions
228-
php-version: ${{ inputs.php-next-version }}
229-
symfony-version: ${{ inputs.symfony-max-version }}
217+
php-version: ${{ needs.fetch-supported-versions.outputs.php-next }}
218+
symfony-version: ${{ needs.fetch-supported-versions.outputs.symfony-max }}
230219
# Fix - behat/gherkin => Avoid issue with behat <-> gherkin packages (See https://github.com/Behat/Gherkin/issues/317)
231220
pkg-extra-constraints: behat/gherkin:~4.12.0
232221
- job-name: PHP - With lowest supported Symfony versions
233-
php-version: ${{ inputs.php-next-version }}
234-
symfony-version: ${{ inputs.symfony-min-version }}
222+
php-version: ${{ needs.fetch-supported-versions.outputs.php-next }}
223+
symfony-version: ${{ needs.fetch-supported-versions.outputs.symfony-min }}
235224
# Fix - behat/gherkin => Avoid issue with behat <-> gherkin packages (See https://github.com/Behat/Gherkin/issues/317)
236225
pkg-extra-constraints: behat/gherkin:~4.12.0
237226
- job-name: Symfony - With highest supported PHP version
238-
php-version: ${{ inputs.php-max-version }}
239-
symfony-version: ${{ inputs.symfony-next-version }}
227+
php-version: ${{ needs.fetch-supported-versions.outputs.php-max }}
228+
symfony-version: ${{ needs.fetch-supported-versions.outputs.symfony-next }}
240229
# Fix - behat/gherkin => Avoid issue with behat <-> gherkin packages (See https://github.com/Behat/Gherkin/issues/317)
241230
# 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' || '' }}
231+
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' || '' }}
243232
- job-name: Symfony - With lowest supported PHP version
244233
# 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 }}
234+
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 }}
235+
symfony-version: ${{ needs.fetch-supported-versions.outputs.symfony-next }}
247236
# Fix - behat/gherkin => Avoid issue with behat <-> gherkin packages (See https://github.com/Behat/Gherkin/issues/317)
248237
# 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' || '' }}
238+
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' || '' }}
250239

251240
steps:
252241
- 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)