Skip to content

Commit

Permalink
Merge pull request #879 from mfn/mp-l9
Browse files Browse the repository at this point in the history
Add Support for Laravel 9
  • Loading branch information
mfn authored Jan 15, 2022
2 parents 29d0c1e + b277a5f commit 1edaf61
Show file tree
Hide file tree
Showing 8 changed files with 68 additions and 22 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:

- uses: shivammathur/setup-php@v2
with:
php-version: 8.0
php-version: 8.1
coverage: none

# Remove unnecessary dependencies not needed in this context
Expand Down Expand Up @@ -58,7 +58,7 @@ jobs:

- uses: shivammathur/setup-php@v2
with:
php-version: 7.4
php-version: 8.1
coverage: none

- name: Get composer cache directory
Expand Down
32 changes: 27 additions & 5 deletions .github/workflows/integration_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,27 @@ on:

jobs:
integration:
name: laravel
strategy:
fail-fast: false
matrix:
php: [7.2, 7.3, 7.4, 8.0, 8.1]
laravel: [^6.0, ^7.0, ^8.0, ^9.0]
exclude:
- php: 7.2
laravel: ^8.0
- php: 7.2
laravel: ^9.0
- php: 7.3
laravel: ^9.0
- php: 7.4
laravel: ^9.0
- php: 8.0
laravel: ^6.0
- php: 8.1
laravel: ^6.0
- php: 8.1
laravel: ^7.0
name: P=${{ matrix.php }} L=${{ matrix.laravel }}
runs-on: ubuntu-latest
env:
COMPOSER_NO_INTERACTION: 1
Expand All @@ -28,13 +48,15 @@ jobs:

- uses: shivammathur/setup-php@v2
with:
php-version: 8.0
php-version: ${{ matrix.php }}
coverage: none

# Due to version incompatibility with older Laravels we test, we remove it
- run: composer remove --dev friendsofphp/php-cs-fixer --no-update
- run: composer remove --dev nunomaduro/larastan --no-update
- run: composer require illuminate/contracts:^8.0 --no-update
- run: composer remove --dev friendsofphp/php-cs-fixer --no-update
- run: composer remove --dev laravel/legacy-factories --no-update
if: (matrix.laravel == '^6.0' || matrix.laravel == '^7.0')
- run: composer require illuminate/contracts:${{ matrix.laravel }} --no-update

- name: Get composer cache directory
id: composercache
Expand All @@ -49,4 +71,4 @@ jobs:

- run: composer install --prefer-dist

- run: tests/integration-laravel.sh
- run: tests/integration-laravel.sh ${{ matrix.laravel }}
10 changes: 8 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,22 @@ on:
workflow_dispatch:

jobs:
integration:
tests:
strategy:
fail-fast: false
matrix:
php: [7.2, 7.3, 7.4, 8.0, 8.1]
laravel: [^6.0, ^7.0, ^8.0]
laravel: [^6.0, ^7.0, ^8.0, ^9.0]
lazy_types: ['false', 'true']
exclude:
- php: 7.2
laravel: ^8.0
- php: 7.2
laravel: ^9.0
- php: 7.3
laravel: ^9.0
- php: 7.4
laravel: ^9.0
- php: 8.0
laravel: ^6.0
- php: 8.1
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ CHANGELOG

