Skip to content

Commit

Permalink
Laravel 11.x Compatibility (#47)
Browse files Browse the repository at this point in the history
* Bump dependencies for Laravel 11

* Update GitHub Actions for Laravel 11

* build: Update actions/checkout from v2 to v4

* build: Remove obsolete verbose flag for PHPUnit

* build: Use PCOV for code coverage

* test: Provide dedicated PHPUnit 10 support

* build: Added PHP 8.3 to test matrix

* build: Updated test matrix excludes according to [Laravel support policies](https://laravel.com/docs/11.x/releases)

---------

Co-authored-by: Shift <[email protected]>
  • Loading branch information
DevDavido and laravel-shift authored Jun 2, 2024
1 parent f7e4f94 commit cd5ca29
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 21 deletions.
48 changes: 37 additions & 11 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,44 +7,70 @@ on:
jobs:
tests:
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
php: [7.4, 8.0, 8.1, 8.2]
laravel: [6.*, 7.*, 8.*, 9.*, 10.*]
php: [7.4, 8.0, 8.1, 8.2, 8.3]
laravel: ['6.*', '7.*', '8.*', '9.*', '10.*', '11.*']
exclude:
# excludes unsupported combinations
- php: 7.4
laravel: 11.*
- php: 8.0
laravel: 10.*
laravel: 11.*
- php: 8.1
laravel: 11.*
- php: 7.4
laravel: 10.*
- php: 8.0
laravel: 10.*
- php: 7.4
laravel: 9.*
- php: 8.1
laravel: 6.*
- php: 8.3
laravel: 9.*
- php: 8.2
laravel: 8.*
- php: 8.3
laravel: 8.*
- php: 8.1
laravel: 7.*
- php: 8.2
laravel: 7.*
- php: 8.3
laravel: 7.*
- php: 8.1
laravel: 6.*
- php: 8.2
laravel: 7.*
laravel: 6.*
- php: 8.3
laravel: 6.*

name: PHP ${{ matrix.php }} - Laravel ${{ matrix.laravel }}

steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, curl, libxml, mbstring, zip, json
coverage: none
coverage: pcov

- name: Install dependencies
run: |
composer require "illuminate/contracts=${{ matrix.laravel }}" --no-update
composer update --prefer-dist --no-interaction --no-progress
- name: Execute tests
run: vendor/bin/phpunit --verbose --configuration=phpunit.xml.dist
- name: Grab PHPUnit version
id: phpunit_version
run: echo "VERSION=$(vendor/bin/phpunit --version | grep --only-matching --max-count=1 --extended-regexp '\b[0-9]+\.[0-9]+')" >> $GITHUB_OUTPUT

- name: Execute tests (PHPUnit 10)
if: ${{ startsWith(steps.phpunit_version.outputs.VERSION, '10.') }}
run: vendor/bin/phpunit --configuration=phpunit10.xml.dist

- name: Execute tests (PHPUnit < 10)
if: ${{ !startsWith(steps.phpunit_version.outputs.VERSION, '10.') }}
run: vendor/bin/phpunit --configuration=phpunit.xml.dist
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ composer.lock
.idea
build
.phpunit.result.cache
.phpunit.cache
20 changes: 10 additions & 10 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,20 @@
"require": {
"php": ">=7.4|^8.0",
"guzzlehttp/guzzle": "^7.0",
"illuminate/support": "^6.0|^7.0|^8.0|^9.0|^10.0",
"illuminate/console": "^6.0|^7.0|^8.0|^9.0|^10.0",
"illuminate/bus": "^6.0|^7.0|^8.0|^9.0|^10.0",
"illuminate/mail": "^6.0|^7.0|^8.0|^9.0|^10.0",
"illuminate/queue": "^6.0|^7.0|^8.0|^9.0|^10.0",
"illuminate/notifications": "^6.0|^7.0|^8.0|^9.0|^10.0",
"illuminate/support": "^6.0|^7.0|^8.0|^9.0|^10.0|^11.0",
"illuminate/console": "^6.0|^7.0|^8.0|^9.0|^10.0|^11.0",
"illuminate/bus": "^6.0|^7.0|^8.0|^9.0|^10.0|^11.0",
"illuminate/mail": "^6.0|^7.0|^8.0|^9.0|^10.0|^11.0",
"illuminate/queue": "^6.0|^7.0|^8.0|^9.0|^10.0|^11.0",
"illuminate/notifications": "^6.0|^7.0|^8.0|^9.0|^10.0|^11.0",
"ext-json": "*",
"enlightn/security-checker": "^1.3"
"enlightn/security-checker": "^1.3|^2.0"
},
"require-dev": {
"laravel/slack-notification-channel": "^1.0|^2.0",
"phpunit/phpunit": "^6.0|^7.0|^8.0|^9.0",
"laravel/slack-notification-channel": "^1.0|^2.0|^3.2",
"phpunit/phpunit": "^6.0|^7.0|^8.0|^9.0|^10.5",
"squizlabs/php_codesniffer": "~2.3|^3.6",
"orchestra/testbench": "^4.0|^5.0|^6.0|^7.0|^8.0",
"orchestra/testbench": "^4.0|^5.0|^6.0|^7.0|^8.0|^9.0",
"mockery/mockery": "^1.2"
},
"suggest": {
Expand Down
27 changes: 27 additions & 0 deletions phpunit10.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
bootstrap="vendor/autoload.php"
colors="true"
cacheDirectory=".phpunit.cache">
<testsuites>
<testsuite name=":vendor Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>
<coverage>
<report>
<html outputDirectory="build/coverage"/>
<text outputFile="build/coverage.txt"/>
<clover outputFile="build/logs/clover.xml"/>
</report>
</coverage>
<logging>
<junit outputFile="build/report.junit.xml"/>
</logging>
<source>
<include>
<directory>./src</directory>
</include>
</source>
</phpunit>

0 comments on commit cd5ca29

Please sign in to comment.