From ccc20f8cfd9bb427ab6fbf67dcbe5014ade97893 Mon Sep 17 00:00:00 2001 From: yaozm Date: Sat, 12 Aug 2023 22:41:48 +0800 Subject: [PATCH] chore(workflows): update tests.yml - Uncomment strategy - Modify PHP and Laravel versions - Update Composer dependencies - Execute tests --- .github/workflows/tests.yml | 125 ++++++++++++++++++++++++++++-------- 1 file changed, 97 insertions(+), 28 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index f4f6b4d..d47501c 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -5,35 +5,88 @@ on: [ push, pull_request ] jobs: test: runs-on: ${{ matrix.os }} + # strategy: + # fail-fast: true + # matrix: + # os: [ ubuntu-latest ] + # php: [ 7.4, 8.2 ] + # dependency-version: [ prefer-stable ] + # laravel: [ 7.*, 8.*, 9.*, 10.* ] + # include: + # - laravel: 10.* + # testbench: 8.* + # - laravel: 9.* + # testbench: 7.* + # - laravel: 8.* + # testbench: 6.* + # - laravel: 7.* + # testbench: 5.* + # exclude: + # - laravel: 8.* + # php: 8.0 + # dependency-version: prefer-lowest + # - laravel: 8.* + # php: 8.2 + # dependency-version: prefer-lowest + # - laravel: 6.* + # php: 8.2 + # - laravel: 10.* + # php: 8.0 + # + # name: P${{ matrix.php }} - ${{ matrix.dependency-version }} - ${{ matrix.os }} strategy: - fail-fast: true + fail-fast: false matrix: - os: [ ubuntu-latest ] - php: [ 7.4, 8.2 ] - dependency-version: [ prefer-stable ] - laravel: [ 7.*, 8.*, 9.*, 10.* ] - include: - - laravel: 10.* - testbench: 8.* - - laravel: 9.* - testbench: 7.* - - laravel: 8.* - testbench: 6.* - - laravel: 7.* - testbench: 5.* + php: [ "8.2", "8.1", "8.0", "7.4" ] + packages: + # All versions below should be test on PHP ^7.1 (Sentry SDK requirement) and PHP < 8.0 (PHPUnit requirement) + # - { laravel: ^6.0, testbench: 4.7.*, phpunit: 8.4.* } + - { laravel: ^7.0, testbench: 5.1.*, phpunit: 8.4.* } + + # All versions below only support PHP ^7.3 (Laravel requirement) + - { laravel: ^8.0, testbench: ^6.0, phpunit: 9.3.* } + + # All versions below only support PHP ^8.0 (Laravel requirement) + - { laravel: ^9.0, testbench: ^7.0, phpunit: 9.5.* } + + # All versions below only support PHP ^8.1 (Laravel requirement) + - { laravel: ^10.0, testbench: ^8.0, phpunit: 9.6.* } exclude: - - laravel: 8.* - php: 8.0 - dependency-version: prefer-lowest - - laravel: 8.* - php: 8.2 - dependency-version: prefer-lowest - - laravel: 6.* - php: 8.2 - - laravel: 10.* - php: 8.0 - - name: P${{ matrix.php }} - ${{ matrix.dependency-version }} - ${{ matrix.os }} + # - php: "7.2" + # packages: { laravel: ^8.0, testbench: ^6.0, phpunit: 9.3.* } + # - php: "7.2" + # packages: { laravel: ^9.0, testbench: ^7.0, phpunit: 9.5.* } + # - php: "7.2" + # packages: { laravel: ^10.0, testbench: ^8.0, phpunit: 9.6.* } + # + # - php: "7.3" + # packages: { laravel: ^9.0, testbench: ^7.0, phpunit: 9.5.* } + # - php: "7.3" + # packages: { laravel: ^10.0, testbench: ^8.0, phpunit: 9.6.* } + + - php: "7.4" + packages: { laravel: ^9.0, testbench: ^7.0, phpunit: 9.5.* } + - php: "7.4" + packages: { laravel: ^10.0, testbench: ^8.0, phpunit: 9.6.* } + + # - php: "8.0" + # packages: { laravel: ^6.0, testbench: 4.7.*, phpunit: 8.4.* } + - php: "8.0" + packages: { laravel: ^7.0, testbench: 5.1.*, phpunit: 8.4.* } + - php: "8.0" + packages: { laravel: ^10.0, testbench: ^8.0, phpunit: 9.6.* } + + # - php: "8.1" + # packages: { laravel: ^6.0, testbench: 4.7.*, phpunit: 8.4.* } + - php: "8.1" + packages: { laravel: ^7.0, testbench: 5.1.*, phpunit: 8.4.* } + + # - php: "8.2" + # packages: { laravel: ^6.0, testbench: 4.7.*, phpunit: 8.4.* } + - php: "8.2" + packages: { laravel: ^7.0, testbench: 5.1.*, phpunit: 8.4.* } + + name: phpunit (PHP:${{ matrix.php }}, Laravel:${{ matrix.packages.laravel }}) steps: - name: Checkout code @@ -52,8 +105,24 @@ jobs: extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick coverage: xdebug - - name: Install dependencies - run: composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction --ansi -v + # - name: Install dependencies + # run: composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction --ansi -v + + - name: Install Composer dependencies + run: | + # No need for this package to run phpunit and it conflicts with older Laravel versions + # composer remove friendsofphp/php-cs-fixer --dev --no-interaction --no-update + + # Require the correct versions we want to run phpunit for + composer require \ + "laravel/framework:${{ matrix.packages.laravel }}" \ + "illuminate/support:${{ matrix.packages.laravel }}" \ + "phpunit/phpunit:${{ matrix.packages.phpunit }}" \ + "orchestra/testbench:${{ matrix.packages.testbench }}" \ + --no-interaction --no-update + + # Actually run the composer installation + composer install --no-interaction --prefer-dist --no-progress - name: Execute tests run: composer test-coverage