From 06e30baa27a772cdcca3fc333f41e65b9bd0e657 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Thu, 3 Jun 2021 14:59:24 +0700 Subject: [PATCH 1/3] Upgrade to GitHub-native Dependabot (#23) Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> --- .github/dependabot.yml | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..5aa24fb --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,9 @@ +version: 2 +updates: +- package-ecosystem: composer + directory: "/" + schedule: + interval: daily + time: "08:00" + timezone: Asia/Jakarta + open-pull-requests-limit: 10 From 0185e86bd7dc70025edb4ee20a2743cb1a9ef4f0 Mon Sep 17 00:00:00 2001 From: Richan Fongdasen Date: Mon, 21 Jun 2021 13:15:49 +0700 Subject: [PATCH 2/3] Add Support For PHP 8.0 (#24) * Add support for PHP 8.0 * Update github actions cache name * Delete Travis CI configuration --- .github/workflows/main.yml | 100 +++++++++++++++++++++++++++++++++ .travis.yml | 37 ------------ composer.json | 12 ++-- src/Events/ModelHasUpdated.php | 2 +- 4 files changed, 107 insertions(+), 44 deletions(-) create mode 100644 .github/workflows/main.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..ae12412 --- /dev/null +++ b/.github/workflows/main.yml @@ -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) diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index ea96717..0000000 --- a/.travis.yml +++ /dev/null @@ -1,37 +0,0 @@ -language: php -os: linux -dist: bionic - -matrix: - fast_finish: true - include: - - php: 7.3 - env: LARAVEL=^8.0 ORCHESTRA=^6.0 - - php: 7.4 - env: LARAVEL=^8.0 ORCHESTRA=^6.0 COVERAGE=1 - - allow_failures: - - env: COVERAGE=1 - -before_install: - - phpenv config-rm xdebug.ini - - travis_retry composer self-update - -before_script: - - if [[ -v LARAVEL ]]; then composer require laravel/framework:$LARAVEL --no-update; fi - - if [[ -v ORCHESTRA ]]; then composer require orchestra/testbench:$ORCHESTRA --no-update; fi - - - travis_retry composer install --no-interaction --prefer-source - - phpenv rehash - - set +H - -script: - - composer analyse - - if [[ $COVERAGE != '1' ]]; then vendor/bin/phpunit; fi - - if [[ $COVERAGE = '1' ]]; then phpdbg -qrr vendor/bin/phpunit --coverage-clover=clover.xml; fi - -after_script: - - if [[ $COVERAGE = '1' ]]; then bash <(curl -s https://codecov.io/bash); fi - -notifications: - email: false diff --git a/composer.json b/composer.json index 9be77a8..ff872b6 100644 --- a/composer.json +++ b/composer.json @@ -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": { diff --git a/src/Events/ModelHasUpdated.php b/src/Events/ModelHasUpdated.php index 36839f5..5a7b703 100644 --- a/src/Events/ModelHasUpdated.php +++ b/src/Events/ModelHasUpdated.php @@ -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(); From 9ce86563f4b56d439c672ff2125de6bd3b227fa0 Mon Sep 17 00:00:00 2001 From: Richan Fongdasen Date: Mon, 21 Jun 2021 13:18:28 +0700 Subject: [PATCH 3/3] Update readme.md --- readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.md b/readme.md index f7b07ec..4946b8b 100644 --- a/readme.md +++ b/readme.md @@ -1,4 +1,4 @@ -[![Build Status](https://travis-ci.org/richan-fongdasen/laravel-varnishable.svg?branch=master)](https://travis-ci.org/richan-fongdasen/laravel-varnishable) +[![Build](https://github.com/richan-fongdasen/laravel-varnishable/actions/workflows/main.yml/badge.svg?branch=master)](https://github.com/richan-fongdasen/laravel-varnishable/actions/workflows/main.yml) [![codecov](https://codecov.io/gh/richan-fongdasen/laravel-varnishable/branch/master/graph/badge.svg)](https://codecov.io/gh/richan-fongdasen/laravel-varnishable) [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/richan-fongdasen/laravel-varnishable/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/richan-fongdasen/laravel-varnishable/?branch=master) [![StyleCI Analysis Status](https://github.styleci.io/repos/135787392/shield?branch=master)](https://github.styleci.io/repos/135787392)