From d233f8f46aedbec23245e9cb8d5efb1c0fdeed1e Mon Sep 17 00:00:00 2001 From: Massimiliano Arione Date: Mon, 2 Feb 2026 18:33:51 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=91=B7=20improve=20CI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build.yaml | 45 ++++++++++++++-------------------- tests/Test/WebTestCaseTest.php | 8 +++--- 2 files changed, 22 insertions(+), 31 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 7739348..7fd13e3 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -12,7 +12,7 @@ jobs: name: PHPStan steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v6 - name: PHPStan uses: docker://oskarstark/phpstan-ga env: @@ -24,7 +24,7 @@ jobs: name: PHP-CS-Fixer steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v6 - name: Fix CS uses: docker://oskarstark/php-cs-fixer-ga with: @@ -35,44 +35,35 @@ jobs: fail-fast: false matrix: include: - - description: 'Symfony 6.4' + - description: 'Lowest' php: '8.2' - symfony: '6.4.*' - composer_option: '--prefer-lowest' - - description: 'Symfony 7.3' - php: '8.3' - symfony: '7.3.*' + symfony: 6.4.* + dependencies: lowest - description: 'Symfony 7.4' php: '8.4' - symfony: '7.4.*@dev' + symfony: 7.4.* - description: 'Symfony 8.0' php: '8.5' - symfony: '8.0.*@dev' + symfony: 8.0.* name: PHP ${{ matrix.php }} tests (${{ matrix.description }}) steps: - name: Checkout - uses: actions/checkout@v4 - - name: Cache - uses: actions/cache@v4 - with: - path: ~/.composer/cache/files - key: ${{ matrix.php }}-${{ matrix.symfony }}-${{ matrix.composer_option }} + uses: actions/checkout@v6 - name: Setup PHP uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php }} - - name: require specific Symfony version - if: matrix.symfony - run: | - sed -ri 's/"symfony\/(.+)": "(.+)"/"symfony\/\1": "'${{ matrix.symfony }}'"/' composer.json; - - name: use possible dev deps + tools: flex + - name: Allow dev dependencies + run: composer config minimum-stability dev && composer config prefer-stable true if: contains(matrix.symfony, '@dev') - run: | - composer config minimum-stability dev - composer config prefer-stable true - - name: update vendors - run: composer update --no-interaction --no-progress --ansi ${{ matrix.composer_option }} - - name: run tests + - name: Install dependencies + uses: ramsey/composer-install@v3 + with: + dependency-versions: ${{ matrix.dependencies }} + env: + SYMFONY_REQUIRE: ${{ matrix.symfony }} + - name: Run tests run: bin/phpunit --colors=always --coverage-clover=clover.xml - name: save test coverage if: ${{ matrix.php == '8.4' }} diff --git a/tests/Test/WebTestCaseTest.php b/tests/Test/WebTestCaseTest.php index cfd89d2..12fe65e 100644 --- a/tests/Test/WebTestCaseTest.php +++ b/tests/Test/WebTestCaseTest.php @@ -46,7 +46,7 @@ public function testSaveOutput(): void self::$container ->method('getParameter') ->willReturnCallback( - function (string $parameter): string { + static function (string $parameter): string { return match ($parameter) { 'beelab_test.browser' => 'test', 'kernel.project_dir' => vfsStream::url('proj'), @@ -99,7 +99,7 @@ public function testLogin(): void self::$container ->method('has') ->willReturnCallback( - function (string $service): bool { + static function (string $service): bool { return match ($service) { 'session.factory', 'test.session.factory' => false, 'session' => true, @@ -111,7 +111,7 @@ function (string $service): bool { self::$container ->method('get') ->willReturnCallback( - function (string $service) use ($repository, $session): ?object { + static function (string $service) use ($repository, $session): ?object { return match ($service) { 'beelab_user.manager' => $repository, 'session' => $session, @@ -149,7 +149,7 @@ public function testLoginWithUserNotFound(): void self::$container ->method('get') ->willReturnCallback( - function (string $service) use ($repository, $session): ?object { + static function (string $service) use ($repository, $session): ?object { return match ($service) { 'beelab_user.manager' => $repository, 'session' => $session,