Skip to content

Commit

Permalink
Support Laravel v11
Browse files Browse the repository at this point in the history
  • Loading branch information
mtvbrianking committed Apr 23, 2024
1 parent 7bc01a1 commit 7b00a85
Show file tree
Hide file tree
Showing 3 changed files with 97 additions and 47 deletions.
62 changes: 62 additions & 0 deletions .github/workflows/gen-coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: gen-coverage

on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
coverage:
runs-on: ubuntu-latest

name: Coverage

steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.2
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, pcov
tools: composer:v2
coverage: pcov

- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

- name: Cache composer dependencies
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-

- name: Install dependencies
run: |
composer install --no-interaction --no-progress --prefer-dist --optimize-autoloader
- name: Create tests database
run: |
mkdir -p database
touch database/database.sqlite
- name: Execute tests, generate code coverage report
env:
DB_CONNECTION: sqlite
DB_DATABASE: database/database.sqlite
run: vendor/bin/phpunit --coverage-text --coverage-clover=coverage.clover

- name: Upload code coverage report
run: |
composer global require scrutinizer/ocular
composer global config --list | grep "vendor-dir"
~/.composer/vendor/bin/ocular code-coverage:upload --format=php-clover coverage.clover
65 changes: 27 additions & 38 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,40 @@
name: run-tests

on: [push, pull_request]
on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
tests:

runs-on: ubuntu-latest

strategy:
fail-fast: true
matrix:
php: [8.1, 8.2]
laravel: [^10.0]
php: [8.1, 8.2, 8.3]
laravel: [^10.0, ^11.0]
include:
- laravel: ^11.0
testbench: 9.0.2
- laravel: ^10.0
testbench: ^8.0
name: Tests P${{ matrix.php }} - L${{ matrix.laravel }} - T${{ matrix.testbench }}
exclude:
- laravel: ^11.0
php: 8.1

name: P ${{ matrix.php }} L ${{ matrix.laravel }} T ${{ matrix.testbench }}

steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false

- name: Setup PHP
uses: shivammathur/setup-php@v2
Expand All @@ -27,14 +45,14 @@ jobs:
coverage: pcov

- name: Cache dependencies
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/.composer/cache/files
key: dependencies-laravel-${{ matrix.laravel }}-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}

- name: Install dependencies
run: |
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-progress --no-update
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --dev --no-interaction --no-progress --no-update
composer update --prefer-dist --no-interaction --no-progress
- name: Create tests database
Expand All @@ -46,33 +64,4 @@ jobs:
env:
DB_CONNECTION: sqlite
DB_DATABASE: database/database.sqlite
run: vendor/bin/phpunit --coverage-text --coverage-clover=coverage.clover

- name: Save code coverage report
uses: actions/upload-artifact@v3
with:
name: coverage
path: coverage.clover

coverage:
needs: tests
runs-on: ubuntu-latest
name: Coverage
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 7.4

- name: Retrieve code coverage report
uses: actions/download-artifact@v3
with:
name: coverage

- name: Upload code coverage report
run: |
wget https://scrutinizer-ci.com/ocular.phar
php ocular.phar code-coverage:upload --format=php-clover coverage.clover
run: vendor/bin/phpunit
17 changes: 8 additions & 9 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,16 @@
],
"require": {
"php": "^8.1",
"illuminate/auth": "^10.0",
"illuminate/console": "^10.0",
"illuminate/notifications": "^10.0",
"illuminate/routing": "^10.0",
"illuminate/support": "^10.0"
"illuminate/auth": "^10.0|^11.0",
"illuminate/console": "^10.0|^11.0",
"illuminate/notifications": "^10.0|^11.0",
"illuminate/routing": "^10.0|^11.0",
"illuminate/support": "^10.0|^11.0"
},
"require-dev": {
"code-lts/doctum": "^5.5",
"friendsofphp/php-cs-fixer": "^3.0",
"orchestra/testbench": "^8.0",
"phpunit/phpunit": "^10.0"
"friendsofphp/php-cs-fixer": "^3.14",
"orchestra/testbench": "^8.0|^9.0",
"phpunit/phpunit": "^10.0|^11.0"
},
"autoload": {
"psr-4": {
Expand Down

0 comments on commit 7b00a85

Please sign in to comment.