From 542386ded2f999562b9aecddb6c318110eaaf9bc Mon Sep 17 00:00:00 2001 From: Will Vincent Date: Thu, 20 Jan 2022 11:57:20 -0600 Subject: [PATCH] Updates for Laravel 9, fix migration for tests --- .github/workflows/run-tests.yml | 31 ++++++++++---------- README.md | 4 ++- composer.json | 14 ++++----- tests/Database/migrations/RatingMigrator.php | 1 + 4 files changed, 24 insertions(+), 26 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 66b9031..09009fc 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -6,19 +6,14 @@ on: jobs: php-tests: + if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository runs-on: ${{ matrix.os }} - strategy: + fail-fast: false matrix: - php: [7.4, 8.0, 8.1] - laravel: [6.*, 7.*, 8.*, 9.*] - dependency-version: [prefer-stable] - os: [ubuntu-latest, windows-latest] - exclude: - - laravel: 6.* - php: 8.1 - - laravel: 7.* - php: 8.1 + php: ["8.1", "8.0"] + laravel: ["^9.0", "^8.0"] + dependency-version: [prefer-lowest, prefer-stable] name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }} - ${{ matrix.os }} @@ -26,18 +21,22 @@ jobs: - name: Checkout code uses: actions/checkout@v2 + - name: Cache dependencies + uses: actions/cache@v2 + with: + path: ~/.composer/cache/files + key: dependencies-laravel-${{ matrix.laravel }}-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }} + - name: Setup PHP uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php }} - extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo + extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, mysql, mysqli, pdo_mysql, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo coverage: none - tools: composer:v2 - name: Install dependencies run: | - composer require "laravel/framework:${{ matrix.laravel }}" --no-interaction --no-update - composer update --${{ matrix.dependency-version }} --no-interaction --no-progress - + composer require "laravel/framework:${{ matrix.laravel }}" --dev --no-interaction --no-update + composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction - name: Execute tests - run: vendor/bin/phpunit + run: vendor/bin/phpunit \ No newline at end of file diff --git a/README.md b/README.md index c26d3d8..985aeda 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,9 @@ Ratings could be fivestar style, or simple +1/-1 style. Laravel versions < 6.x should use the 1.x releases -Laravel versions >= 6.x should use 2.x+ releases +Laravel versions >= 6.x and < 8.x should use 2.x+ releases + +Laravel versions >= 8.x should use the 3.x releases ## Installation diff --git a/composer.json b/composer.json index c32ad93..18d1d5f 100644 --- a/composer.json +++ b/composer.json @@ -7,7 +7,6 @@ "rating", "vote", "fivestar", - "laravel 7", "laravel 8", "laravel 9" ], @@ -21,16 +20,14 @@ } ], "require": { - "php": ">=7.2", - "illuminate/support": "^7.0|^8.0|^9.0", - "illuminate/database": "^7.30.4|^8.0|^9.0" + "php": ">=7.4", + "illuminate/support": "^8.0 || ^9.0", + "illuminate/database": "^8.53 || ^9.0" }, "require-dev": { "friendsofphp/php-cs-fixer": "^2.16", - "orchestra/testbench": "^5.0|^6.0", - "phpunit/phpunit": "^9.0", - "psalm/plugin-laravel": "^1.2", - "vimeo/psalm": "^3.11" + "orchestra/testbench": "^6.23 || ^7.0", + "phpunit/phpunit": "^9.5" }, "autoload": { "psr-4": { @@ -43,7 +40,6 @@ } }, "scripts": { - "psalm": "vendor/bin/psalm", "test": "vendor/bin/phpunit", "test-coverage": "vendor/bin/phpunit --coverage-html coverage", "format": "vendor/bin/php-cs-fixer fix --allow-risky=yes" diff --git a/tests/Database/migrations/RatingMigrator.php b/tests/Database/migrations/RatingMigrator.php index 474b9c8..6995c73 100644 --- a/tests/Database/migrations/RatingMigrator.php +++ b/tests/Database/migrations/RatingMigrator.php @@ -17,6 +17,7 @@ public function up() $table->increments('id'); $table->timestamps(); $table->integer('rating'); + $table->text('comment')->nullable(); $table->morphs('rateable'); $table->bigInteger('user_id')->unsigned(); $table->index('rateable_id');