Skip to content

Commit e8338cc

Browse files
authored
Merge pull request #9 from laravel-shift/l12-compatibility
Laravel 12.x Compatibility
2 parents 903f06b + fcb8ba2 commit e8338cc

File tree

2 files changed

+102
-92
lines changed

2 files changed

+102
-92
lines changed

.github/workflows/tests.yml

+95-85
Original file line numberDiff line numberDiff line change
@@ -1,85 +1,95 @@
1-
name: Run tests
2-
3-
on: [ push, pull_request ]
4-
5-
jobs:
6-
php-tests:
7-
runs-on: ubuntu-latest
8-
9-
strategy:
10-
fail-fast: false
11-
matrix:
12-
php: [ 7.4, '8.0', 8.1, 8.2, 8.3 ]
13-
laravel: [ 8.*, 9.*, 10.*, 11.* ]
14-
stability: [ prefer-stable ]
15-
exclude:
16-
- laravel: 8.*
17-
php: 8.2
18-
- laravel: 8.*
19-
php: 8.3
20-
- laravel: 9.*
21-
php: 7.4
22-
- laravel: 9.*
23-
php: 8.3
24-
- laravel: 10.*
25-
php: 7.4
26-
- laravel: 10.*
27-
php: '8.0'
28-
- laravel: 11.*
29-
php: 7.4
30-
- laravel: 11.*
31-
php: '8.0'
32-
- laravel: 11.*
33-
php: 8.1
34-
include:
35-
- laravel: 8.*
36-
phpunit: ^9.5
37-
- laravel: 9.*
38-
phpunit: ^9.5
39-
- laravel: 10.*
40-
phpunit: ^10.5
41-
- laravel: 11.*
42-
phpunit: ^10.5
43-
44-
name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }}
45-
46-
steps:
47-
- name: Checkout code
48-
uses: actions/checkout@v4
49-
with:
50-
# Fetch 10 commits or Scrutinizer will throw
51-
fetch-depth: 10
52-
53-
- name: Setup PHP
54-
uses: shivammathur/setup-php@v2
55-
with:
56-
php-version: ${{ matrix.php }}
57-
coverage: xdebug
58-
tools: composer:v2
59-
60-
- name: Get composer cache directory
61-
id: composer-cache
62-
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
63-
64-
- name: Cache composer dependencies
65-
uses: actions/cache@v4
66-
with:
67-
path: ${{ steps.composer-cache.outputs.dir }}
68-
key: php-${{ matrix.php }}-laravel-${{ matrix.laravel }}-composer-${{ matrix.stability }}-${{ hashFiles('**/composer.json') }}
69-
restore-keys: php-${{ matrix.php }}-laravel-${{ matrix.laravel }}-composer-${{ matrix.stability }}-
70-
71-
- name: Install dependencies
72-
run: |
73-
composer require "illuminate/contracts:${{ matrix.laravel }}" --no-interaction --no-update
74-
composer require "phpunit/phpunit:${{ matrix.phpunit }}" --dev --no-interaction --no-update
75-
composer update --${{ matrix.stability }} --prefer-dist --no-interaction
76-
77-
- name: Execute tests
78-
run: XDEBUG_MODE=coverage vendor/bin/phpunit --configuration=${{ matrix.phpunit == '^9.5' && 'phpunit-9.xml' || 'phpunit.xml' }} --coverage-text --coverage-clover=coverage.clover
79-
80-
- name: Upload Scrutinizer coverage
81-
uses: sudo-bot/action-scrutinizer@latest
82-
# Do not run this step on forked versions of the main repository (example: contributor forks)
83-
if: matrix.laravel == '9.*' && github.repository == 'swisnl/json-api-client-laravel'
84-
with:
85-
cli-args: "--format=php-clover coverage.clover --revision=${{ github.event.pull_request.head.sha || github.sha }}"
1+
name: Run tests
2+
3+
on:
4+
- push
5+
- pull_request
6+
7+
jobs:
8+
php-tests:
9+
runs-on: ubuntu-latest
10+
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
php: [7.4, '8.0', 8.1, 8.2, 8.3]
15+
laravel: ['8.*', '9.*', '10.*', '11.*', '12.*']
16+
stability: [prefer-stable]
17+
exclude:
18+
- laravel: 8.*
19+
php: 8.2
20+
- laravel: 8.*
21+
php: 8.3
22+
- laravel: 9.*
23+
php: 7.4
24+
- laravel: 9.*
25+
php: 8.3
26+
- laravel: 10.*
27+
php: 7.4
28+
- laravel: 10.*
29+
php: '8.0'
30+
- laravel: 11.*
31+
php: 7.4
32+
- laravel: 11.*
33+
php: '8.0'
34+
- laravel: 11.*
35+
php: 8.1
36+
- laravel: 12.*
37+
php: 7.4
38+
- laravel: 12.*
39+
php: '8.0'
40+
- laravel: 12.*
41+
php: 8.1
42+
include:
43+
- laravel: 8.*
44+
phpunit: ^9.5
45+
- laravel: 9.*
46+
phpunit: ^9.5
47+
- laravel: 10.*
48+
phpunit: ^10.5
49+
- laravel: 11.*
50+
phpunit: ^10.5
51+
- laravel: 12.*
52+
phpunit: ^11.5
53+
54+
name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }}
55+
56+
steps:
57+
- name: Checkout code
58+
uses: actions/checkout@v4
59+
with:
60+
# Fetch 10 commits or Scrutinizer will throw
61+
fetch-depth: 10
62+
63+
- name: Setup PHP
64+
uses: shivammathur/setup-php@v2
65+
with:
66+
php-version: ${{ matrix.php }}
67+
coverage: xdebug
68+
tools: composer:v2
69+
70+
- name: Get composer cache directory
71+
id: composer-cache
72+
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
73+
74+
- name: Cache composer dependencies
75+
uses: actions/cache@v4
76+
with:
77+
path: ${{ steps.composer-cache.outputs.dir }}
78+
key: php-${{ matrix.php }}-laravel-${{ matrix.laravel }}-composer-${{ matrix.stability }}-${{ hashFiles('**/composer.json') }}
79+
restore-keys: php-${{ matrix.php }}-laravel-${{ matrix.laravel }}-composer-${{ matrix.stability }}-
80+
81+
- name: Install dependencies
82+
run: |
83+
composer require "illuminate/contracts:${{ matrix.laravel }}" --no-interaction --no-update
84+
composer require "phpunit/phpunit:${{ matrix.phpunit }}" --dev --no-interaction --no-update
85+
composer update --${{ matrix.stability }} --prefer-dist --no-interaction
86+
87+
- name: Execute tests
88+
run: XDEBUG_MODE=coverage vendor/bin/phpunit --configuration=${{ matrix.phpunit == '^9.5' && 'phpunit-9.xml' || 'phpunit.xml' }} --coverage-text --coverage-clover=coverage.clover
89+
90+
- name: Upload Scrutinizer coverage
91+
uses: sudo-bot/action-scrutinizer@latest
92+
# Do not run this step on forked versions of the main repository (example: contributor forks)
93+
if: "matrix.laravel == '9.*' && github.repository == 'swisnl/json-api-client-laravel'"
94+
with:
95+
cli-args: --format=php-clover coverage.clover --revision=${{ github.event.pull_request.head.sha || github.sha }}

