Skip to content

Commit

Permalink
Merge pull request #46 from mcg-web/fix-ci
Browse files Browse the repository at this point in the history
Fix ci
  • Loading branch information
mcg-web authored Nov 22, 2024
2 parents c43f73d + bb83b9d commit 68520e0
Show file tree
Hide file tree
Showing 33 changed files with 187 additions and 83 deletions.
44 changes: 32 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,51 @@
name: CI

on:
pull_request:
branches:
- "*.*"
- master
pull_request: null
push:
branches:
- "*.*"
- master
- "master"
schedule:
- cron: "0 4 * * *"

jobs:
tests:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
php-version:
- '8.0'
- '8.1'
- '8.2'
- '8.3'
- '8.4'
symfony-version:
- '5.3.*'
- '5.4.*'
- '6.0.*'
- '6.2.*'
- '6.4.*'
- '7.0.*'
- '7.1.*'
dependencies:
- 'lowest'
- 'highest'
remove-dependencies: [ '' ]
coverage: [ 'none' ]
exclude:
- php-version: '8.0'
symfony-version: '6.2.*'
- php-version: '8.0'
symfony-version: '6.4.*'
- php-version: '8.0'
symfony-version: '7.0.*'
- php-version: '8.0'
symfony-version: '7.1.*'
- php-version: '8.1'
symfony-version: '7.0.*'
- php-version: '8.1'
symfony-version: '7.1.*'
steps:
- name: "Checkout"
uses: "actions/checkout@v2"
Expand Down Expand Up @@ -61,20 +80,21 @@ jobs:
run: composer test

coding-standard:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
name: Coding Standard
steps:
- name: "Checkout"
uses: "actions/checkout@v2"
uses: "actions/checkout@v4"

- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
tools: flex
php-version: "8.0"
php-version: "8.2"
coverage: "none"

- name: "Install dependencies"
uses: ramsey/composer-install@1.3.0
uses: "ramsey/composer-install@v2"

