Skip to content

Commit

Permalink
Add Support For PHP 8.0 (#24)
Browse files Browse the repository at this point in the history
* Add support for PHP 8.0

* Update github actions cache name

* Delete Travis CI configuration
  • Loading branch information
richan-fongdasen authored Jun 21, 2021
1 parent 06e30ba commit 0185e86
Show file tree
Hide file tree
Showing 4 changed files with 107 additions and 44 deletions.
100 changes: 100 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
name: Build

on:
push:
branches:
- master
- release/*
- issue-*
pull_request:
branches:
- master
schedule:
- cron: 0 7 * * 1

jobs:
analysis:
runs-on: ubuntu-latest
strategy:
matrix:
php: [7.4]
steps:
- uses: actions/checkout@v1
- name: Cache composer dependencies
uses: actions/cache@v2
env:
cache-name: laravel-varnishable-composer-cache
with:
path: ~/.composer
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/composer.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- 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
coverage: none
- name: Install composer dependencies
run: composer install --prefer-dist
- name: Run phpstan analysis
run: composer phpstan-analysis
- name: Run phpmd analysis
run: composer phpmd-analysis
- name: Run phpcpd analysis
run: vendor/bin/phpcpd --min-lines=3 --min-tokens=36 src/
phpunit:
needs: [analysis]
runs-on: ubuntu-latest
strategy:
matrix:
php: [7.3, 7.4, 8.0]
steps:
- uses: actions/checkout@v1
- 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
coverage: none
- name: Remove some dev dependencies
run: composer remove "ekino/phpstan-banned-code" "nunomaduro/larastan" "phpmd/phpmd" "phpstan/phpstan-deprecation-rules" "sebastian/phpcpd" --dev --no-update
- name: Install composer dependencies
run: composer install --prefer-dist
- name: Run the test suite
run: phpdbg -qrr -dmemory_limit=3G vendor/bin/phpunit
phpunit-cov:
needs: [ analysis ]
runs-on: ubuntu-latest
strategy:
matrix:
php: [ 7.4 ]
steps:
- uses: actions/checkout@v1
- name: Cache composer dependencies
uses: actions/cache@v2
env:
cache-name: laravel-varnishable-composer-cache
with:
path: ~/.composer
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/composer.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- 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
coverage: none
- name: Install composer dependencies
run: composer install --prefer-dist
- name: Run the Coverage test suite
run: phpdbg -qrr -dmemory_limit=3G vendor/bin/phpunit --coverage-clover=clover.xml
- name: Upload test coverage report to codecov.io
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
run: bash <(curl -s https://codecov.io/bash)
37 changes: 0 additions & 37 deletions .travis.yml

This file was deleted.

12 changes: 6 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,21 @@
"source": "https://github.com/richan-fongdasen/laravel-varnishable"
},
"require": {
"php": "^7.3",
"guzzlehttp/guzzle": "~7.0",
"php": "^7.3||^8.0",
"guzzlehttp/guzzle": "^7.3",
"illuminate/database": "^8.0",
"illuminate/support": "^8.0"
},
"require-dev": {
"ekino/phpstan-banned-code": "^0.3.1",
"mockery/mockery": "~1.3",
"ekino/phpstan-banned-code": "^0.4",
"mockery/mockery": "^1.4",
"orchestra/database": "^6.0",
"orchestra/testbench": "^6.0",
"phpmd/phpmd": "^2.9",
"phpmd/phpmd": "^2.10",
"phpstan/phpstan": "^0.12",
"phpstan/phpstan-deprecation-rules": "^0.12",
"phpstan/phpstan-strict-rules": "^0.12",
"phpunit/phpunit": "^9.3",
"phpunit/phpunit": "^9.5",
"sebastian/phpcpd": "^6.0"
},
"config": {
Expand Down
2 changes: 1 addition & 1 deletion src/Events/ModelHasUpdated.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ protected function getQuery(Model $model): Builder
{
$query = $model->newQuery();

$traits = class_uses($model);
$traits = collect(class_uses($model))->toArray();

if (in_array(SoftDeletes::class, $traits, true)) {
$query->withTrashed();
Expand Down

0 comments on commit 0185e86

Please sign in to comment.