Skip to content

Laravel 12.x Compatibility #9

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
180 changes: 95 additions & 85 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,85 +1,95 @@
name: Run tests

on: [ push, pull_request ]

jobs:
php-tests:
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
php: [ 7.4, '8.0', 8.1, 8.2, 8.3 ]
laravel: [ 8.*, 9.*, 10.*, 11.* ]
stability: [ prefer-stable ]
exclude:
- laravel: 8.*
php: 8.2
- laravel: 8.*
php: 8.3
- laravel: 9.*
php: 7.4
- laravel: 9.*
php: 8.3
- laravel: 10.*
php: 7.4
- laravel: 10.*
php: '8.0'
- laravel: 11.*
php: 7.4
- laravel: 11.*
php: '8.0'
- laravel: 11.*
php: 8.1
include:
- laravel: 8.*
phpunit: ^9.5
- laravel: 9.*
phpunit: ^9.5
- laravel: 10.*
phpunit: ^10.5
- laravel: 11.*
phpunit: ^10.5

name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }}

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
# Fetch 10 commits or Scrutinizer will throw
fetch-depth: 10

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: xdebug
tools: composer:v2

- 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: php-${{ matrix.php }}-laravel-${{ matrix.laravel }}-composer-${{ matrix.stability }}-${{ hashFiles('**/composer.json') }}
restore-keys: php-${{ matrix.php }}-laravel-${{ matrix.laravel }}-composer-${{ matrix.stability }}-

- name: Install dependencies
run: |
composer require "illuminate/contracts:${{ matrix.laravel }}" --no-interaction --no-update
composer require "phpunit/phpunit:${{ matrix.phpunit }}" --dev --no-interaction --no-update
composer update --${{ matrix.stability }} --prefer-dist --no-interaction

- name: Execute tests
run: XDEBUG_MODE=coverage vendor/bin/phpunit --configuration=${{ matrix.phpunit == '^9.5' && 'phpunit-9.xml' || 'phpunit.xml' }} --coverage-text --coverage-clover=coverage.clover

- name: Upload Scrutinizer coverage
uses: sudo-bot/action-scrutinizer@latest
# Do not run this step on forked versions of the main repository (example: contributor forks)
if: matrix.laravel == '9.*' && github.repository == 'swisnl/json-api-client-laravel'
with:
cli-args: "--format=php-clover coverage.clover --revision=${{ github.event.pull_request.head.sha || github.sha }}"
name: Run tests

on:
- push
- pull_request

jobs:
php-tests:
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
php: [7.4, '8.0', 8.1, 8.2, 8.3]
laravel: ['8.*', '9.*', '10.*', '11.*', '12.*']
stability: [prefer-stable]
exclude:
- laravel: 8.*
php: 8.2
- laravel: 8.*
php: 8.3
- laravel: 9.*
php: 7.4
- laravel: 9.*
php: 8.3
- laravel: 10.*
php: 7.4
- laravel: 10.*
php: '8.0'
- laravel: 11.*
php: 7.4
- laravel: 11.*
php: '8.0'
- laravel: 11.*
php: 8.1
- laravel: 12.*
php: 7.4
- laravel: 12.*
php: '8.0'
- laravel: 12.*
php: 8.1
include:
- laravel: 8.*
phpunit: ^9.5
- laravel: 9.*
phpunit: ^9.5
- laravel: 10.*
phpunit: ^10.5
- laravel: 11.*
phpunit: ^10.5
- laravel: 12.*
phpunit: ^11.5

name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }}

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
# Fetch 10 commits or Scrutinizer will throw
fetch-depth: 10

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: xdebug
tools: composer:v2

- 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: php-${{ matrix.php }}-laravel-${{ matrix.laravel }}-composer-${{ matrix.stability }}-${{ hashFiles('**/composer.json') }}
restore-keys: php-${{ matrix.php }}-laravel-${{ matrix.laravel }}-composer-${{ matrix.stability }}-

- name: Install dependencies
run: |
composer require "illuminate/contracts:${{ matrix.laravel }}" --no-interaction --no-update
composer require "phpunit/phpunit:${{ matrix.phpunit }}" --dev --no-interaction --no-update
composer update --${{ matrix.stability }} --prefer-dist --no-interaction

- name: Execute tests
run: XDEBUG_MODE=coverage vendor/bin/phpunit --configuration=${{ matrix.phpunit == '^9.5' && 'phpunit-9.xml' || 'phpunit.xml' }} --coverage-text --coverage-clover=coverage.clover

- name: Upload Scrutinizer coverage
uses: sudo-bot/action-scrutinizer@latest
# Do not run this step on forked versions of the main repository (example: contributor forks)
if: "matrix.laravel == '9.*' && github.repository == 'swisnl/json-api-client-laravel'"
with:
cli-args: --format=php-clover coverage.clover --revision=${{ github.event.pull_request.head.sha || github.sha }}
14 changes: 7 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,25 @@
"description": "A PHP package for mapping remote JSON:API resources to Eloquent like models and collections.",
"require": {
"php": "^7.4|^8.0",
"illuminate/support": "^8.0|^9.0|^10.0|^11.0",
"illuminate/support": "^8.0|^9.0|^10.0|^11.0|^12.0",
"swisnl/json-api-client": "^2.0"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.0",
"guzzlehttp/guzzle": "^7.3",
"guzzlehttp/psr7": "^2.1",
"orchestra/testbench": "^6.15|^7.0|^8.0|^9.0",
"phpunit/phpunit": "^9.5|^10.5"
"orchestra/testbench": "^6.15|^7.0|^8.0|^9.0|^10.0",
"phpunit/phpunit": "^9.5|^10.5|^11.5.3"
},
"autoload": {
"psr-4": {
"Swis\\JsonApi\\Client\\": "src/"
}
},
"autoload-dev": {
"psr-4" : {
"Swis\\JsonApi\\Client\\Tests\\" : "tests/",
"Swis\\JsonApi\\Client\\Tests\\Mocks\\" : "tests/_mocks/"
"psr-4": {
"Swis\\JsonApi\\Client\\Tests\\": "tests/",
"Swis\\JsonApi\\Client\\Tests\\Mocks\\": "tests/_mocks/"
}
},
"license": "MIT",
Expand All @@ -47,7 +47,7 @@
"providers": [
"Swis\\JsonApi\\Client\\Providers\\ServiceProvider"
],
"aliases":{
"aliases": {
"DocumentFactory": "Swis\\JsonApi\\Client\\Facades\\DocumentFactoryFacade",
"DocumentParser": "Swis\\JsonApi\\Client\\Facades\\DocumentParserFacade",
"ItemHydrator": "Swis\\JsonApi\\Client\\Facades\\ItemHydratorFacade",
Expand Down