composer.json

+7-7
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,25 @@
44
"description": "A PHP package for mapping remote JSON:API resources to Eloquent like models and collections.",
55
"require": {
66
"php": "^7.4|^8.0",
7-
"illuminate/support": "^8.0|^9.0|^10.0|^11.0",
7+
"illuminate/support": "^8.0|^9.0|^10.0|^11.0|^12.0",
88
"swisnl/json-api-client": "^2.0"
99
},
1010
"require-dev": {
1111
"friendsofphp/php-cs-fixer": "^3.0",
1212
"guzzlehttp/guzzle": "^7.3",
1313
"guzzlehttp/psr7": "^2.1",
14-
"orchestra/testbench": "^6.15|^7.0|^8.0|^9.0",
15-
"phpunit/phpunit": "^9.5|^10.5"
14+
"orchestra/testbench": "^6.15|^7.0|^8.0|^9.0|^10.0",
15+
"phpunit/phpunit": "^9.5|^10.5|^11.5.3"
1616
},
1717
"autoload": {
1818
"psr-4": {
1919
"Swis\\JsonApi\\Client\\": "src/"
2020
}
2121
},
2222
"autoload-dev": {
23-
"psr-4" : {
24-
"Swis\\JsonApi\\Client\\Tests\\" : "tests/",
25-
"Swis\\JsonApi\\Client\\Tests\\Mocks\\" : "tests/_mocks/"
23+
"psr-4": {
24+
"Swis\\JsonApi\\Client\\Tests\\": "tests/",
25+
"Swis\\JsonApi\\Client\\Tests\\Mocks\\": "tests/_mocks/"
2626
}
2727
},
2828
"license": "MIT",
@@ -47,7 +47,7 @@
4747
"providers": [
4848
"Swis\\JsonApi\\Client\\Providers\\ServiceProvider"
4949
],
50-
"aliases":{
50+
"aliases": {
5151
"DocumentFactory": "Swis\\JsonApi\\Client\\Facades\\DocumentFactoryFacade",
5252
"DocumentParser": "Swis\\JsonApi\\Client\\Facades\\DocumentParserFacade",
5353
"ItemHydrator": "Swis\\JsonApi\\Client\\Facades\\ItemHydratorFacade",

0 commit comments

Comments
 (0)