Skip to content

Commit

Permalink
Merge pull request #362 from lingoda/fix-ci
Browse files Browse the repository at this point in the history
Fix CI
  • Loading branch information
oojacoboo authored Aug 18, 2021
2 parents 6b077e6 + 5efa3b4 commit f06faec
Show file tree
Hide file tree
Showing 8 changed files with 124 additions and 86 deletions.
21 changes: 15 additions & 6 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
version: 2
updates:
- package-ecosystem: composer
directory: "/"
schedule:
interval: daily
time: "04:00"
open-pull-requests-limit: 10
- package-ecosystem: github-actions
directory: '/'
schedule:
interval: weekly
pull-request-branch-name:
separator: '-'
- package-ecosystem: composer
directory: '/'
versioning-strategy: widen
schedule:
interval: daily
time: "04:00"
pull-request-branch-name:
separator: '-'
open-pull-requests-limit: 10
67 changes: 46 additions & 21 deletions .github/workflows/continuous_integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
name: "Continuous Integration"

on:
- "pull_request"
- "push"
pull_request: ~
push:
branches:
- master

jobs:

Expand All @@ -15,16 +17,17 @@ jobs:

strategy:
matrix:
php-version:
- "7.2"
- "7.3"
- "7.4"
- "8.0"

dependencies:
- "highest"
install-args: ['', '--prefer-lowest']
php-version: ['7.2', '7.3', '7.4', '8.0']
fail-fast: false

steps:
# Cancel previous runs of the same branch
- name: cancel
uses: styfle/cancel-workflow-action@0.9.0
with:
access_token: ${{ github.token }}

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

Expand All @@ -35,38 +38,60 @@ jobs:
php-version: "${{ matrix.php-version }}"
tools: composer:v2

- name: "Cache dependencies installed with composer"
uses: "actions/cache@v1"
- name: composer-cache-dir
id: composercache
run: |
echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: composer-cache
uses: actions/cache@v2.1.6
with:
path: "~/.composer/cache"
key: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('**/composer.lock') }}"
restore-keys: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-"
path: ${{ steps.composercache.outputs.dir }}
key: composer-${{ hashFiles('**/composer.json') }}-${{ matrix.install-args }}
restore-keys: |
composer-${{ hashFiles('**/composer.json') }}-${{ matrix.install-args }}
composer-${{ hashFiles('**/composer.json') }}-
composer-
- name: "Install dependencies with composer"
run: "composer install --no-interaction"
run: |
composer update ${{ matrix.install-args }} --no-interaction --no-progress --prefer-dist
if: ${{ matrix.php-version != '8.0' }}

- name: "Install dependencies with composer. Ignoring platform reqs to bypass a problem with ecodev/graphql-upload available only with latest Webonyx on PHP8."
run: "composer install --no-interaction --ignore-platform-reqs"
run: |
composer update ${{ matrix.install-args }} --no-interaction --no-progress --prefer-dist --ignore-platform-reqs
if: ${{ matrix.php-version == '8.0' }}

- name: "Run tests with phpunit/phpunit"
run: "vendor/bin/phpunit"

- name: phpstan-cache
uses: actions/cache@v2.1.6
with:
key: phpstan-${{ matrix.php-version }}-${{ matrix.install-args }}-${{ github.ref }}-${{ github.sha }}
path: .phpstan-cache
restore-keys: |
phpstan-${{ matrix.php-version }}-${{ matrix.install-args }}-${{ github.ref }}-
phpstan-${{ matrix.php-version }}-${{ matrix.install-args }}-
phpstan-${{ matrix.php-version }}-
phpstan-
- name: "Run static code analysis with phpstan/phpstan"
run: "composer phpstan"
if: ${{ matrix.php-version == '8.0' }}

- name: "Run coding standard checks with squizlabs/php_codesniffer"
run: "composer cs-check"
if: ${{ matrix.php-version == '8.0' }}
if: ${{ matrix.php-version == '7.2' }} # Do not suggest using features after 7.2

- name: "Archive code coverage results"
uses: "actions/upload-artifact@v1"
uses: actions/upload-artifact@v2.2.4
with:
name: "codeCoverage"
path: "build"

- uses: codecov/codecov-action@v1 # upload the coverage to codecov
- uses: codecov/codecov-action@v2.0.2 # upload the coverage to codecov
with:
fail_ci_if_error: true # optional (default = false)
# Do not upload in forks, and only on php8, latest deps
if: ${{ github.repository == 'thecodingmachine/graphqlite' && matrix.php-version == '8.0' && matrix.install-args == '' }}
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
name: "Test the bundles' dependencies"

on:
- "pull_request"
- "push"
pull_request: ~
push:
branches:
- master

