Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: 'CI reusable workflow' | ||
| on: | ||
| workflow_call: | ||
| permissions: | ||
| contents: read | ||
| env: | ||
| COMPOSER_PREFER_STABLE: '1' | ||
| TEST_OUTPUT_STYLE: pretty | ||
| SUPPORTED_VERSIONS_FILE_PATH: .github/workflows/supported-versions.json | ||
| jobs: | ||
| fetch-supported-versions: | ||
| name: Fetch supported versions | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| outputs: | ||
| php-min: ${{ steps.fetch-php-versions.outputs.min }} | ||
| php-max: ${{ steps.fetch-php-versions.outputs.max }} | ||
| php-next: ${{ steps.fetch-php-versions.outputs.next }} | ||
| symfony-min: ${{ steps.fetch-symfony-versions.outputs.min }} | ||
| symfony-max: ${{ steps.fetch-symfony-versions.outputs.max }} | ||
| symfony-next: ${{ steps.fetch-symfony-versions.outputs.next }} | ||
| steps: | ||
| - name: Fetch supported versions file | ||
| id: fetch-file | ||
| uses: yoanm/gha-supported-versions-parser/github-downloader@v1 | ||
| with: | ||
| file-path: ${{ env.SUPPORTED_VERSIONS_FILE_PATH }} | ||
| - name: Fetch PHP supported versions | ||
| id: fetch-php-versions | ||
| uses: yoanm/gha-supported-versions-parser@v1 | ||
| with: | ||
| path: ${{ steps.fetch-file.outputs.path }} | ||
| dependency: php | ||
| - name: Fetch Symfony supported versions | ||
| id: fetch-symfony-versions | ||
| uses: yoanm/gha-supported-versions-parser@v1 | ||
| with: | ||
| path: ${{ steps.fetch-file.outputs.path }} | ||
| dependency: symfony | ||
| tests: | ||
| name: PHP ${{ matrix.php-version }} & Sf ${{ matrix.symfony-version }} - ${{ matrix.job-name }} | ||
| needs: [fetch-supported-versions] | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| env: | ||
| COVERAGE_TYPE: none | ||
| COVERAGE_OUTPUT_STYLE: clover | ||
| strategy: | ||
| fail-fast: true | ||
| matrix: | ||
| include: | ||
| - job-name: Up to date versions # => Highest versions allowed by composer config | ||
| php-version: '${{ needs.fetch-supported-versions.outputs.php-max }}' | ||
| symfony-version: '${{ needs.fetch-supported-versions.outputs.symfony-max }}' | ||
| # Fix - behat/gherkin => Avoid issue with behat <-> gherkin packages (See https://github.com/Behat/Gherkin/issues/317) | ||
| # Fix - yoanm/* - TODO - !! REVERT THIS BEFORE MERGE !! (once an actual version is available) | ||
| pkg-extra-constraints: --with 'behat/gherkin:~4.12.0' --with 'yoanm/symfony-jsonrpc-http-server-doc:dev-feature/increase-supported-versions-sf7.0' --with 'yoanm/symfony-jsonrpc-http-server:dev-feature/increase-supported-versions-sf7.0' | ||
| - job-name: Up to date versions - Sf 6.4 case | ||
| php-version: '${{ needs.fetch-supported-versions.outputs.php-max }}' | ||
| symfony-version: '6.4' | ||
| # Fix - behat/gherkin => Avoid issue with behat <-> gherkin packages (See https://github.com/Behat/Gherkin/issues/317) | ||
| pkg-extra-constraints: --with 'behat/gherkin:~4.12.0' | ||
| - job-name: Bare minimum # => Lowest versions allowed by composer config | ||
| php-version: '${{ needs.fetch-supported-versions.outputs.php-min }}' | ||
| symfony-version: '${{ needs.fetch-supported-versions.outputs.symfony-min }}' | ||
| - job-name: Bare minimum - Sf 6.4 case | ||
| # Fix - Sf 6.4 require php 8.1 minimum ! | ||
| php-version: ${{ ( needs.fetch-supported-versions.outputs.php-min == '8.0' ) && '8.1' || needs.fetch-supported-versions.outputs.php-min }} | ||
| symfony-version: '6.4' | ||
| - job-name: Late PHP migration # => Highest symfony version with lowest php version allowed by composer config | ||
| # Fix - Sf 7.0 require php 8.1 minimum, most of deps require 8.2 ! | ||
| php-version: ${{ ( needs.fetch-supported-versions.outputs.symfony-max == '7.0' && needs.fetch-supported-versions.outputs.php-min == '8.0' ) && '8.2' || needs.fetch-supported-versions.outputs.php-min }} | ||
| symfony-version: '${{ needs.fetch-supported-versions.outputs.symfony-max }}' | ||
| # Fix - yoanm/* - TODO - !! REVERT THIS BEFORE MERGE !! (once an actual version is available) | ||
| pkg-extra-constraints: --with 'yoanm/symfony-jsonrpc-http-server-doc:dev-feature/increase-supported-versions-sf7.0' --with 'yoanm/symfony-jsonrpc-http-server:dev-feature/increase-supported-versions-sf7.0' | ||
| - job-name: Late Symfony migration # => Lowest symfony version with highest php version allowed by composer config | ||
| php-version: '${{ needs.fetch-supported-versions.outputs.php-max }}' | ||
| symfony-version: '${{ needs.fetch-supported-versions.outputs.symfony-min }}' | ||
| # Fix - behat/gherkin => Avoid issue with behat <-> gherkin packages (See https://github.com/Behat/Gherkin/issues/317) | ||
| # Fix - symfony/yaml => Avoid issue between symfony/yaml and symfony/framework-bundle (not compatible with some versions due to incomplete function signatures) | ||
| pkg-extra-constraints: --with 'behat/gherkin:~4.12.0' ${{ ( needs.fetch-supported-versions.outputs.symfony-min == '5.4' && needs.fetch-supported-versions.outputs.php-max == '8.4' ) && '--with "symfony/yaml:~6.4.0"' || '' }} | ||
| steps: | ||
| - name: Check out code | ||
| uses: actions/checkout@v5 | ||
| # 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 }} | ||
| run: | | ||
| echo "COVERAGE_TYPE=xdebug" >> $GITHUB_ENV | ||
| - name: Setup PHP ${{ matrix.php-version }} | ||
| id: setup-php | ||
| uses: shivammathur/setup-php@v2 | ||
| env: | ||
| update: true # whether to use latest available patch for the version or not | ||
| fail-fast: true # step will fail if an extension or tool fails to set up | ||
| with: | ||
| php-version: ${{ matrix.php-version }} | ||
| tools: composer | ||
| coverage: ${{ env.COVERAGE_TYPE }} | ||
| - name: Get composer cache directory | ||
| id: composer-cache | ||
| run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | ||
| - name: Setup cache for PHP ${{ steps.setup-php.outputs.php-version }} & Symfony ${{ matrix.symfony-version }} | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: | | ||
| ${{ steps.composer-cache.outputs.dir }} | ||
| # Clear the cache if composer.json (as composer.lock is not available) has been updated | ||
| key: tests-php${{ steps.setup-php.outputs.php-version }}-sf${{ matrix.symfony-version }}-${{ hashFiles('composer.json', env.SUPPORTED_VERSIONS_FILE_PATH) }} | ||
| - name: Build with PHP ${{ steps.setup-php.outputs.php-version }} & Symfony ${{ matrix.symfony-version }} | ||
| run: | | ||
| # Rely on "composer update --with" rather than "composer require" ! | ||
| # => it ensures the tested version is actually allowed by constraints | ||
| # ("composer require" would override those constraints, which may not produce something actually installable by end-user) | ||
| SF_CONSTRAINT="~${{ matrix.symfony-version }}.0" | ||
| composer update --no-install --with-all-dependencies --minimal-changes \ | ||
| --with "symfony/config:${SF_CONSTRAINT}" \ | ||
| --with "symfony/dependency-injection:${SF_CONSTRAINT}" \ | ||
| --with "symfony/http-kernel:${SF_CONSTRAINT}" \ | ||
| ${{ matrix.pkg-extra-constraints }} \ | ||
| && make build | ||
| - name: Tests | ||
| run: make test-unit && make test-functional | ||
| - name: Create "unit tests" reports group | ||
| if: ${{ env.COVERAGE_TYPE == 'xdebug' }} | ||
| uses: yoanm/temp-reports-group-workspace/create-group@v0 | ||
| with: | ||
| name: unit-tests | ||
| format: clover | ||
| files: build/coverage-phpunit/unit.clover | ||
| flags: | | ||
| unit-tests | ||
| php-${{ matrix.php-version }} | ||
| sf-${{ matrix.symfony-version }} | ||
| path: build/coverage-groups | ||
| - name: Create "functional tests" reports group | ||
| if: ${{ env.COVERAGE_TYPE == 'xdebug' }} | ||
| uses: yoanm/temp-reports-group-workspace/create-group@v0 | ||
| with: | ||
| name: functional-tests | ||
| format: clover | ||
| files: | | ||
| build/coverage-phpunit/functional.clover | ||
| build/coverage-behat/clover.xml | ||
| flags: | | ||
| functional-tests | ||
| php-${{ matrix.php-version }} | ||
| sf-${{ matrix.symfony-version }} | ||
| path: build/coverage-groups | ||
| - name: Upload coverage reports | ||
| if: ${{ env.COVERAGE_TYPE == 'xdebug' }} | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: coverage-groups-php${{ steps.setup-php.outputs.php-version }}-sf${{ matrix.symfony-version }} | ||
| path: build/coverage-groups | ||
| if-no-files-found: error | ||
| static-checks: | ||
| name: Static analysis | ||
| needs: [fetch-supported-versions] | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| env: | ||
| PHP_VERSION: ${{ needs.fetch-supported-versions.outputs.php-max }} | ||
| SYMFONY_VERSION: ${{ needs.fetch-supported-versions.outputs.symfony-max }} | ||
| steps: | ||
| - uses: actions/checkout@v5 | ||
| - name: Setup PHP ${{ env.PHP_VERSION }} | ||
| id: setup-php | ||
| uses: shivammathur/setup-php@v2 | ||
| env: | ||
| update: true # Always use latest available patch for the version | ||
| fail-fast: true # step will fail if an extension or tool fails to set up | ||
| with: | ||
| php-version: ${{ env.PHP_VERSION }} | ||
| tools: composer | ||
| coverage: none | ||
| - name: Get composer cache directory | ||
| id: composer-cache | ||
| run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | ||
| - name: Setup cache for PHP ${{ steps.setup-php.outputs.php-version }} & Symfony ${{ env.SYMFONY_VERSION }} | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: | | ||
| ${{ steps.composer-cache.outputs.dir }} | ||
| # Clear the cache if composer.json (as composer.lock is not available) has been updated | ||
| key: tests-php${{ steps.setup-php.outputs.php-version }}-sf${{ env.SYMFONY_VERSION }}-${{ hashFiles('composer.json', env.SUPPORTED_VERSIONS_FILE_PATH) }} | ||
| - name: Build with PHP ${{ steps.setup-php.outputs.php-version }} & Symfony ${{ env.SYMFONY_VERSION }} | ||
| run: | | ||
| # Rely on "composer update --with" rather than "composer require" ! | ||
| # => it ensures the tested version is actually allowed by constraints | ||
| # ("composer require" would override those constraints, which may not produce something actually installable by end-user) | ||
| SF_CONSTRAINT="~${{ env.SYMFONY_VERSION }}.0" | ||
| composer update --no-install --with-all-dependencies --minimal-changes \ | ||
| --with "symfony/config:${SF_CONSTRAINT}" \ | ||
| --with "symfony/dependency-injection:${SF_CONSTRAINT}" \ | ||
| --with "symfony/http-kernel:${SF_CONSTRAINT}" \ | ||
| && make build | ||
| - name: ComposerRequireChecker | ||
| uses: docker://webfactory/composer-require-checker:4.5.0 | ||
| - name: Dependencies check | ||
| if: ${{ github.event_name == 'pull_request' }} | ||
| uses: actions/dependency-review-action@v4 | ||
| nightly-tests: | ||
| name: Nightly - PHP ${{ matrix.php-version }} & Sf ${{ matrix.symfony-version }} - ${{ matrix.job-name }} | ||
| needs: [ fetch-supported-versions, tests ] | ||
| if: ${{ github.event_name == 'push' || ( github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'with-nightly-tests') ) }} | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| continue-on-error: true | ||
| env: | ||
| COMPOSER_IGNORE_PLATFORM_REQ: 'php+' | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| include: | ||
| - job-name: PHP with highest supported Symfony versions | ||
| php-version: ${{ needs.fetch-supported-versions.outputs.php-next }} | ||
| symfony-version: ${{ needs.fetch-supported-versions.outputs.symfony-max }} | ||
| # Fix - behat/gherkin => Avoid issue with behat <-> gherkin packages (See https://github.com/Behat/Gherkin/issues/317) | ||
| # Fix - yoanm/* - TODO - !! REVERT THIS BEFORE MERGE !! (once an actual version is available) | ||
| pkg-extra-constraints: behat/gherkin:~4.12.0 yoanm/symfony-jsonrpc-http-server-doc:dev-feature/increase-supported-versions-sf7.0 yoanm/symfony-jsonrpc-http-server:dev-feature/increase-supported-versions-sf7.0 | ||
| - job-name: PHP with lowest supported Symfony versions | ||
| php-version: ${{ needs.fetch-supported-versions.outputs.php-next }} | ||
| symfony-version: ${{ needs.fetch-supported-versions.outputs.symfony-min }} | ||
| # Fix - behat/gherkin => Avoid issue with behat <-> gherkin packages (See https://github.com/Behat/Gherkin/issues/317) | ||
| # Fix - symfony/yaml => Avoid issue between symfony/yaml and symfony/framework-bundle (not compatible with some versions due to incomplete function signatures) | ||
| pkg-extra-constraints: behat/gherkin:~4.12.0 yoanm/symfony-jsonrpc-http-server-doc:dev-feature/increase-supported-versions-sf7.0 yoanm/symfony-jsonrpc-http-server:dev-feature/increase-supported-versions-sf7.0 ${{ ( needs.fetch-supported-versions.outputs.symfony-min == '5.4' && needs.fetch-supported-versions.outputs.php-next == '8.5' ) && 'symfony/yaml:~6.4.0' || '' }} | ||
| - job-name: Symfony with highest supported PHP version | ||
| php-version: ${{ needs.fetch-supported-versions.outputs.php-max }} | ||
| symfony-version: ${{ needs.fetch-supported-versions.outputs.symfony-next }} | ||
| # Fix - behat/gherkin => Avoid issue with behat <-> gherkin packages (See https://github.com/Behat/Gherkin/issues/317) | ||
| # Fix - symfony/yaml => Avoid issue between symfony/yaml and symfony/framework-bundle (not compatible with some versions due to incomplete function signatures) | ||
| pkg-extra-constraints: behat/gherkin:~4.12.0 yoanm/symfony-jsonrpc-http-server-doc:dev-feature/increase-supported-versions-sf7.0 yoanm/symfony-jsonrpc-http-server:dev-feature/increase-supported-versions-sf7.0 | ||
| - job-name: Symfony with lowest supported PHP version | ||
| # Fix - Sf 7.1 require php 8.2 minimum ! | ||
| php-version: ${{ ( needs.fetch-supported-versions.outputs.symfony-next == '7.1' && needs.fetch-supported-versions.outputs.php-min == '8.0' ) && '8.2' || needs.fetch-supported-versions.outputs.php-min }} | ||
| symfony-version: ${{ needs.fetch-supported-versions.outputs.symfony-next }} | ||
| # Fix - behat/gherkin => Avoid issue with behat <-> gherkin packages (See https://github.com/Behat/Gherkin/issues/317) | ||
| # Fix - yoanm/* - TODO - !! REVERT THIS BEFORE MERGE !! (once an actual version is available) | ||
| pkg-extra-constraints: behat/gherkin:~4.12.0 yoanm/symfony-jsonrpc-http-server-doc:dev-feature/increase-supported-versions-sf7.0 yoanm/symfony-jsonrpc-http-server:dev-feature/increase-supported-versions-sf7.0 | ||
| steps: | ||
| - name: Check out code | ||
| uses: actions/checkout@v5 | ||
| - name: Setup PHP ${{ matrix.php-version }} | ||
| id: setup-php | ||
| uses: shivammathur/setup-php@v2 | ||
| env: | ||
| update: true # whether to use latest available patch for the version or not | ||
| fail-fast: true # step will fail if an extension or tool fails to set up | ||
| with: | ||
| php-version: ${{ matrix.php-version }} | ||
| tools: composer | ||
| coverage: none | ||
| - name: Get composer cache directory | ||
| id: composer-cache | ||
| run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | ||
| - name: Setup cache for PHP ${{ steps.setup-php.outputs.php-version }} & Symfony ${{ matrix.symfony-version }} | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: | | ||
| ${{ steps.composer-cache.outputs.dir }} | ||
| # Clear the cache if composer.json (as composer.lock is not available) has been updated | ||
| key: tests-php${{ steps.setup-php.outputs.php-version }}-sf${{ matrix.symfony-version }}-${{ hashFiles('composer.json', env.SUPPORTED_VERSIONS_FILE_PATH) }} | ||
| - name: Build with PHP ${{ steps.setup-php.outputs.php-version }} & Symfony ${{ matrix.symfony-version }} | ||
| run: | | ||
| # For nightly builds, rely on "composer require" rather than "composer update --with" ! | ||
| # => tested version is likely outside of constraints, in that case "composer update --with" would fail | ||
| SF_CONSTRAINT="~${{ matrix.symfony-version }}.0@dev" | ||
| composer config minimum-stability dev \ | ||
| && composer require --no-install --with-all-dependencies --minimal-changes \ | ||
| symfony/config:${SF_CONSTRAINT} \ | ||
| symfony/dependency-injection:${SF_CONSTRAINT} \ | ||
| symfony/http-kernel:${SF_CONSTRAINT} \ | ||
| ${{ matrix.pkg-extra-constraints }} \ | ||
| && make build | ||
| - name: Test | ||
| run: make test-unit && make test-functional | ||