Skip to content

Commit f06faec

Browse files
authored
Merge pull request #362 from lingoda/fix-ci
Fix CI
2 parents 6b077e6 + 5efa3b4 commit f06faec

File tree

8 files changed

+124
-86
lines changed

8 files changed

+124
-86
lines changed

.github/dependabot.yml

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,17 @@
11
version: 2
22
updates:
3-
- package-ecosystem: composer
4-
directory: "/"
5-
schedule:
6-
interval: daily
7-
time: "04:00"
8-
open-pull-requests-limit: 10
3+
- package-ecosystem: github-actions
4+
directory: '/'
5+
schedule:
6+
interval: weekly
7+
pull-request-branch-name:
8+
separator: '-'
9+
- package-ecosystem: composer
10+
directory: '/'
11+
versioning-strategy: widen
12+
schedule:
13+
interval: daily
14+
time: "04:00"
15+
pull-request-branch-name:
16+
separator: '-'
17+
open-pull-requests-limit: 10

.github/workflows/continuous_integration.yml

Lines changed: 46 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@
33
name: "Continuous Integration"
44

55
on:
6-
- "pull_request"
7-
- "push"
6+
pull_request: ~
7+
push:
8+
branches:
9+
- master
810

911
jobs:
1012

@@ -15,16 +17,17 @@ jobs:
1517

1618
strategy:
1719
matrix:
18-
php-version:
19-
- "7.2"
20-
- "7.3"
21-
- "7.4"
22-
- "8.0"
23-
24-
dependencies:
25-
- "highest"
20+
install-args: ['', '--prefer-lowest']
21+
php-version: ['7.2', '7.3', '7.4', '8.0']
22+
fail-fast: false
2623

2724
steps:
25+
# Cancel previous runs of the same branch
26+
- name: cancel
27+
uses: styfle/[email protected]
28+
with:
29+
access_token: ${{ github.token }}
30+
2831
- name: "Checkout"
2932
uses: "actions/checkout@v2"
3033

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

38-
- name: "Cache dependencies installed with composer"
39-
uses: "actions/cache@v1"
41+
- name: composer-cache-dir
42+
id: composercache
43+
run: |
44+
echo "::set-output name=dir::$(composer config cache-files-dir)"
45+
46+
- name: composer-cache
47+
uses: actions/[email protected]
4048
with:
41-
path: "~/.composer/cache"
42-
key: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('**/composer.lock') }}"
43-
restore-keys: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-"
49+
path: ${{ steps.composercache.outputs.dir }}
50+
key: composer-${{ hashFiles('**/composer.json') }}-${{ matrix.install-args }}
51+
restore-keys: |
52+
composer-${{ hashFiles('**/composer.json') }}-${{ matrix.install-args }}
53+
composer-${{ hashFiles('**/composer.json') }}-
54+
composer-
4455
4556
- name: "Install dependencies with composer"
46-
run: "composer install --no-interaction"
57+
run: |
58+
composer update ${{ matrix.install-args }} --no-interaction --no-progress --prefer-dist
4759
if: ${{ matrix.php-version != '8.0' }}
4860

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

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

69+
- name: phpstan-cache
70+
uses: actions/[email protected]
71+
with:
72+
key: phpstan-${{ matrix.php-version }}-${{ matrix.install-args }}-${{ github.ref }}-${{ github.sha }}
73+
path: .phpstan-cache
74+
restore-keys: |
75+
phpstan-${{ matrix.php-version }}-${{ matrix.install-args }}-${{ github.ref }}-
76+
phpstan-${{ matrix.php-version }}-${{ matrix.install-args }}-
77+
phpstan-${{ matrix.php-version }}-
78+
phpstan-
79+
5680
- name: "Run static code analysis with phpstan/phpstan"
5781
run: "composer phpstan"
58-
if: ${{ matrix.php-version == '8.0' }}
5982

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

6487
- name: "Archive code coverage results"
65-
uses: "actions/upload-artifact@v1"
88+
uses: actions/upload-artifact@v2.2.4
6689
with:
6790
name: "codeCoverage"
6891
path: "build"
6992

70-
- uses: codecov/codecov-action@v1 # upload the coverage to codecov
93+
- uses: codecov/codecov-action@v2.0.2 # upload the coverage to codecov
7194
with:
7295
fail_ci_if_error: true # optional (default = false)
96+
# Do not upload in forks, and only on php8, latest deps
97+
if: ${{ github.repository == 'thecodingmachine/graphqlite' && matrix.php-version == '8.0' && matrix.install-args == '' }}