[Next release](https://github.com/rebing/graphql-laravel/compare/8.0.0...master)
--------------
### Added
- Support for Laravel 9 [\#879 / mfn](https://github.com/rebing/graphql-laravel/pull/879)

2021-11-15, 8.0.0
-----------------
Expand Down
8 changes: 4 additions & 4 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
FROM php:8.1.0-cli-alpine
FROM php:8.1.1-cli-alpine

COPY --from=mlocati/php-extension-installer:1.4.2 /usr/bin/install-php-extensions /usr/local/bin/
COPY --from=mlocati/php-extension-installer:1.4.12 /usr/bin/install-php-extensions /usr/local/bin/

RUN install-php-extensions \
xdebug && \
rm /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini

COPY --from=composer:2.1.14 /usr/bin/composer /usr/local/bin/
COPY --from=composer:2.2.4 /usr/bin/composer /usr/local/bin/

COPY ./ /app
RUN mkdir /app

WORKDIR /app
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
"require": {
"php": ">= 7.2",
"ext-json": "*",
"illuminate/contracts": "^6.0|^7.0|^8.0",
"illuminate/support": "^6.0|^7.0|^8.0",
"illuminate/contracts": "^6.0|^7.0|^8.0|^9.0",
"illuminate/support": "^6.0|^7.0|^8.0|^9.0",
"laragraph/utils": "^1",
"thecodingmachine/safe": "^1.3",
"webonyx/graphql-php": "^14.6.4"
Expand All @@ -49,7 +49,7 @@
"mfn/php-cs-fixer-config": "^2",
"mockery/mockery": "^1.2",
"nunomaduro/larastan": "^1",
"orchestra/testbench": "4.0.*|5.0.*|^6.0",
"orchestra/testbench": "4.0.*|5.0.*|^6.0|^7.0",
"phpstan/phpstan": "^1",
"phpunit/phpunit": "~7.0|~8.0|^9",
"thecodingmachine/phpstan-safe-rule": "^1"
Expand Down
5 changes: 5 additions & 0 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ parameters:
count: 2
path: src/GraphQL.php

-
message: "#^Property Rebing\\\\GraphQL\\\\GraphQL\\:\\:\\$types \\(array\\<string, object\\|string\\>\\) does not accept array\\<int\\|string, object\\|string\\>\\.$#"
count: 1
path: src/GraphQL.php

-
message: "#^Access to an undefined property GraphQL\\\\Type\\\\Definition\\\\InputObjectField\\|stdClass\\:\\:\\$alias\\.$#"
count: 1
Expand Down
23 changes: 17 additions & 6 deletions tests/integration-laravel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,33 @@
#
# This script is meant to be run on CI environments

LARAVEL_VERSION="$1"
if [[ "$LARAVEL_VERSION" = "" ]]; then
echo "ERROR: Usage of this script is: $0 <laravel version>"
exit 1
fi

# TODO: temporary until laravel/laravel for 9 was released
if [[ "$LARAVEL_VERSION" = "^9.0" ]]; then
LARAVEL_VERSION=dev-master
fi

echo "Install Laravel"
composer create-project --quiet --prefer-dist "laravel/laravel" ../laravel
composer create-project --prefer-dist laravel/laravel:$LARAVEL_VERSION ../laravel || exit 1
cd ../laravel

echo "Add package from source"
sed -e 's|"type": "project",|&\n"repositories": [ { "type": "path", "url": "../graphql-laravel" } ],|' -i composer.json
composer require --dev "rebing/graphql-laravel:*"
sed -e 's|"type": "project",|&\n"repositories": [ { "type": "path", "url": "../graphql-laravel" } ],|' -i composer.json || exit 1
composer require --dev "rebing/graphql-laravel:*" || exit 1

echo "Publish vendor files"
php artisan vendor:publish --provider="Rebing\GraphQL\GraphQLServiceProvider"
php artisan vendor:publish --provider="Rebing\GraphQL\GraphQLServiceProvider" || exit 1

echo "Make GraphQL ExampleQuery"
php artisan make:graphql:query ExampleQuery
php artisan make:graphql:query ExampleQuery || exit 1

echo "Add ExampleQuery to config"
sed -e "s|// ExampleQuery::class,|\\\App\\\GraphQL\\\Queries\\\ExampleQuery::class,|" -i config/graphql.php
sed -e "s|// ExampleQuery::class,|\\\App\\\GraphQL\\\Queries\\\ExampleQuery::class,|" -i config/graphql.php || exit 1

echo "Start Webserver"
php -S 127.0.0.1:8001 -t public >/dev/null 2>&1 &
Expand Down

0 comments on commit 1edaf61

Please sign in to comment.