- name: "Check coding standard"
run: composer check-cs
run: composer run check-cs
10 changes: 6 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
.idea
phpunit.xml
/build
/vendor
/bin
composer.lock
composer.phar
.php_cs.cache
.php_cs
/.php-cs-fixer.php
/*.cache

phpbench.phar
phpbench.phar.*
/.phpbench_storage
php-cs-fixer.phar
/.phpunit.result.cache
42 changes: 42 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?php

$finder = PhpCsFixer\Finder::create()
->exclude('Annotation')
->name('*.php')
->in([__DIR__.'/src', __DIR__.'/tests'])
;

return (new PhpCsFixer\Config())
->setRules(
[
'@Symfony' => true,
'@PHP80Migration' => true,
'@PHP80Migration:risky' => true,
'ordered_imports' => ['imports_order' => ['class', 'function', 'const']],
'general_phpdoc_annotation_remove' => [
'annotations' => [
'author',
'category',
'copyright',
'created',
'license',
'package',
'since',
'subpackage',
'version',
],
],
'fully_qualified_strict_types' => true,
'single_line_throw' => false,
'phpdoc_to_comment' => false,
'no_superfluous_phpdoc_tags' => ['allow_mixed' => true],
'global_namespace_import' => ['import_functions' => true, 'import_classes' => true, 'import_constants' => true],
'phpdoc_summary' => false,
'single_line_comment_style' => false,
'phpdoc_no_alias_tag' => ['replacements' => ['type' => 'var']],
'no_mixed_echo_print' => ['use' => 'echo'],
]
)
->setFinder($finder)
->setUsingCache(true)
;
23 changes: 0 additions & 23 deletions .php_cs.dist

This file was deleted.

28 changes: 14 additions & 14 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,24 +22,24 @@
},
"require": {
"php": "^8.0",
"symfony/http-foundation": "^5.3.7 || ^6.0 || ^7.0",
"symfony/twig-bundle": "^5.3.7 || ^6.0 || ^7.0",
"symfony/routing": "^5.3.7 || ^6.0 || ^7.00"
"symfony/http-foundation": "^5.4 || ^6.0 || ^7.0",
"symfony/twig-bundle": "^5.4 || ^6.0 || ^7.0",
"symfony/routing": "^5.4 || ^6.0 || ^7.00"
},
"require-dev": {
"overblog/graphql-bundle": "dev-master",
"webonyx/graphql-php": "^15.4",
"phpunit/phpunit": "^9.5.10",
"symfony/browser-kit": "^5.3 || ^6.0 || ^7.0",
"symfony/config": "^5.3.7 || ^6.0 || ^7.0",
"symfony/console": "^5.3.7 || ^6.0 || ^7.0",
"symfony/dependency-injection": "^5.3.7 || ^6.0 || ^7.0",
"symfony/dom-crawler": "^5.3.7 || ^6.0 || ^7.0",
"symfony/expression-language": "^5.3.7 || ^6.0 || ^7.0",
"symfony/framework-bundle": "^5.3.7 || ^6.0 || ^7.0",
"symfony/finder": "^5.3.7 || ^6.0 || ^7.0",
"symfony/templating": "^5.3.7 || ^6.0 || ^7.0",
"symfony/yaml": "^5.3.7 || ^6.0 || ^7.0",
"symfony/browser-kit": "^5.4 || ^6.0 || ^7.0",
"symfony/config": "^5.4 || ^6.0 || ^7.0",
"symfony/console": "^5.4 || ^6.0 || ^7.0",
"symfony/dependency-injection": "^5.4 || ^6.0 || ^7.0",
"symfony/dom-crawler": "^5.4 || ^6.0 || ^7.0",
"symfony/expression-language": "^5.4 || ^6.0 || ^7.0",
"symfony/framework-bundle": "^5.4 || ^6.0 || ^7.0",
"symfony/finder": "^5.4 || ^6.0 || ^7.0",
"symfony/templating": "^5.4 || ^6.0 || ^7.0",
"symfony/yaml": "^5.4 || ^6.0 || ^7.0",
"twig/twig": "^3.3.3"
},
"autoload": {
Expand All @@ -50,7 +50,7 @@
},
"scripts": {
"test": "bin/phpunit --color=always",
"install-cs": "test -f php-cs-fixer.phar || wget https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/download/v2.18.7/php-cs-fixer.phar -O php-cs-fixer.phar",
"install-cs": "test -f php-cs-fixer.phar || wget https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/releases/download/v3.48.0/php-cs-fixer.phar -O php-cs-fixer.phar",
"fix-cs": [
"@install-cs",
"@php php-cs-fixer.phar fix --diff -v --allow-risky=yes --ansi"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
<?php

declare(strict_types=1);

namespace Overblog\GraphiQLBundle\Config\GraphQLEndpoint;

class GraphQLEndpointInvalidSchemaException extends \RuntimeException
use RuntimeException;

class GraphQLEndpointInvalidSchemaException extends RuntimeException
{
public static function forSchemaAndResolver($schemaName, $resolverClass)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Overblog\GraphiQLBundle\Config\GraphQLEndpoint\Helpers;

final class OverblogGraphQLBundleEndpointResolver
Expand Down
2 changes: 2 additions & 0 deletions src/Config/GraphQLEndpoint/RootResolver.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Overblog\GraphiQLBundle\Config\GraphQLEndpoint;

use Overblog\GraphiQLBundle\Config\GraphiQLControllerEndpoint;
Expand Down
2 changes: 2 additions & 0 deletions src/Config/GraphQLEndpoint/RouteResolver.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Overblog\GraphiQLBundle\Config\GraphQLEndpoint;

use Overblog\GraphiQLBundle\Config\GraphiQLControllerEndpoint;
Expand Down
2 changes: 2 additions & 0 deletions src/Config/GraphiQLControllerEndpoint.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Overblog\GraphiQLBundle\Config;

interface GraphiQLControllerEndpoint
Expand Down
2 changes: 2 additions & 0 deletions src/Config/GraphiQLViewConfig.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Overblog\GraphiQLBundle\Config;

final class GraphiQLViewConfig
Expand Down
2 changes: 2 additions & 0 deletions src/Config/GraphiQLViewJavaScriptLibraries.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Overblog\GraphiQLBundle\Config;

final class GraphiQLViewJavaScriptLibraries
Expand Down
2 changes: 2 additions & 0 deletions src/Controller/GraphiQLController.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Overblog\GraphiQLBundle\Controller;

use Overblog\GraphiQLBundle\Config\GraphiQLControllerEndpoint;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Overblog\GraphiQLBundle\DependencyInjection\Compiler\Endpoints;

use Overblog\GraphiQLBundle\Config\GraphiQLControllerEndpoint;
Expand All @@ -9,8 +11,8 @@

final class DefaultEndpointWiringPass implements CompilerPassInterface
{
//@todo https://github.com/symfony/symfony/blob/master/src/Symfony/Component/DependencyInjection/Tests/Compiler/RemoveUnusedDefinitionsPassTest.php
public function process(ContainerBuilder $container)
// @todo https://github.com/symfony/symfony/blob/master/src/Symfony/Component/DependencyInjection/Tests/Compiler/RemoveUnusedDefinitionsPassTest.php
public function process(ContainerBuilder $container): void
{
$endpointDefinition = $container->getDefinition('overblog_graphiql.controller.graphql.endpoint');

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Overblog\GraphiQLBundle\DependencyInjection\Compiler\Endpoints;

use Overblog\GraphiQLBundle\Config\GraphQLEndpoint\RouteResolver;
Expand All @@ -9,7 +11,7 @@

final class OverblogGraphQLBundleEndpointWiringPass implements CompilerPassInterface
{
public function process(ContainerBuilder $container)
public function process(ContainerBuilder $container): void
{
$bundles = $container->getParameter('kernel.bundles_metadata');

Expand Down
6 changes: 5 additions & 1 deletion src/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
<?php

declare(strict_types=1);

namespace Overblog\GraphiQLBundle\DependencyInjection;

use Overblog\GraphiQLBundle\Config\GraphQLEndpoint\Helpers\OverblogGraphQLBundleEndpointResolver;
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;

use function method_exists;

final class Configuration implements ConfigurationInterface
{
public function getConfigTreeBuilder(): TreeBuilder
Expand Down Expand Up @@ -47,6 +51,6 @@ public function getConfigTreeBuilder(): TreeBuilder
private static function getRootNodeWithoutDeprecation(TreeBuilder $builder, $name, $type = 'array')
{
// BC layer for symfony/config 4.1 and older
return \method_exists($builder, 'getRootNode') ? $builder->getRootNode() : $builder->root($name, $type);
return method_exists($builder, 'getRootNode') ? $builder->getRootNode() : $builder->root($name, $type);
}
}
2 changes: 2 additions & 0 deletions src/DependencyInjection/OverblogGraphiQLExtension.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Overblog\GraphiQLBundle\DependencyInjection;

use Symfony\Component\Config\FileLocator;
Expand Down
2 changes: 2 additions & 0 deletions src/OverblogGraphiQLBundle.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Overblog\GraphiQLBundle;

use Overblog\GraphiQLBundle\DependencyInjection\Compiler\Endpoints\DefaultEndpointWiringPass;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
<?php

declare(strict_types=1);

namespace Overblog\GraphiQLBundle\Tests\Config\GraphQLEndpoint\Helpers;

use Overblog\GraphiQLBundle\Config\GraphQLEndpoint\Helpers\OverblogGraphQLBundleEndpointResolver;
use PHPUnit\Framework\TestCase;

final class OverblogGraphQLBundleEndpointResolverTest extends TestCase
{
public function testGetDefaultRoute()
public function testGetDefaultRoute(): void
{
$defaultRoute = OverblogGraphQLBundleEndpointResolver::getByName('default');
$this->assertSame(['overblog_graphql_endpoint'], $defaultRoute);
Expand All @@ -16,7 +18,7 @@ public function testGetDefaultRoute()
/**
* @dataProvider getSchemas
*/
public function testGetWithSchemaName($schemaName, $expectedResult)
public function testGetWithSchemaName($schemaName, $expectedResult): void
{
$route = OverblogGraphQLBundleEndpointResolver::getByName($schemaName);
$this->assertSame($expectedResult, $route);
Expand Down
Loading

0 comments on commit 68520e0

Please sign in to comment.