.github/workflows/test_dependancies.yml renamed to .github/workflows/test_dependencies.yml

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@
44
name: "Test the bundles' dependencies"
55

66
on:
7-
- "pull_request"
8-
- "push"
7+
pull_request: ~
8+
push:
9+
branches:
10+
- master
911

1012
jobs:
1113

@@ -15,26 +17,27 @@ jobs:
1517
steps:
1618
- name: "Checkout"
1719
uses: "actions/checkout@v2"
18-
20+
1921
- name: "copy the project"
2022
run: rsync -av . tests/dependencies/copy/ --exclude tests --exclude vendor
21-
23+
2224
- name: "Clone the bundle project"
2325
run: git clone https://github.com/thecodingmachine/graphqlite-bundle.git
2426
working-directory: "tests/dependencies"
25-
27+
2628
- name: "edit the composer.json"
2729
run: php ./makeComposerLocal.php graphqlite-bundle/composer.json
2830
working-directory: "tests/dependencies"
29-
30-
- name: "install dependancies"
31+
32+
- name: "install dependencies"
3133
run: composer install
3234
working-directory: "tests/dependencies/graphqlite-bundle"
3335

3436

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

53-
- name: "install dependancies"
56+
- name: "install dependencies"
5457
run: composer install
5558
working-directory: "tests/dependencies/graphqlite-universal-service-provider"
5659

5760

58-
graphqlite-test:
61+
laravel-test:
5962
name: "Test graphqlite-laravel"
6063
runs-on: "ubuntu-latest"
6164
steps:
@@ -73,7 +76,6 @@ jobs:
7376
run: php ./makeComposerLocal.php graphqlite-laravel/composer.json
7477
working-directory: "tests/dependencies"
7578

