Skip to content

Commit

Permalink
Update deps (spawnia#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
spawnia authored Feb 15, 2021
1 parent ec8fa0d commit e689e00
Show file tree
Hide file tree
Showing 10 changed files with 130 additions and 99 deletions.
82 changes: 51 additions & 31 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,18 @@ jobs:

steps:
- name: "Checkout"
uses: "actions/checkout@v2.0.0"
uses: actions/checkout@v2
with:
ref: "${{ github.head_ref }}"
ref: ${{ github.head_ref }}

- name: "Run composer normalize"
uses: "docker://ergebnis/composer-normalize-action:0.8.0"
uses: docker://ergebnis/composer-normalize-action:0.8.0

- uses: "stefanzweifel/[email protected]"
- name: "Commit normalized composer.json"
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: "Normalize composer.json"
branch: "${{ github.head_ref }}"
commit_message: Normalize composer.json
branch: ${{ github.head_ref }}

coding-standards:
name: "Coding Standards"
Expand All @@ -35,13 +36,13 @@ jobs:

steps:
- name: "Checkout"
uses: actions/checkout@master
uses: actions/checkout@v2

- name: "Validate composer.json and composer.lock"
run: php7.3 /usr/bin/composer validate
run: php7.4 /usr/bin/composer validate

- name: "Install locked dependencies with composer"
run: php7.3 /usr/bin/composer install --no-interaction --no-progress --no-suggest
run: php7.4 /usr/bin/composer install --no-interaction --no-progress

static-code-analysis:
name: "Static Code Analysis"
Expand All @@ -50,13 +51,13 @@ jobs:

steps:
- name: "Checkout"
uses: actions/checkout@master
uses: actions/checkout@v2

- name: "Install locked dependencies with composer"
run: php7.3 /usr/bin/composer install --no-interaction --no-progress --no-suggest
run: php7.4 /usr/bin/composer install --no-interaction --no-progress

- name: "Run phpstan/phpstan"
run: php7.3 vendor/bin/phpstan analyse --configuration=phpstan.neon
run: php7.4 vendor/bin/phpstan analyse --configuration=phpstan.neon

tests:
name: "Tests"
Expand All @@ -66,9 +67,8 @@ jobs:
strategy:
matrix:
php-version:
- 7.2
- 7.3
- 7.4
- 8.0

dependencies:
- lowest
Expand All @@ -77,26 +77,26 @@ jobs:

steps:
- name: "Checkout"
uses: actions/checkout@master
uses: actions/checkout@v2

- name: "Install PHP with extensions"
uses: shivammathur/setup-php@1.6.1
- name: "Setup PHP"
uses: shivammathur/setup-php@v2
with:
coverage: none
extensions: "mbstring"
extensions: mbstring
php-version: ${{ matrix.php-version }}

- name: "Install lowest dependencies with composer"
if: matrix.dependencies == 'lowest'
run: composer update --prefer-lowest --no-interaction --no-progress --no-suggest
run: composer update --prefer-lowest --no-interaction --no-progress

- name: "Install locked dependencies with composer"
if: matrix.dependencies == 'locked'
run: composer install --no-interaction --no-progress --no-suggest
run: composer install --no-interaction --no-progress

- name: "Install highest dependencies with composer"
if: matrix.dependencies == 'highest'
run: composer update --no-interaction --no-progress --no-suggest
run: composer update --no-interaction --no-progress

- name: "Run unit tests with phpunit/phpunit"
run: vendor/bin/phpunit
Expand All @@ -114,7 +114,16 @@ jobs:

steps:
- name: "Checkout"
uses: actions/checkout@master
uses: actions/checkout@v2

- name: "Setup PHP"
uses: shivammathur/setup-php@v2
with:
coverage: none
extensions: mbstring
php-version: 7.4
env:
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: "Run the integration tests in each example"
run: cd examples/${{ matrix.example }} && ./test.sh
Expand All @@ -126,16 +135,20 @@ jobs:

steps:
- name: "Checkout"
uses: actions/checkout@master
uses: actions/checkout@v2

- name: "Install locked dependencies with composer"
run: php7.3 /usr/bin/composer install --no-interaction --no-progress --no-suggest
- name: "Setup PHP"
uses: shivammathur/setup-php@v2
with:
coverage: pcov
extensions: mbstring
php-version: 7.4

- name: "Dump Xdebug filter with phpunit/phpunit"
run: php7.3 vendor/bin/phpunit --dump-xdebug-filter=.build/phpunit/xdebug-filter.php
- name: "Install locked dependencies with composer"
run: composer install --no-interaction --no-progress

- name: "Collect code coverage with Xdebug and phpunit/phpunit"
run: php7.3 vendor/bin/phpunit --coverage-clover=build/logs/clover.xml --prepend=.build/phpunit/xdebug-filter.php
run: vendor/bin/phpunit --coverage-clover=build/logs/clover.xml

# Not using codecov/codecov-action for now, as the build is prohibitively slow
- name: "Download code coverage uploader for Codecov.io"
Expand All @@ -151,10 +164,17 @@ jobs:

steps:
- name: "Checkout"
uses: actions/checkout@master
uses: actions/checkout@v2

- name: "Setup PHP"
uses: shivammathur/setup-php@v2
with:
coverage: xdebug
extensions: mbstring
php-version: 7.4

- name: "Install locked dependencies with composer"
run: php7.3 /usr/bin/composer install --no-interaction --no-progress --no-suggest
run: composer install --no-interaction --no-progress

- name: "Run mutation tests with infection/infection"
run: php7.3 vendor/bin/infection --ignore-msi-with-no-mutations --min-covered-msi=70 --min-msi=70
run: vendor/bin/infection
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,15 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

## Unreleased

### Added

- Support PHP 8

### Changed

- Require PHP 7.4 or 8
- Require newer versions of various dependencies

## v0.1.0

### Added
Expand Down
40 changes: 20 additions & 20 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,31 +11,31 @@
}
],
"require": {
"php": "^7.2",
"guzzlehttp/guzzle": "^6.3",
"nette/php-generator": "^3.3.1",
"psr/http-client": "^1.0",
"symfony/console": "^4.3",
"thecodingmachine/safe": "^1.0.0",
"webonyx/graphql-php": "^14.0.2"
"php": "^7.4 || ^8",
"guzzlehttp/guzzle": "^7",
"nette/php-generator": "^3.5",
"psr/http-client": "^1",
"symfony/console": "^5",
"thecodingmachine/safe": "^1",
"webonyx/graphql-php": "^14"
},
"require-dev": {
"composer/composer": "^1.9",
"infection/infection": "~0.13.6",
"jangregor/phpstan-prophecy": "~0.8.0",
"phpstan/extension-installer": "^1.0",
"phpstan/phpstan": "~0.12.4",
"phpstan/phpstan-deprecation-rules": "~0.12.5",
"phpstan/phpstan-phpunit": "~0.12.5",
"phpstan/phpstan-strict-rules": "~0.12.1",
"phpunit/phpunit": "^8.5.2",
"spawnia/phpunit-assert-directory": "^2.0.0",
"symfony/var-dumper": "^4.4.2",
"thecodingmachine/phpstan-safe-rule": "^1.0.0"
"composer/composer": "^2",
"infection/infection": "~0.21",
"jangregor/phpstan-prophecy": "~0.8.1",
"phpstan/extension-installer": "^1",
"phpstan/phpstan": "~0.12.76",
"phpstan/phpstan-deprecation-rules": "~0.12.6",
"phpstan/phpstan-phpunit": "~0.12.17",
"phpstan/phpstan-strict-rules": "~0.12.9",
"phpunit/phpunit": "^9.5.2",
"spawnia/phpunit-assert-directory": "^2",
"symfony/var-dumper": "^5.2.3",
"thecodingmachine/phpstan-safe-rule": "^1"
},
"config": {
"platform": {
"php": "7.3.9"
"php": "7.4.15"
},
"preferred-install": "dist",
"sort-packages": true
Expand Down
6 changes: 0 additions & 6 deletions examples/install/composer.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
{
"repositories": [
{
"type": "vcs",
"url": "https://github.com/spawnia/graphql-php.git"
}
],
"require": {
"spawnia/sailor": "*"
},
Expand Down
6 changes: 0 additions & 6 deletions examples/simple/composer.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
{
"repositories": [
{
"type": "vcs",
"url": "https://github.com/spawnia/graphql-php.git"
}
],
"require": {
"spawnia/sailor": "*"
},
Expand Down
2 changes: 1 addition & 1 deletion phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ parameters:
- src
- tests
tmpDir: %currentWorkingDirectory%/.build/phpstan
excludes_analyse:
excludePaths:
# This is where raw data is magically mapped to typed data
- %rootDir%/../../../src/TypedObject.php
ignoreErrors:
Expand Down
57 changes: 28 additions & 29 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,27 +1,31 @@
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
beStrictAboutChangesToGlobalState="true"
beStrictAboutCoversAnnotation="true"
beStrictAboutOutputDuringTests="true"
beStrictAboutResourceUsageDuringSmallTests="true"
beStrictAboutTestsThatDoNotTestAnything="true"
beStrictAboutTodoAnnotatedTests="true"
bootstrap="vendor/autoload.php"
cacheResult="true"
cacheResultFile=".build/phpunit/unit.cache"
colors="true"
columns="max"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
executionOrder="random"
stopOnError="false"
stopOnFailure="false"
stopOnIncomplete="false"
stopOnSkipped="false"
verbose="true"
>
<?xml version="1.0"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
beStrictAboutChangesToGlobalState="true"
beStrictAboutCoversAnnotation="true"
beStrictAboutOutputDuringTests="true"
beStrictAboutResourceUsageDuringSmallTests="true"
beStrictAboutTestsThatDoNotTestAnything="true"
beStrictAboutTodoAnnotatedTests="true"
bootstrap="vendor/autoload.php"
cacheResult="true"
cacheResultFile=".build/phpunit/unit.cache"
colors="true"
columns="max"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
executionOrder="random"
stopOnError="false"
stopOnFailure="false"
stopOnIncomplete="false"
stopOnSkipped="false"
verbose="true">
<coverage includeUncoveredFiles="true" processUncoveredFiles="true">
<include>
<directory suffix=".php">src</directory>
</include>
</coverage>
<testsuites>
<testsuite name="Unit">
<directory>tests/Unit</directory>
Expand All @@ -30,9 +34,4 @@
<directory>tests/Integration</directory>
</testsuite>
</testsuites>
<filter>
<whitelist addUncoveredFilesFromWhitelist="true" processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">src</directory>
</whitelist>
</filter>
</phpunit>
8 changes: 3 additions & 5 deletions src/Codegen/Merger.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
namespace Spawnia\Sailor\Codegen;

use GraphQL\Language\AST\DocumentNode;
use GraphQL\Language\AST\Node;
use GraphQL\Language\AST\NodeList;

class Merger
Expand All @@ -18,13 +17,12 @@ public static function combine(array $documents): DocumentNode
/** @var DocumentNode $root */
$root = array_pop($documents);

// @phpstan-ignore-next-line Contravariance
$root->definitions = array_reduce(
$documents,
static function (NodeList $definitions, DocumentNode $document): NodeList {
/** @var NodeList<Node> $nodeList */
$nodeList = $document->definitions;

return $definitions->merge($nodeList);
// @phpstan-ignore-next-line Contravariance
return $definitions->merge($document->definitions);
},
$root->definitions
);
Expand Down
17 changes: 17 additions & 0 deletions tests/Unit/Testing/Invokable.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

declare(strict_types=1);

namespace Spawnia\Sailor\Tests\Unit\Testing;

/**
* Stub class to allow creating a partial mock.
*/
class Invokable
{
// @phpstan-ignore-next-line
public function __invoke()
{
//
}
}
2 changes: 1 addition & 1 deletion tests/Unit/Testing/MockClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function testCallsMock(): void
$response = new Response();

/** @var MockObject&callable $responseMock */
$responseMock = self::createPartialMock(\stdClass::class, ['__invoke']);
$responseMock = self::createPartialMock(Invokable::class, ['__invoke']);
$responseMock->expects(self::once())
->method('__invoke')
->with($query, $variables)
Expand Down

0 comments on commit e689e00

Please sign in to comment.