From a4a05c3f62d4be1094a20ba12b227cfbff4096b2 Mon Sep 17 00:00:00 2001 From: Yoanm <4410697+yoanm@users.noreply.github.com> Date: Sun, 31 Aug 2025 07:23:14 +0200 Subject: [PATCH 1/8] Improve CI --- .github/workflows/reusable-CI-workflow.yml | 60 ++++++++++++---------- .github/workflows/supported-versions.json | 7 +++ 2 files changed, 40 insertions(+), 27 deletions(-) create mode 100644 .github/workflows/supported-versions.json diff --git a/.github/workflows/reusable-CI-workflow.yml b/.github/workflows/reusable-CI-workflow.yml index 28f5b06e..8dcd27db 100644 --- a/.github/workflows/reusable-CI-workflow.yml +++ b/.github/workflows/reusable-CI-workflow.yml @@ -2,34 +2,39 @@ name: 'CI reusable workflow' on: workflow_call: - inputs: - # >>>> Dummy env-inputs - # Goal here is just to have access to variable values - # in order to build job matrix as `env` variable is not available there - php-min-version: - default: '8.0' - description: Lowest PHP version to assess (e.g Lowest supported version including security support) - required: false - type: string - php-max-version: - default: '8.4' - description: Highest PHP version to assess (e.g Highest supported version) - required: false - type: string - php-next-version: - default: '8.5' - description: Next (currently not supported) PHP version to assess (e.g Current dev version) - required: false - type: string - # <<<< Dummy env-inputs env: COMPOSER_PREFER_STABLE: '1' TEST_OUTPUT_STYLE: pretty jobs: + fetch-supported-versions: + name: Fetch supported versions + env: + VERSIONS_FILEPATH: .github/workflows/supported-versions.json + outputs: + php-min-version: ${{ steps.parse-versions.outputs.php-min-version }} + php-max-version: ${{ steps.parse-versions.outputs.php-max-version }} + php-next-version: ${{ steps.parse-versions.outputs.php-next-version }} + runs-on: ubuntu-latest + steps: + - name: Check out supported version file + uses: actions/checkout@v5 + with: + sparse-checkout: ${{ env.VERSIONS_FILEPATH }} + sparse-checkout-cone-mode: false + - name: Parse versions + id: parse-versions + run: | + # Lowest PHP version to assess (e.g Lowest supported version including security support) + echo "php-min-version=$( jq -r '.php.min' ${{ env.VERSIONS_FILEPATH }} )" >> $GITHUB_OUTPUT + # Highest PHP version to assess (e.g Highest supported version) + echo "php-max-version=$( jq -r '.php.max' ${{ env.VERSIONS_FILEPATH }} )" >> $GITHUB_OUTPUT + # Next (currently not supported) PHP version to assess (e.g Current dev version) + echo "php-next-version=$( jq -r '.php.next' ${{ env.VERSIONS_FILEPATH }} )" >> $GITHUB_OUTPUT tests: name: ${{ matrix.job-name }} + needs: [fetch-supported-versions] runs-on: ubuntu-latest env: COVERAGE_TYPE: none @@ -39,9 +44,9 @@ jobs: matrix: include: - job-name: Up to date versions # => Highest versions allowed by composer config - php-version: '${{ inputs.php-max-version }}' + php-version: '${{ needs.fetch-supported-versions.outputs.php-max-version }}' - job-name: Bare minimum # => Lowest versions allowed by composer config - php-version: '${{ inputs.php-min-version }}' + php-version: '${{ needs.fetch-supported-versions.outputs.php-min-version }}' steps: - name: Check out code uses: actions/checkout@v5 @@ -49,7 +54,7 @@ jobs: # Enable coverage only for specific version(s) ! # Usually highest version(s), plus additional ones in case of code used only with specific versions - name: Enable coverage - if: ${{ matrix.php-version == inputs.php-max-version }} + if: ${{ matrix.php-version == needs.fetch-supported-versions.outputs.php-max-version }} run: | echo "COVERAGE_TYPE=xdebug" >> $GITHUB_ENV @@ -118,9 +123,10 @@ jobs: static-checks: name: Static analysis + needs: [fetch-supported-versions] runs-on: ubuntu-latest env: - PHP_VERSION: ${{ inputs.php-max-version }} + PHP_VERSION: ${{ needs.fetch-supported-versions.outputs.php-max-version }} steps: - uses: actions/checkout@v5 @@ -159,12 +165,12 @@ jobs: nightly-tests: name: Nightly + needs: [ fetch-supported-versions, tests ] runs-on: ubuntu-latest + continue-on-error: true env: - PHP_VERSION: ${{ inputs.php-next-version }} + PHP_VERSION: ${{ needs.fetch-supported-versions.outputs.php-next-version }} COMPOSER_IGNORE_PLATFORM_REQ: 'php+' - continue-on-error: true - needs: [ tests ] steps: - name: Check out code uses: actions/checkout@v5 diff --git a/.github/workflows/supported-versions.json b/.github/workflows/supported-versions.json new file mode 100644 index 00000000..783fcf2d --- /dev/null +++ b/.github/workflows/supported-versions.json @@ -0,0 +1,7 @@ +{ + "php": { + "min": "8.0", + "max": "8.4", + "next": "8.5" + } +} From ef69d2e90a65774200be3ef9ca6afc71594a83d0 Mon Sep 17 00:00:00 2001 From: Yoanm <4410697+yoanm@users.noreply.github.com> Date: Sun, 31 Aug 2025 07:47:47 +0200 Subject: [PATCH 2/8] Improve --- .github/workflows/reusable-CI-workflow.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/reusable-CI-workflow.yml b/.github/workflows/reusable-CI-workflow.yml index 8dcd27db..6bb8dcb9 100644 --- a/.github/workflows/reusable-CI-workflow.yml +++ b/.github/workflows/reusable-CI-workflow.yml @@ -13,9 +13,9 @@ jobs: env: VERSIONS_FILEPATH: .github/workflows/supported-versions.json outputs: - php-min-version: ${{ steps.parse-versions.outputs.php-min-version }} - php-max-version: ${{ steps.parse-versions.outputs.php-max-version }} - php-next-version: ${{ steps.parse-versions.outputs.php-next-version }} + php-min: ${{ steps.parse-versions.outputs.php-min-version }} + php-max: ${{ steps.parse-versions.outputs.php-max-version }} + php-next: ${{ steps.parse-versions.outputs.php-next-version }} runs-on: ubuntu-latest steps: - name: Check out supported version file @@ -44,9 +44,9 @@ jobs: matrix: include: - job-name: Up to date versions # => Highest versions allowed by composer config - php-version: '${{ needs.fetch-supported-versions.outputs.php-max-version }}' + php-version: '${{ needs.fetch-supported-versions.outputs.php-max }}' - job-name: Bare minimum # => Lowest versions allowed by composer config - php-version: '${{ needs.fetch-supported-versions.outputs.php-min-version }}' + php-version: '${{ needs.fetch-supported-versions.outputs.php-min }}' steps: - name: Check out code uses: actions/checkout@v5 @@ -54,7 +54,7 @@ jobs: # Enable coverage only for specific version(s) ! # Usually highest version(s), plus additional ones in case of code used only with specific versions - name: Enable coverage - if: ${{ matrix.php-version == needs.fetch-supported-versions.outputs.php-max-version }} + if: ${{ matrix.php-version == needs.fetch-supported-versions.outputs.php-max }} run: | echo "COVERAGE_TYPE=xdebug" >> $GITHUB_ENV @@ -126,7 +126,7 @@ jobs: needs: [fetch-supported-versions] runs-on: ubuntu-latest env: - PHP_VERSION: ${{ needs.fetch-supported-versions.outputs.php-max-version }} + PHP_VERSION: ${{ needs.fetch-supported-versions.outputs.php-max }} steps: - uses: actions/checkout@v5 @@ -169,7 +169,7 @@ jobs: runs-on: ubuntu-latest continue-on-error: true env: - PHP_VERSION: ${{ needs.fetch-supported-versions.outputs.php-next-version }} + PHP_VERSION: ${{ needs.fetch-supported-versions.outputs.php-next }} COMPOSER_IGNORE_PLATFORM_REQ: 'php+' steps: - name: Check out code From 02865b56e0cb0187f942f509f7bf5d0d087538cb Mon Sep 17 00:00:00 2001 From: Yoanm <4410697+yoanm@users.noreply.github.com> Date: Sun, 31 Aug 2025 08:28:47 +0200 Subject: [PATCH 3/8] Improve --- .../supported-versions-parser/action.yml | 59 +++++++++++++++++++ .github/workflows/reusable-CI-workflow.yml | 32 +++++----- .github/workflows/supported-versions.json | 6 +- 3 files changed, 77 insertions(+), 20 deletions(-) create mode 100644 .github/actions/supported-versions-parser/action.yml diff --git a/.github/actions/supported-versions-parser/action.yml b/.github/actions/supported-versions-parser/action.yml new file mode 100644 index 00000000..58224f52 --- /dev/null +++ b/.github/actions/supported-versions-parser/action.yml @@ -0,0 +1,59 @@ +name: gha-supported-versions-parser +description: | + @TODO +#branding: # @TODO +# icon: tag +# color: yellow + +inputs: + dependency: + description: Dependency name to fetch + required: true + path: + description: Path to the supported versions file + required: true + +outputs: + min: + description: Minimal version configured for the given dependency + value: ${{ steps.parse-versions.outputs.min }} + max: + description: Maximal version configured for the given dependency + value: ${{ steps.parse-versions.outputs.max }} + next: + description: Next version configured for the given dependency + value: ${{ steps.parse-versions.outputs.next }} + +runs: + using: composite + steps: + # Even if an input is marked as "required", empty/no value may be passed ! + - shell: bash + run: | + # Validate provided inputs ... + + if [[ -z "${{ inputs.dependency }}" ]]; then + echo '::error::You must provide a dependency !' + exit 1 + elif [[ -z "${{ inputs.path }}" ]]; then + echo '::error::You must provide a path !' + exit 1 + fi + + - id: parse-versions + shell: bash + run: | + # Parse ${{ inputs.dependency }} versions ... + + # Lowest version to assess (e.g Lowest supported version including security support) + MIN=$( jq -r '.${{ inputs.dependency }}.min' ${{ inputs.path }} ) + echo "Min ${{ inputs.dependency }} version: $MIN" + echo "min=$MIN" >> $GITHUB_OUTPUT + # Highest version to assess (e.g Highest supported version) + MAX=$( jq -r '.${{ inputs.dependency }}.max' ${{ inputs.path }} ) + echo "Max ${{ inputs.dependency }} version: $MAX" + echo "max=$MAX" >> $GITHUB_OUTPUT + # Next (currently not supported) version to assess (e.g Current dev version) + NEXT=$( jq -r '.${{ inputs.dependency }}.next' ${{ inputs.path }} ) + echo "Next ${{ inputs.dependency }} version: $NEXT" + echo "next=$NEXT" >> $GITHUB_OUTPUT diff --git a/.github/workflows/reusable-CI-workflow.yml b/.github/workflows/reusable-CI-workflow.yml index 6bb8dcb9..e5dab913 100644 --- a/.github/workflows/reusable-CI-workflow.yml +++ b/.github/workflows/reusable-CI-workflow.yml @@ -10,28 +10,30 @@ env: jobs: fetch-supported-versions: name: Fetch supported versions + runs-on: ubuntu-latest env: VERSIONS_FILEPATH: .github/workflows/supported-versions.json outputs: - php-min: ${{ steps.parse-versions.outputs.php-min-version }} - php-max: ${{ steps.parse-versions.outputs.php-max-version }} - php-next: ${{ steps.parse-versions.outputs.php-next-version }} - runs-on: ubuntu-latest + php-min: ${{ steps.parse-php-versions.outputs.min }} + php-max: ${{ steps.parse-php-versions.outputs.max }} + php-next: ${{ steps.parse-php-versions.outputs.next }} steps: + + # @TODO Remove the following step and uncomment the next one (only there for local action usage!) - name: Check out supported version file uses: actions/checkout@v5 + #- name: Check out supported version file (only) + # uses: actions/checkout@v5 + # with: + # sparse-checkout: ${{ env.VERSIONS_FILEPATH }} + # sparse-checkout-cone-mode: false + + - name: Fetch versions + id: parse-php-versions + uses: ./.github/actions/supported-versions-parser with: - sparse-checkout: ${{ env.VERSIONS_FILEPATH }} - sparse-checkout-cone-mode: false - - name: Parse versions - id: parse-versions - run: | - # Lowest PHP version to assess (e.g Lowest supported version including security support) - echo "php-min-version=$( jq -r '.php.min' ${{ env.VERSIONS_FILEPATH }} )" >> $GITHUB_OUTPUT - # Highest PHP version to assess (e.g Highest supported version) - echo "php-max-version=$( jq -r '.php.max' ${{ env.VERSIONS_FILEPATH }} )" >> $GITHUB_OUTPUT - # Next (currently not supported) PHP version to assess (e.g Current dev version) - echo "php-next-version=$( jq -r '.php.next' ${{ env.VERSIONS_FILEPATH }} )" >> $GITHUB_OUTPUT + dependency: php + path: ${{ env.VERSIONS_FILEPATH }} tests: name: ${{ matrix.job-name }} needs: [fetch-supported-versions] diff --git a/.github/workflows/supported-versions.json b/.github/workflows/supported-versions.json index 783fcf2d..820915d7 100644 --- a/.github/workflows/supported-versions.json +++ b/.github/workflows/supported-versions.json @@ -1,7 +1,3 @@ { - "php": { - "min": "8.0", - "max": "8.4", - "next": "8.5" - } + "php": {"min": "8.0", "max": "8.4", "next": "8.5"} } From 27fd35cf7f7abdbc3ce18062fd8c87aa32015e7f Mon Sep 17 00:00:00 2001 From: Yoanm <4410697+yoanm@users.noreply.github.com> Date: Sun, 31 Aug 2025 09:15:38 +0200 Subject: [PATCH 4/8] Improve --- .../supported-versions-parser/action.yml | 59 ------------------- .github/workflows/reusable-CI-workflow.yml | 26 ++++---- 2 files changed, 11 insertions(+), 74 deletions(-) delete mode 100644 .github/actions/supported-versions-parser/action.yml diff --git a/.github/actions/supported-versions-parser/action.yml b/.github/actions/supported-versions-parser/action.yml deleted file mode 100644 index 58224f52..00000000 --- a/.github/actions/supported-versions-parser/action.yml +++ /dev/null @@ -1,59 +0,0 @@ -name: gha-supported-versions-parser -description: | - @TODO -#branding: # @TODO -# icon: tag -# color: yellow - -inputs: - dependency: - description: Dependency name to fetch - required: true - path: - description: Path to the supported versions file - required: true - -outputs: - min: - description: Minimal version configured for the given dependency - value: ${{ steps.parse-versions.outputs.min }} - max: - description: Maximal version configured for the given dependency - value: ${{ steps.parse-versions.outputs.max }} - next: - description: Next version configured for the given dependency - value: ${{ steps.parse-versions.outputs.next }} - -runs: - using: composite - steps: - # Even if an input is marked as "required", empty/no value may be passed ! - - shell: bash - run: | - # Validate provided inputs ... - - if [[ -z "${{ inputs.dependency }}" ]]; then - echo '::error::You must provide a dependency !' - exit 1 - elif [[ -z "${{ inputs.path }}" ]]; then - echo '::error::You must provide a path !' - exit 1 - fi - - - id: parse-versions - shell: bash - run: | - # Parse ${{ inputs.dependency }} versions ... - - # Lowest version to assess (e.g Lowest supported version including security support) - MIN=$( jq -r '.${{ inputs.dependency }}.min' ${{ inputs.path }} ) - echo "Min ${{ inputs.dependency }} version: $MIN" - echo "min=$MIN" >> $GITHUB_OUTPUT - # Highest version to assess (e.g Highest supported version) - MAX=$( jq -r '.${{ inputs.dependency }}.max' ${{ inputs.path }} ) - echo "Max ${{ inputs.dependency }} version: $MAX" - echo "max=$MAX" >> $GITHUB_OUTPUT - # Next (currently not supported) version to assess (e.g Current dev version) - NEXT=$( jq -r '.${{ inputs.dependency }}.next' ${{ inputs.path }} ) - echo "Next ${{ inputs.dependency }} version: $NEXT" - echo "next=$NEXT" >> $GITHUB_OUTPUT diff --git a/.github/workflows/reusable-CI-workflow.yml b/.github/workflows/reusable-CI-workflow.yml index e5dab913..90b67548 100644 --- a/.github/workflows/reusable-CI-workflow.yml +++ b/.github/workflows/reusable-CI-workflow.yml @@ -14,23 +14,19 @@ jobs: env: VERSIONS_FILEPATH: .github/workflows/supported-versions.json outputs: - php-min: ${{ steps.parse-php-versions.outputs.min }} - php-max: ${{ steps.parse-php-versions.outputs.max }} - php-next: ${{ steps.parse-php-versions.outputs.next }} + php-min: ${{ steps.fetch-php-versions.outputs.min }} + php-max: ${{ steps.fetch-php-versions.outputs.max }} + php-next: ${{ steps.fetch-php-versions.outputs.next }} steps: - - # @TODO Remove the following step and uncomment the next one (only there for local action usage!) - - name: Check out supported version file + - name: Check out supported version file (only) uses: actions/checkout@v5 - #- name: Check out supported version file (only) - # uses: actions/checkout@v5 - # with: - # sparse-checkout: ${{ env.VERSIONS_FILEPATH }} - # sparse-checkout-cone-mode: false - - - name: Fetch versions - id: parse-php-versions - uses: ./.github/actions/supported-versions-parser + with: + sparse-checkout: ${{ env.VERSIONS_FILEPATH }} + sparse-checkout-cone-mode: false + + - name: Fetch PHP supported versions + id: fetch-php-versions + uses: yoanm/gha-supported-versions-parser@feature/init with: dependency: php path: ${{ env.VERSIONS_FILEPATH }} From 1bee49e39510d4bec64f0856b2c280f53dba97d7 Mon Sep 17 00:00:00 2001 From: Yoanm <4410697+yoanm@users.noreply.github.com> Date: Sun, 31 Aug 2025 09:29:24 +0200 Subject: [PATCH 5/8] Try simple curl --- .github/workflows/reusable-CI-workflow.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/reusable-CI-workflow.yml b/.github/workflows/reusable-CI-workflow.yml index 90b67548..3e218250 100644 --- a/.github/workflows/reusable-CI-workflow.yml +++ b/.github/workflows/reusable-CI-workflow.yml @@ -19,17 +19,16 @@ jobs: php-next: ${{ steps.fetch-php-versions.outputs.next }} steps: - name: Check out supported version file (only) - uses: actions/checkout@v5 - with: - sparse-checkout: ${{ env.VERSIONS_FILEPATH }} - sparse-checkout-cone-mode: false + shell: bash + run: | + curl "https://raw.githubusercontent.com/${{ github.repository }}/${{ github.ref }}/${{ env.VERSIONS_FILEPATH }}" > /tmp/supported-versions.json - name: Fetch PHP supported versions id: fetch-php-versions uses: yoanm/gha-supported-versions-parser@feature/init with: dependency: php - path: ${{ env.VERSIONS_FILEPATH }} + path: /tmp/supported-versions.json tests: name: ${{ matrix.job-name }} needs: [fetch-supported-versions] From 58e04391a7c5701dfdd0b0a1845611b327412193 Mon Sep 17 00:00:00 2001 From: Yoanm <4410697+yoanm@users.noreply.github.com> Date: Sun, 31 Aug 2025 09:35:08 +0200 Subject: [PATCH 6/8] Improve --- .github/workflows/reusable-CI-workflow.yml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/.github/workflows/reusable-CI-workflow.yml b/.github/workflows/reusable-CI-workflow.yml index 3e218250..7fa29f14 100644 --- a/.github/workflows/reusable-CI-workflow.yml +++ b/.github/workflows/reusable-CI-workflow.yml @@ -18,17 +18,12 @@ jobs: php-max: ${{ steps.fetch-php-versions.outputs.max }} php-next: ${{ steps.fetch-php-versions.outputs.next }} steps: - - name: Check out supported version file (only) - shell: bash - run: | - curl "https://raw.githubusercontent.com/${{ github.repository }}/${{ github.ref }}/${{ env.VERSIONS_FILEPATH }}" > /tmp/supported-versions.json - - name: Fetch PHP supported versions id: fetch-php-versions uses: yoanm/gha-supported-versions-parser@feature/init with: dependency: php - path: /tmp/supported-versions.json + path: ${{ env.VERSIONS_FILEPATH }} tests: name: ${{ matrix.job-name }} needs: [fetch-supported-versions] From adb83220137257d4a14a6eaa7809cf622dfe98ba Mon Sep 17 00:00:00 2001 From: Yoanm <4410697+yoanm@users.noreply.github.com> Date: Sun, 31 Aug 2025 09:45:50 +0200 Subject: [PATCH 7/8] Polish --- .github/workflows/reusable-CI-workflow.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/reusable-CI-workflow.yml b/.github/workflows/reusable-CI-workflow.yml index 7fa29f14..096e7935 100644 --- a/.github/workflows/reusable-CI-workflow.yml +++ b/.github/workflows/reusable-CI-workflow.yml @@ -11,8 +11,6 @@ jobs: fetch-supported-versions: name: Fetch supported versions runs-on: ubuntu-latest - env: - VERSIONS_FILEPATH: .github/workflows/supported-versions.json outputs: php-min: ${{ steps.fetch-php-versions.outputs.min }} php-max: ${{ steps.fetch-php-versions.outputs.max }} @@ -23,7 +21,8 @@ jobs: uses: yoanm/gha-supported-versions-parser@feature/init with: dependency: php - path: ${{ env.VERSIONS_FILEPATH }} + path: .github/workflows/supported-versions.json + tests: name: ${{ matrix.job-name }} needs: [fetch-supported-versions] From 40bd6fe10b92c59b67fd6d77795dbd1d25ac345f Mon Sep 17 00:00:00 2001 From: Yoanm <4410697+yoanm@users.noreply.github.com> Date: Sun, 31 Aug 2025 15:00:04 +0200 Subject: [PATCH 8/8] Trigger CI