76-
- name: "install dependancies"
79+
- name: "install dependencies"
7780
run: composer install
7881
working-directory: "tests/dependencies/graphqlite-laravel"
79-

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,5 @@ website/i18n/*
2222
/tests/dependencies/graphqlite-laravel/
2323
/tests/dependencies/graphqlite-universal-service-provider/
2424

25-
.phpunit.result.cache
25+
.phpunit.result.cache
26+
.phpstan-cache

composer.json

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"name": "thecodingmachine/graphqlite",
33
"description": "Write your GraphQL queries in simple to write controllers (using webonyx/graphql-php).",
4+
"version": "dev-master",
45
"license": "MIT",
56
"type": "library",
67
"authors": [
@@ -11,38 +12,38 @@
1112
],
1213
"require": {
1314
"php": ">=7.2",
14-
"webonyx/graphql-php": "^0.13.4",
15-
"psr/container": "^1",
16-
"doctrine/annotations": "^1.7.0",
15+
"ext-json": "*",
16+
"doctrine/annotations": "^1.10.4",
1717
"doctrine/cache": "^1.8",
18-
"thecodingmachine/class-explorer": "^1.1.0",
19-
"psr/simple-cache": "^1",
18+
"composer/package-versions-deprecated": "^1.8",
2019
"phpdocumentor/reflection-docblock": "^4.3 || ^5.0",
21-
"phpdocumentor/type-resolver": "^1.0.1",
22-
"psr/http-message": "^1",
23-
"webmozart/assert": "^1.4",
24-
"symfony/cache": "^4.3 | ^5",
25-
"thecodingmachine/cache-utils": "^1",
26-
"ocramius/package-versions": "^1.4 || ^2",
27-
"symfony/expression-language": "^4 | ^5",
28-
"ext-json": "*",
20+
"phpdocumentor/type-resolver": "^1.4",
21+
"psr/container": "^1",
22+
"psr/http-factory": "^1",
23+
"psr/http-message": "^1.0.1",
2924
"psr/http-server-handler": "^1",
3025
"psr/http-server-middleware": "^1",
31-
"psr/http-factory": "^1"
26+
"psr/simple-cache": "^1.0.1",
27+
"symfony/cache": "^4.3 | ^5",
28+
"symfony/expression-language": "^4 | ^5",
29+
"thecodingmachine/cache-utils": "^1",
30+
"thecodingmachine/class-explorer": "^1.1.0",
31+
"webmozart/assert": "^1.10",
32+
"webonyx/graphql-php": "^0.13.4"
3233
},
3334
"require-dev": {
34-
"phpunit/phpunit": "^8.2.4||^9.4",
35-
"php-coveralls/php-coveralls": "^2.1",
36-
"mouf/picotainer": "^1.1",
37-
"phpstan/phpstan": "^0.12.82",
3835
"beberlei/porpaginas": "^1.2",
39-
"myclabs/php-enum": "^1.6.6",
40-
"doctrine/coding-standard": "^8.2 || ^9.0",
41-
"phpstan/phpstan-webmozart-assert": "^0.12",
42-
"phpstan/extension-installer": "^1.0",
43-
"thecodingmachine/phpstan-strict-rules": "^0.12",
36+
"doctrine/coding-standard": "^9.0",
37+
"ecodev/graphql-upload": "^4.0 || ^5.0 || ^6.0",
4438
"laminas/laminas-diactoros": "^2",
45-
"ecodev/graphql-upload": "^4.0 || ^5.0 || ^6.0"
39+
"mouf/picotainer": "^1.1",
40+
"myclabs/php-enum": "^1.6.6",
41+
"php-coveralls/php-coveralls": "^2.1",
42+
"phpstan/extension-installer": "^1.1",
43+
"phpstan/phpstan": "^0.12.94",
44+
"phpstan/phpstan-webmozart-assert": "^0.12.15",
45+
"phpunit/phpunit": "^8.5.19||^9.5.8",
46+
"thecodingmachine/phpstan-strict-rules": "^0.12.1"
4647
},
4748
"suggest": {
4849
"beberlei/porpaginas": "If you want automatic pagination in your GraphQL types",
@@ -59,7 +60,7 @@
5960
}
6061
},
6162
"scripts": {
62-
"phpstan": "phpstan analyse src -c phpstan.neon --level=8 --no-progress -vvv",
63+
"phpstan": "phpstan analyse -c phpstan.neon --no-progress -vvv --memory-limit=1G",
6364
"cs-check": "phpcs",
6465
"cs-fix": "phpcbf",
6566
"test": ["@cs-check", "@phpstan", "phpunit"]

phpstan.neon

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
1+
#includes:
2+
# - vendor/phpstan/phpstan/conf/bleedingEdge.neon TODO: Try to add this
13
parameters:
4+
tmpDir: .phpstan-cache
5+
paths:
6+
- src
7+
level: max
28
checkGenericClassInNonGenericObjectType: false
39
ignoreErrors:
410
- "#PHPDoc tag \\@throws with type Psr\\\\Container\\\\ContainerExceptionInterface is not subtype of Throwable#"
5-
#- "#Property TheCodingMachine\\\\GraphQLite\\\\Types\\\\ResolvableInputObjectType::\\$resolve \\(array<int, object\\|string>&callable\\) does not accept array<int,object\\|string>#"
6-
#- "#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.#"
711
- "#Parameter .* of class ReflectionMethod constructor expects string(\\|null)?, object\\|string given.#"
812
-
913
message: '#Method TheCodingMachine\\GraphQLite\\Types\\Mutable(Interface|Object)Type::getFields\(\) should return array<GraphQL\\Type\\Definition\\FieldDefinition> but returns array\|float\|int#'
1014
path: src/Types/MutableTrait.php
1115
-
1216
message: '#Method TheCodingMachine\\GraphQLite\\Mappers\\Proxys\\Mutable(Interface|Object)TypeAdapter::getFields\(\) should return array<GraphQL\\Type\\Definition\\FieldDefinition> but returns array\|float\|int#'
1317
path: src/Mappers/Proxys/MutableAdapterTrait.php
14-
#- "#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.#"
1518
- "#PHPDoc tag @throws with type Psr\\\\SimpleCache\\\\InvalidArgumentException is not subtype of Throwable#"
1619
- '#Variable \$context might not be defined.#'
1720
-
@@ -35,16 +38,3 @@ parameters:
3538
-
3639
message: '#Method TheCodingMachine\\GraphQLite\\AnnotationReader::(getMethodAnnotations|getPropertyAnnotations)\(\) should return array<int, T of object> but returns array<object>.#'
3740
path: src/AnnotationReader.php
38-
-
39-
message: '#Method TheCodingMachine\\GraphQLite\\AnnotationReader::getClassAnnotations\(\) should return array<A of object> but returns array<object>.#'
40-
path: src/AnnotationReader.php
41-
-
42-
message: '#Parameter \#1 \$annotations of class TheCodingMachine\\GraphQLite\\Annotations\\ParameterAnnotations constructor expects array<int, TheCodingMachine\\GraphQLite\\Annotations\\ParameterAnnotationInterface>, array<object> given.#'
43-
path: src/AnnotationReader.php
44-
45-
46-
#-
47-
# message: '#If condition is always true#'
48-
# path: src/Middlewares/SecurityFieldMiddleware.php
49-
#includes:
50-
# - vendor/thecodingmachine/phpstan-strict-rules/phpstan-strict-rules.neon

0 commit comments

Comments
 (0)