Skip to content

Commit c94a949

Browse files
authored
Granular CLI (for CI) (#1372)
1 parent 1232dce commit c94a949

File tree

193 files changed

+9956
-17548
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

193 files changed

+9956
-17548
lines changed

Diff for: .github/workflows/actions.yml

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Integration
2+
on: [push]
3+
jobs:
4+
Action:
5+
name: Test Inspector Action
6+
runs-on: ubuntu-latest
7+
steps:
8+
- name: Checkout
9+
uses: actions/checkout@v2
10+
11+
- name: Make changes to schema
12+
run: |
13+
sed -i 's/createdAt: String/createdAt: String!/g' ./example/schemas/schema.graphql
14+
sed -i 's/modifiedAt: String/modifiedAt: String!/g' ./example/schemas/schema.graphql
15+
cat ./example/schemas/schema.graphql
16+
17+
- name: Run Inspector
18+
uses: ./
19+
id: inspector
20+
with:
21+
schema: 'master:example/schemas/schema.graphql'
22+
github-token: ${{ secrets.GITHUB_TOKEN }}
23+
24+
- name: Validate result
25+
if: steps.inspector.outputs.changes != 3
26+
run: exit 1

Diff for: .github/workflows/ci.yml

+47-18
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,52 @@ jobs:
99
strategy:
1010
matrix:
1111
node_version: [10, 12]
12+
env:
13+
CI: true
1214

1315
steps:
14-
- uses: actions/checkout@master
15-
16-
- name: Use Node.js ${{ matrix.node_version }}
17-
uses: actions/setup-node@master
18-
with:
19-
version: ${{ matrix.node_version }}
20-
21-
- name: Install
22-
run: |
23-
yarn
24-
25-
- name: Build
26-
run: |
27-
yarn build
28-
29-
- name: Test
30-
run: |
31-
yarn test
16+
- uses: actions/checkout@v1
17+
18+
- name: Use Node.js ${{ matrix.node_version }}
19+
uses: actions/setup-node@master
20+
with:
21+
node-version: ${{ matrix.node_version }}
22+
23+
- name: Bob, check the repo
24+
id: bob
25+
uses: 'kamilkisiela/bob@master'
26+
- name: Bob, check Test
27+
id: bob-test
28+
uses: 'kamilkisiela/bob@master'
29+
with:
30+
command: test
31+
- name: Bob, check Build
32+
id: bob-build
33+
uses: 'kamilkisiela/bob@master'
34+
with:
35+
command: build
36+
37+
- name: Get yarn cache
38+
if: steps.bob.outputs.dirty == 'true'
39+
id: yarn-cache
40+
run: echo "::set-output name=dir::$(yarn cache dir)"
41+
- name: Cache Yarn
42+
if: steps.bob.outputs.dirty == 'true'
43+
uses: actions/cache@v1
44+
with:
45+
path: ${{ steps.yarn-cache.outputs.dir }}
46+
key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
47+
restore-keys: |
48+
${{ runner.os }}-yarn-
49+
50+
- name: Install
51+
if: steps.bob.outputs.dirty == 'true'
52+
run: yarn
53+
54+
- name: Build
55+
if: steps.bob-build.outputs.dirty == 'true'
56+
run: yarn affected:build
57+
58+
- name: Test
59+
if: steps.bob-test.outputs.dirty == 'true'
60+
run: yarn affected:test

Diff for: .gitignore

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
dist/
1+
dist
2+
.bob
3+
.cache
24
node_modules/
35
yarn-error.log
46
**/*/node_modules/
@@ -12,5 +14,4 @@ yarn.lock
1214
website/**/yarn.lock
1315
website/**/package-lock.json
1416
public/
15-
16-
.now
17+
.now

Diff for: .vscode/settings.json

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
{
22
"files.exclude": {
3-
"**/dist": true,
43
"**/build": false
54
}
65
}

Diff for: action.yml

+6-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ inputs:
88
schema:
99
description: 'Ref and Path to GraphQL Schema (e.g. "master:schema.graphql")'
1010
required: true
11+
github-token:
12+
description: 'Github Token'
13+
outputs:
14+
changes:
15+
description: 'Total number of changes'
1116
runs:
1217
using: 'node12'
13-
main: 'lib/action.js'
18+
main: 'action/index.js'

Diff for: action/index.js

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: actions/cleanup/Dockerfile

-18
This file was deleted.

Diff for: actions/cleanup/index.js

-24
This file was deleted.

Diff for: actions/cleanup/package.json

-8
This file was deleted.

Diff for: actions/merged/Dockerfile

-18
This file was deleted.

Diff for: actions/merged/index.js

-47
This file was deleted.

Diff for: actions/merged/package.json

-8
This file was deleted.

Diff for: app.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
// For quick tests
2-
const appFn = require('@graphql-inspector/github').default;
2+
const {app} = require('@graphql-inspector/github');
33

4-
module.exports = appFn;
4+
module.exports = app;

Diff for: bob.config.js

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
module.exports = {
2+
scope: '@graphql-inspector',
3+
ignore: [],
4+
base: `origin/master`,
5+
track: [
6+
'bob.config.js',
7+
'package.json',
8+
'tsconfig.json',
9+
'<project>/package.json',
10+
'<project>/tsconfig.json',
11+
'<project>/src/**',
12+
],
13+
commands: {
14+
test: {
15+
track: ['jest.config.js', '<project>/jest.config.js', '<project>/__tests__/**'],
16+
run(affected) {
17+
return [`yarn`, ['test', ...affected.paths]];
18+
},
19+
},
20+
build: {
21+
run() {
22+
return [`yarn`, ['build']];
23+
},
24+
},
25+
},
26+
};

Diff for: example/inspector.config.js

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module.exports = {
2+
use: {
3+
loaders: ['graphql', 'json'],
4+
commands: ['serve', 'diff', 'docs', 'introspect', 'validate', 'similar', 'coverage'],
5+
},
6+
};

Diff for: example/package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
{
22
"name": "example",
33
"scripts": {
4-
"graphql-inspector": "node ../packages/cli/dist/index.js",
4+
"ci": "node ../packages/ci/dist/index.cjs.js",
5+
"graphql-inspector": "yarn ci",
56
"ui": "yarn graphql-inspector ui",
67
"diff": "yarn graphql-inspector diff ./schemas/schema.graphql ./schemas/new.graphql",
78
"diff:master": "yarn graphql-inspector diff git:master:example/schemas/schema.graphql ./schemas/schema.graphql",

Diff for: example/schemas/new-valid.graphql

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
type Post {
2+
id: ID
3+
title: String @deprecated(reason: "No more used")
4+
createdAt: String!
5+
modifiedAt: String
6+
}
7+
8+
type Query {
9+
post: Post!
10+
posts: [Post!]
11+
}

Diff for: example/schemas/new.graphql

+3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
type Post {
22
id: ID!
33
title: String!
4+
"""
5+
Date of Creation in ISO
6+
"""
47
createdAt: String!
58
}
69

Diff for: example/schemas/schema.graphql

+5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
1+
# AUTO-GENERATED
2+
13
type Post {
24
id: ID
35
title: String @deprecated(reason: "No more used")
6+
"""
7+
Date of Creation in ISO
8+
"""
49
createdAt: String
510
modifiedAt: String
611
}

0 commit comments

Comments
 (0)