|
| 1 | +name: 'Nightly reusable workflow' |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_call: |
| 5 | + inputs: |
| 6 | + ref: |
| 7 | + description: Reference in order to fetch code |
| 8 | + type: string |
| 9 | + required: false |
| 10 | + default: "${{ github.event.workflow_run && github.event.workflow_run.referenced_workflows[0] && github.event.workflow_run.referenced_workflows[0].ref || github.ref }}" |
| 11 | + |
| 12 | +env: |
| 13 | + COMPOSER_PREFER_STABLE: '1' |
| 14 | + TEST_OUTPUT_STYLE: pretty |
| 15 | + |
| 16 | + |
| 17 | +permissions: |
| 18 | + contents: read |
| 19 | + checks: write # For the check run creation ! |
| 20 | + |
| 21 | +jobs: |
| 22 | + fetch-supported-versions: |
| 23 | + name: Fetch supported versions |
| 24 | + runs-on: ubuntu-latest |
| 25 | + permissions: |
| 26 | + contents: read |
| 27 | + checks: write # For the check run creation ! |
| 28 | + outputs: |
| 29 | + php-min: ${{ steps.fetch-php-versions.outputs.min }} |
| 30 | + php-max: ${{ steps.fetch-php-versions.outputs.max }} |
| 31 | + php-next: ${{ steps.fetch-php-versions.outputs.next }} |
| 32 | + symfony-min: ${{ steps.fetch-symfony-versions.outputs.min }} |
| 33 | + symfony-max: ${{ steps.fetch-symfony-versions.outputs.max }} |
| 34 | + symfony-next: ${{ steps.fetch-symfony-versions.outputs.next }} |
| 35 | + steps: |
| 36 | + - name: 'Check run ○' |
| 37 | + uses: yoanm/temp-reports-group-workspace/utils/attach-check-run-to-triggering-workflow@v0 |
| 38 | + with: |
| 39 | + name: 'Fetch supported versions' |
| 40 | + fails-on-triggering-workflow-failure: true |
| 41 | + |
| 42 | + - name: Fetch PHP supported versions |
| 43 | + id: fetch-php-versions |
| 44 | + uses: yoanm/gha-supported-versions-parser@feature/init |
| 45 | + with: |
| 46 | + path: .github/workflows/supported-versions.json |
| 47 | + dependency: php |
| 48 | + ref: "${{ inputs.ref }}" |
| 49 | + |
| 50 | + - name: Fetch Symfony supported versions |
| 51 | + id: fetch-symfony-versions |
| 52 | + uses: yoanm/gha-supported-versions-parser@feature/init |
| 53 | + with: |
| 54 | + path: .github/workflows/supported-versions.json |
| 55 | + dependency: symfony |
| 56 | + ref: "${{ inputs.ref }}" |
| 57 | + |
| 58 | + tests: |
| 59 | + name: ${{ matrix.job-name }} |
| 60 | + needs: [ fetch-supported-versions ] |
| 61 | + runs-on: ubuntu-latest |
| 62 | + continue-on-error: true |
| 63 | + permissions: |
| 64 | + contents: read |
| 65 | + checks: write # For the check run creation ! |
| 66 | + env: |
| 67 | + COMPOSER_IGNORE_PLATFORM_REQ: 'php+' |
| 68 | + strategy: |
| 69 | + fail-fast: false |
| 70 | + matrix: |
| 71 | + include: |
| 72 | + - job-name: PHP - With highest supported Symfony versions |
| 73 | + php-version: ${{ needs.fetch-supported-versions.outputs.php-next }} |
| 74 | + symfony-version: ${{ needs.fetch-supported-versions.outputs.symfony-max }} |
| 75 | + # Fix - behat/gherkin => Avoid issue with behat <-> gherkin packages (See https://github.com/Behat/Gherkin/issues/317) |
| 76 | + pkg-extra-constraints: behat/gherkin:~4.12.0 |
| 77 | + - job-name: PHP - With lowest supported Symfony versions |
| 78 | + php-version: ${{ needs.fetch-supported-versions.outputs.php-next }} |
| 79 | + symfony-version: ${{ needs.fetch-supported-versions.outputs.symfony-min }} |
| 80 | + # Fix - behat/gherkin => Avoid issue with behat <-> gherkin packages (See https://github.com/Behat/Gherkin/issues/317) |
| 81 | + pkg-extra-constraints: behat/gherkin:~4.12.0 |
| 82 | + - job-name: Symfony - With highest supported PHP version |
| 83 | + php-version: ${{ needs.fetch-supported-versions.outputs.php-max }} |
| 84 | + symfony-version: ${{ needs.fetch-supported-versions.outputs.symfony-next }} |
| 85 | + # Fix - behat/gherkin => Avoid issue with behat <-> gherkin packages (See https://github.com/Behat/Gherkin/issues/317) |
| 86 | + # Fix - symfony/framework-bundle - Framework bundle <7.0 require php 8.1 minimum ! |
| 87 | + 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' || '' }} |
| 88 | + - job-name: Symfony - With lowest supported PHP version |
| 89 | + # Fix - Sf 7.0 require php 8.1 minimum, most of deps require 8.2 ! |
| 90 | + 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 }} |
| 91 | + symfony-version: ${{ needs.fetch-supported-versions.outputs.symfony-next }} |
| 92 | + # Fix - behat/gherkin => Avoid issue with behat <-> gherkin packages (See https://github.com/Behat/Gherkin/issues/317) |
| 93 | + # Fix - symfony/framework-bundle - Framework bundle <7.0 require php 8.1 minimum ! |
| 94 | + 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' || '' }} |
| 95 | + |
| 96 | + steps: |
| 97 | + - name: 'Check run ○' |
| 98 | + uses: yoanm/temp-reports-group-workspace/utils/attach-check-run-to-triggering-workflow@v0 |
| 99 | + with: |
| 100 | + name: ${{ matrix.job-name }} |
| 101 | + fails-on-triggering-workflow-failure: true |
| 102 | + |
| 103 | + - name: Check out code |
| 104 | + uses: actions/checkout@v5 |
| 105 | + with: |
| 106 | + ref: "${{ inputs.ref }}" |
| 107 | + |
| 108 | + - name: Setup PHP ${{ matrix.php-version }} |
| 109 | + id: setup-php |
| 110 | + uses: shivammathur/setup-php@v2 |
| 111 | + env: |
| 112 | + update: true # whether to use latest available patch for the version or not |
| 113 | + fail-fast: true # step will fail if an extension or tool fails to set up |
| 114 | + with: |
| 115 | + php-version: ${{ matrix.php-version }} |
| 116 | + tools: composer |
| 117 | + coverage: none |
| 118 | + |
| 119 | + - name: Get composer cache directory |
| 120 | + id: composer-cache |
| 121 | + run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT |
| 122 | + |
| 123 | + - name: Setup cache for PHP ${{ steps.setup-php.outputs.php-version }} & Symfony ${{ matrix.symfony-version }} |
| 124 | + uses: actions/cache@v4 |
| 125 | + with: |
| 126 | + path: | |
| 127 | + ${{ steps.composer-cache.outputs.dir }} |
| 128 | + # Clear the cache if composer.json (as composer.lock is not available) has been updated |
| 129 | + key: tests-php${{ steps.setup-php.outputs.php-version }}-sf${{ matrix.symfony-version }}-${{ hashFiles('composer.json') }} |
| 130 | + |
| 131 | + - name: Build with PHP ${{ steps.setup-php.outputs.php-version }} & Symfony ${{ matrix.symfony-version }} |
| 132 | + run: | |
| 133 | + SF_CONSTRAINT="~${{ matrix.symfony-version }}.0@dev" |
| 134 | + composer config minimum-stability dev \ |
| 135 | + && composer require -W \ |
| 136 | + symfony/config:${SF_CONSTRAINT} \ |
| 137 | + symfony/dependency-injection:${SF_CONSTRAINT} \ |
| 138 | + symfony/event-dispatcher:${SF_CONSTRAINT} \ |
| 139 | + symfony/http-foundation:${SF_CONSTRAINT} \ |
| 140 | + symfony/http-kernel:${SF_CONSTRAINT} \ |
| 141 | + ${{ matrix.pkg-extra-constraints }} \ |
| 142 | + && make build |
| 143 | +
|
| 144 | + - name: Test |
| 145 | + run: make test-unit && make test-functional |
0 commit comments