From f51fe26df07a08c1b3f272474401ef8a008b190c Mon Sep 17 00:00:00 2001 From: Evert Harmeling Date: Sun, 19 Nov 2023 09:15:37 +0100 Subject: [PATCH] Optimized CI workflow and bumped Symfony version to 6.3 (#779) --- .github/workflows/build.yaml | 90 +++++++++++++++++++++--------------- composer.json | 20 ++++---- 2 files changed, 62 insertions(+), 48 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index ceeb93b..b670ae5 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -11,7 +11,7 @@ jobs: steps: - name: Checkout uses: actions/checkout@v3 - - name: PHPStan + - name: Run PHPStan uses: docker://oskarstark/phpstan-ga env: REQUIRE_DEV: true @@ -23,54 +23,68 @@ jobs: steps: - name: Checkout uses: actions/checkout@v3 - - name: Fix CS + - name: Run PHP-CS-Fixer uses: docker://oskarstark/php-cs-fixer-ga tests: runs-on: ubuntu-20.04 strategy: matrix: php: - - '8.0' - - '8.1' - - '8.2' + - '8.1' + - '8.2' + - '8.3' + dependency: + - '' + symfony: + - '6.3.*' + - '6.4.*' + - '7.0.*' include: - - description: 'Symfony 6.0' - php: '8.0' - composer_option: '--prefer-lowest' - - description: 'Symfony 6.1' - php: '8.1' - symfony: 6.1.* - - description: 'Symfony 6.2' - php: '8.2' - symfony: 6.2.* - - description: 'Symfony 6.3' - php: '8.2' - symfony: 6.3.* - - description: 'Symfony 6.4' - php: '8.2' - symfony: 6.4.*-dev - - description: 'Symfony 7.0' - php: '8.2' - symfony: 7.0.*-dev - name: PHP ${{ matrix.php }} tests (${{ matrix.description }}) + - php: '8.1' + symfony: '6.3.*' + dependency: 'lowest' + - php: '8.2' + symfony: '7.0.*' + dependency: 'lowest' + exclude: + - php: '8.1' + symfony: '7.0.*' + name: PHPUnit PHP ${{ matrix.php }} ${{ matrix.dependency }} (Symfony ${{ matrix.symfony }}) steps: - name: Checkout uses: actions/checkout@v3 - - name: Cache - uses: actions/cache@v3 - with: - path: ~/.composer/cache/files - key: ${{ matrix.php }}-${{ matrix.symfony }}-${{ matrix.composer_option }} + - name: Setup PHP uses: shivammathur/setup-php@v2 with: - php-version: ${{ matrix.php }} - - run: | - sed -ri 's/"symfony\/(.+)": "(.+)"/"symfony\/\1": "'${{ matrix.symfony }}'"/' composer.json; - if: contains(matrix.symfony, '-dev') - - run: composer config minimum-stability dev - - run: composer config prefer-stable true - if: matrix.symfony - - run: composer update --no-interaction --no-progress --ansi ${{ matrix.composer_option }} - - run: vendor/bin/phpunit + php-version: ${{ matrix.php }} + + - name: Get Composer cache directory + id: composer-cache + run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT + + - name: Cache dependencies + uses: actions/cache@v3 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }} + restore-keys: ${{ matrix.php }}-composer- + + - name: Update project dependencies + if: matrix.dependency == '' + run: composer update --no-progress --ansi --prefer-stable + env: + SYMFONY_REQUIRE: ${{ matrix.symfony }} + + - name: Update project dependencies lowest + if: matrix.dependency == 'lowest' + run: composer update --no-progress --ansi --prefer-stable --prefer-lowest + env: + SYMFONY_REQUIRE: ${{ matrix.symfony }} + + - name: Validate composer + run: composer validate --strict --no-check-lock + + - name: Run tests + run: vendor/bin/phpunit diff --git a/composer.json b/composer.json index 0ddab0b..5c6e097 100644 --- a/composer.json +++ b/composer.json @@ -16,22 +16,22 @@ } ], "require": { - "php": "^8.0", + "php": "^8.1", "knplabs/knp-components": "^4.1", - "symfony/config": "^6.0 || ^7.0", - "symfony/dependency-injection": "^6.0 || ^7.0", - "symfony/event-dispatcher": "^6.0 || ^7.0", - "symfony/http-foundation": "^6.0 || ^7.0", - "symfony/http-kernel": "^6.0 || ^7.0", - "symfony/routing": "^6.0 || ^7.0", - "symfony/translation": "^6.0 || ^7.0", + "symfony/config": "^6.3 || ^7.0", + "symfony/dependency-injection": "^6.3 || ^7.0", + "symfony/event-dispatcher": "^6.3 || ^7.0", + "symfony/http-foundation": "^6.3 || ^7.0", + "symfony/http-kernel": "^6.3 || ^7.0", + "symfony/routing": "^6.3 || ^7.0", + "symfony/translation": "^6.3 || ^7.0", "twig/twig": "^3.0" }, "require-dev": { "phpstan/phpstan": "^1.9", "phpunit/phpunit": "^9.5", - "symfony/expression-language": "^6.0 || ^7.0", - "symfony/templating": "^6.0 || ^7.0" + "symfony/expression-language": "^6.3 || ^7.0", + "symfony/templating": "^6.3 || ^7.0" }, "autoload": { "psr-4": {