jobs:

Expand All @@ -15,26 +17,27 @@ jobs:
steps:
- name: "Checkout"
uses: "actions/checkout@v2"

- name: "copy the project"
run: rsync -av . tests/dependencies/copy/ --exclude tests --exclude vendor

- name: "Clone the bundle project"
run: git clone https://github.com/thecodingmachine/graphqlite-bundle.git
working-directory: "tests/dependencies"

- name: "edit the composer.json"
run: php ./makeComposerLocal.php graphqlite-bundle/composer.json
working-directory: "tests/dependencies"
- name: "install dependancies"

- name: "install dependencies"
run: composer install
working-directory: "tests/dependencies/graphqlite-bundle"


universal-service-provider-test:
name: "Test graphqlite-universal-service-provider"
runs-on: "ubuntu-latest"
if: ${{ false }} # TODO: Revisit and make a decision
steps:
- name: "Checkout"
uses: "actions/checkout@v2"
Expand All @@ -50,12 +53,12 @@ jobs:
run: php ./makeComposerLocal.php graphqlite-universal-service-provider/composer.json
working-directory: "tests/dependencies"

- name: "install dependancies"
- name: "install dependencies"
run: composer install
working-directory: "tests/dependencies/graphqlite-universal-service-provider"


graphqlite-test:
laravel-test:
name: "Test graphqlite-laravel"
runs-on: "ubuntu-latest"
steps:
Expand All @@ -73,7 +76,6 @@ jobs:
run: php ./makeComposerLocal.php graphqlite-laravel/composer.json
working-directory: "tests/dependencies"

- name: "install dependancies"
- name: "install dependencies"
run: composer install
working-directory: "tests/dependencies/graphqlite-laravel"

