Merge pull request #1498 from VincentLanglet/sf8 #416
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: Build | |
| on: | |
| push: | |
| branches: [main, next, master, 2.5, 3.4, 4.3, 5.1, 6.3, 7.5] | |
| pull_request: | |
| release: | |
| types: [created] | |
| jobs: | |
| tests: | |
| runs-on: ubuntu-latest | |
| name: Build and test | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| php: ["8.2", "8.3", "8.4"] | |
| operating-system: [ ubuntu-latest, macOS-latest, windows-latest ] | |
| composer-flags: [""] | |
| composer-extras: [""] | |
| symfony: [""] | |
| stability: ["stable"] | |
| include: | |
| - php: "8.2" | |
| operating-system: ubuntu-latest | |
| publish-phar: true | |
| - php: "8.2" | |
| composer-flags: --prefer-lowest | |
| - php: "8.4" | |
| operating-system: ubuntu-latest | |
| symfony: "8.0.*" | |
| env: | |
| COMPOSER_ROOT_VERSION: dev-master | |
| SYMFONY_REQUIRE: ${{ matrix.symfony }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: "${{ matrix.php }}" | |
| ini-values: "phar.readonly=0" | |
| - name: Install composer extras | |
| if: matrix.composer-extras != '' | |
| run: composer require ${{ matrix.composer-extras }} --no-update | |
| - name: Update the minimum stability | |
| if: matrix.stability == 'dev' | |
| run: composer config minimum-stability ${{ matrix.stability }} | |
| - name: Locate composer cache | |
| id: composercache | |
| run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
| - name: Cache composer dependencies | |
| uses: actions/cache@v4 | |
| env: | |
| cache-name: cache-composer | |
| with: | |
| path: ${{ steps.composercache.outputs.dir }} | |
| key: ${{ hashFiles('composer.json') }} | |
| - name: Remove psalm & behat (to allow Symfony 8) | |
| if: matrix.symfony == '8.0.*' | |
| run: composer remove --dev --no-update behat/behat | |
| - name: Install composer dependencies | |
| run: composer update ${{ matrix.composer-flags }} | |
| - name: Run static analysis (psalm) | |
| if: matrix.symfony != '8.0.*' && matrix.composer-flags != '--prefer-lowest' | |
| run: ./vendor/bin/psalm --php-version=${{ matrix.php }} | |
| - name: Run tests (phpspec) | |
| run: bin/phpspec run --format=dot | |
| - name: Run tests (phpunit) | |
| run: ./vendor/bin/phpunit | |
| - name: Run tests (behat) | |
| if: matrix.symfony != '8.0.*' | |
| run: ./vendor/bin/behat --format=progress | |
| - name: Build the PHAR | |
| if: matrix.symfony != '8.0.*' | |
| run: | | |
| composer bin box require --dev humbug/box | |
| ./vendor/bin/box compile | |
| ./vendor/bin/behat --profile=phar | |
| - uses: actions/upload-artifact@v4 | |
| name: Publish the PHAR | |
| if: matrix.publish-phar | |
| with: | |
| name: phpspec.phar | |
| path: phpspec.phar | |
| publish-phar: | |
| runs-on: ubuntu-latest | |
| name: Publish the PHAR | |
| needs: tests | |
| if: github.event_name == 'release' | |
| steps: | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: phpspec.phar | |
| path: . | |
| - name: Upload phpspec.phar | |
| uses: actions/upload-release-asset@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ github.event.release.upload_url }} | |
| asset_path: phpspec.phar | |
| asset_name: phpspec.phar | |
| asset_content_type: application/zip |