Skip to content

Commit

Permalink
Updates for Laravel 9, fix migration for tests
Browse files Browse the repository at this point in the history
  • Loading branch information
willvincent committed Jan 20, 2022
1 parent 9e833d3 commit 542386d
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 26 deletions.
31 changes: 15 additions & 16 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,38 +6,37 @@ 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 }}

steps:
- 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
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
14 changes: 5 additions & 9 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"rating",
"vote",
"fivestar",
"laravel 7",
"laravel 8",
"laravel 9"
],
Expand All @@ -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": {
Expand All @@ -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"
Expand Down
1 change: 1 addition & 0 deletions tests/Database/migrations/RatingMigrator.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down

0 comments on commit 542386d

Please sign in to comment.