3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,5 @@ website/i18n/*
/tests/dependencies/graphqlite-laravel/
/tests/dependencies/graphqlite-universal-service-provider/

.phpunit.result.cache
.phpunit.result.cache
.phpstan-cache
51 changes: 26 additions & 25 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "thecodingmachine/graphqlite",
"description": "Write your GraphQL queries in simple to write controllers (using webonyx/graphql-php).",
"version": "dev-master",
"license": "MIT",
"type": "library",
"authors": [
Expand All @@ -11,38 +12,38 @@
],
"require": {
"php": ">=7.2",
"webonyx/graphql-php": "^0.13.4",
"psr/container": "^1",
"doctrine/annotations": "^1.7.0",
"ext-json": "*",
"doctrine/annotations": "^1.10.4",
"doctrine/cache": "^1.8",
"thecodingmachine/class-explorer": "^1.1.0",
"psr/simple-cache": "^1",
"composer/package-versions-deprecated": "^1.8",
"phpdocumentor/reflection-docblock": "^4.3 || ^5.0",
"phpdocumentor/type-resolver": "^1.0.1",
"psr/http-message": "^1",
"webmozart/assert": "^1.4",
"symfony/cache": "^4.3 | ^5",
"thecodingmachine/cache-utils": "^1",
"ocramius/package-versions": "^1.4 || ^2",
"symfony/expression-language": "^4 | ^5",
"ext-json": "*",
"phpdocumentor/type-resolver": "^1.4",
"psr/container": "^1",
"psr/http-factory": "^1",
"psr/http-message": "^1.0.1",
"psr/http-server-handler": "^1",
"psr/http-server-middleware": "^1",
"psr/http-factory": "^1"
"psr/simple-cache": "^1.0.1",
"symfony/cache": "^4.3 | ^5",
"symfony/expression-language": "^4 | ^5",
"thecodingmachine/cache-utils": "^1",
"thecodingmachine/class-explorer": "^1.1.0",
"webmozart/assert": "^1.10",
"webonyx/graphql-php": "^0.13.4"
},
"require-dev": {
"phpunit/phpunit": "^8.2.4||^9.4",
"php-coveralls/php-coveralls": "^2.1",
"mouf/picotainer": "^1.1",
"phpstan/phpstan": "^0.12.82",
"beberlei/porpaginas": "^1.2",
"myclabs/php-enum": "^1.6.6",
"doctrine/coding-standard": "^8.2 || ^9.0",
"phpstan/phpstan-webmozart-assert": "^0.12",
"phpstan/extension-installer": "^1.0",
"thecodingmachine/phpstan-strict-rules": "^0.12",
"doctrine/coding-standard": "^9.0",
"ecodev/graphql-upload": "^4.0 || ^5.0 || ^6.0",
"laminas/laminas-diactoros": "^2",
"ecodev/graphql-upload": "^4.0 || ^5.0 || ^6.0"
"mouf/picotainer": "^1.1",
"myclabs/php-enum": "^1.6.6",
"php-coveralls/php-coveralls": "^2.1",
"phpstan/extension-installer": "^1.1",
"phpstan/phpstan": "^0.12.94",
"phpstan/phpstan-webmozart-assert": "^0.12.15",
"phpunit/phpunit": "^8.5.19||^9.5.8",
"thecodingmachine/phpstan-strict-rules": "^0.12.1"
},
"suggest": {
"beberlei/porpaginas": "If you want automatic pagination in your GraphQL types",
Expand All @@ -59,7 +60,7 @@
}
},
"scripts": {
"phpstan": "phpstan analyse src -c phpstan.neon --level=8 --no-progress -vvv",
"phpstan": "phpstan analyse -c phpstan.neon --no-progress -vvv --memory-limit=1G",
"cs-check": "phpcs",
"cs-fix": "phpcbf",
"test": ["@cs-check", "@phpstan", "phpunit"]
Expand Down
22 changes: 6 additions & 16 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
#includes:
# - vendor/phpstan/phpstan/conf/bleedingEdge.neon TODO: Try to add this
parameters:
tmpDir: .phpstan-cache
paths:
- src
level: max
checkGenericClassInNonGenericObjectType: false
ignoreErrors:
- "#PHPDoc tag \\@throws with type Psr\\\\Container\\\\ContainerExceptionInterface is not subtype of Throwable#"
#- "#Property TheCodingMachine\\\\GraphQLite\\\\Types\\\\ResolvableInputObjectType::\\$resolve \\(array<int, object\\|string>&callable\\) does not accept array<int,object\\|string>#"
#- "#Parameter \\#2 \\$type of class TheCodingMachine\\\\GraphQLite\\\\Parameters\\\\InputTypeParameter constructor expects GraphQL\\\\Type\\\\Definition\\\\InputType&GraphQL\\\\Type\\\\Definition\\\\Type, GraphQL\\\\Type\\\\Definition\\\\InputType\\|GraphQL\\\\Type\\\\Definition\\\\Type given.#"
- "#Parameter .* of class ReflectionMethod constructor expects string(\\|null)?, object\\|string given.#"
-
message: '#Method TheCodingMachine\\GraphQLite\\Types\\Mutable(Interface|Object)Type::getFields\(\) should return array<GraphQL\\Type\\Definition\\FieldDefinition> but returns array\|float\|int#'
path: src/Types/MutableTrait.php
-
message: '#Method TheCodingMachine\\GraphQLite\\Mappers\\Proxys\\Mutable(Interface|Object)TypeAdapter::getFields\(\) should return array<GraphQL\\Type\\Definition\\FieldDefinition> but returns array\|float\|int#'
path: src/Mappers/Proxys/MutableAdapterTrait.php
#- "#Parameter \\#2 \\$inputTypeNode of static method GraphQL\\\\Utils\\\\AST::typeFromAST() expects GraphQL\\\\Language\\\\AST\\\\ListTypeNode\\|GraphQL\\\\Language\\\\AST\\\\NamedTypeNode\\|GraphQL\\\\Language\\\\AST\\\\NonNullTypeNode, GraphQL\\\\Language\\\\AST\\\\ListTypeNode\\|GraphQL\\\\Language\\\\AST\\\\NameNode\\|GraphQL\\\\Language\\\\AST\\\\NonNullTypeNode given.#"
- "#PHPDoc tag @throws with type Psr\\\\SimpleCache\\\\InvalidArgumentException is not subtype of Throwable#"
- '#Variable \$context might not be defined.#'
-
Expand All @@ -35,16 +38,3 @@ parameters:
-
message: '#Method TheCodingMachine\\GraphQLite\\AnnotationReader::(getMethodAnnotations|getPropertyAnnotations)\(\) should return array<int, T of object> but returns array<object>.#'
path: src/AnnotationReader.php
-
message: '#Method TheCodingMachine\\GraphQLite\\AnnotationReader::getClassAnnotations\(\) should return array<A of object> but returns array<object>.#'
path: src/AnnotationReader.php
-
message: '#Parameter \#1 \$annotations of class TheCodingMachine\\GraphQLite\\Annotations\\ParameterAnnotations constructor expects array<int, TheCodingMachine\\GraphQLite\\Annotations\\ParameterAnnotationInterface>, array<object> given.#'
path: src/AnnotationReader.php


#-
# message: '#If condition is always true#'
# path: src/Middlewares/SecurityFieldMiddleware.php
#includes:
# - vendor/thecodingmachine/phpstan-strict-rules/phpstan-strict-rules.neon
Loading

0 comments on commit f06faec

Please sign in to comment.