Skip to content

Commit 7393fdf

Browse files
chore: report in JSON too (#34)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent f80c334 commit 7393fdf

File tree

13 files changed

+118
-25
lines changed

13 files changed

+118
-25
lines changed

Diff for: .github/workflows/audits.yml

+40-20
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,14 @@ jobs:
3030
- name: Start
3131
run: yarn workspace express-graphql start &
3232
- name: Audit
33-
run: node scripts/audit-implementation.mjs README.md
33+
run: node scripts/audit-implementation.mjs .
3434
- name: Upload report
3535
uses: actions/upload-artifact@v3
3636
with:
3737
name: express-graphql-report
38-
path: README.md
38+
path: |
39+
README.md
40+
report.json
3941
4042
apollo-server:
4143
runs-on: ubuntu-latest
@@ -57,12 +59,14 @@ jobs:
5759
- name: Start
5860
run: yarn workspace apollo-server start &
5961
- name: Audit
60-
run: node scripts/audit-implementation.mjs README.md
62+
run: node scripts/audit-implementation.mjs .
6163
- name: Upload report
6264
uses: actions/upload-artifact@v3
6365
with:
6466
name: apollo-server-report
65-
path: README.md
67+
path: |
68+
README.md
69+
report.json
6670
6771
mercurius:
6872
runs-on: ubuntu-latest
@@ -84,12 +88,14 @@ jobs:
8488
- name: Start
8589
run: yarn workspace mercurius start &
8690
- name: Audit
87-
run: node scripts/audit-implementation.mjs README.md
91+
run: node scripts/audit-implementation.mjs .
8892
- name: Upload report
8993
uses: actions/upload-artifact@v3
9094
with:
9195
name: mercurius-report
92-
path: README.md
96+
path: |
97+
README.md
98+
report.json
9399
94100
graphql-yoga:
95101
runs-on: ubuntu-latest
@@ -111,12 +117,14 @@ jobs:
111117
- name: Start
112118
run: yarn workspace graphql-yoga start &
113119
- name: Audit
114-
run: node scripts/audit-implementation.mjs README.md
120+
run: node scripts/audit-implementation.mjs .
115121
- name: Upload report
116122
uses: actions/upload-artifact@v3
117123
with:
118124
name: graphql-yoga-report
119-
path: README.md
125+
path: |
126+
README.md
127+
report.json
120128
121129
graphql-helix:
122130
runs-on: ubuntu-latest
@@ -138,12 +146,14 @@ jobs:
138146
- name: Start
139147
run: yarn workspace graphql-helix start &
140148
- name: Audit
141-
run: node scripts/audit-implementation.mjs README.md
149+
run: node scripts/audit-implementation.mjs .
142150
- name: Upload report
143151
uses: actions/upload-artifact@v3
144152
with:
145153
name: graphql-helix-report
146-
path: README.md
154+
path: |
155+
README.md
156+
report.json
147157
148158
graph-client:
149159
runs-on: ubuntu-latest
@@ -165,12 +175,14 @@ jobs:
165175
- name: Start
166176
run: yarn workspace graph-client start &
167177
- name: Audit
168-
run: node scripts/audit-implementation.mjs README.md
178+
run: node scripts/audit-implementation.mjs .
169179
- name: Upload report
170180
uses: actions/upload-artifact@v3
171181
with:
172182
name: graph-client-report
173-
path: README.md
183+
path: |
184+
README.md
185+
report.json
174186
175187
thegraph:
176188
runs-on: ubuntu-latest
@@ -190,12 +202,14 @@ jobs:
190202
- name: Build
191203
run: yarn build:esm
192204
- name: Audit
193-
run: node scripts/audit-implementation.mjs README.md
205+
run: node scripts/audit-implementation.mjs .
194206
- name: Upload report
195207
uses: actions/upload-artifact@v3
196208
with:
197209
name: thegraph-report
198-
path: README.md
210+
path: |
211+
README.md
212+
report.json
199213
200214
hotchocolate:
201215
runs-on: ubuntu-latest
@@ -218,12 +232,14 @@ jobs:
218232
run: yarn workspace hotchocolate start -d --wait
219233
# TODO: cache docker build artifacts
220234
- name: Audit
221-
run: node scripts/audit-implementation.mjs README.md
235+
run: node scripts/audit-implementation.mjs .
222236
- name: Upload report
223237
uses: actions/upload-artifact@v3
224238
with:
225239
name: hotchocolate-report
226-
path: README.md
240+
path: |
241+
README.md
242+
report.json
227243
228244
postgraphile:
229245
runs-on: ubuntu-latest
@@ -246,12 +262,14 @@ jobs:
246262
run: yarn workspace postgraphile start -d --wait
247263
# TODO: cache docker build artifacts
248264
- name: Audit
249-
run: node scripts/audit-implementation.mjs README.md
265+
run: node scripts/audit-implementation.mjs .
250266
- name: Upload report
251267
uses: actions/upload-artifact@v3
252268
with:
253269
name: postgraphile-report
254-
path: README.md
270+
path: |
271+
README.md
272+
report.json
255273
pioneer:
256274
runs-on: ubuntu-latest
257275
if: "!contains(github.event.head_commit.message, '[skip ci]')"
@@ -273,12 +291,14 @@ jobs:
273291
run: yarn workspace pioneer start -d --wait
274292
# TODO: cache docker build artifacts
275293
- name: Audit
276-
run: node scripts/audit-implementation.mjs README.md
294+
run: node scripts/audit-implementation.mjs .
277295
- name: Upload report
278296
uses: actions/upload-artifact@v3
279297
with:
280298
name: pioneer-report
281-
path: README.md
299+
path: |
300+
README.md
301+
report.json
282302
283303
report:
284304
name: Report

Diff for: .prettierignore

+1
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ umd
44
docs
55
CHANGELOG.md
66
implementations/*/README.md
7+
implementations/*/report.json

Diff for: implementations/apollo-server/report.json

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"total": 79,
3+
"ok": 53,
4+
"warn": 26,
5+
"error": 0
6+
}

Diff for: implementations/express-graphql/report.json

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"total": 79,
3+
"ok": 46,
4+
"warn": 33,
5+
"error": 0
6+
}

Diff for: implementations/graph-client/report.json

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"total": 79,
3+
"ok": 79,
4+
"warn": 0,
5+
"error": 0
6+
}

Diff for: implementations/graphql-helix/report.json

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"total": 79,
3+
"ok": 47,
4+
"warn": 30,
5+
"error": 2
6+
}

Diff for: implementations/graphql-yoga/report.json

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"total": 79,
3+
"ok": 79,
4+
"warn": 0,
5+
"error": 0
6+
}

Diff for: implementations/hotchocolate/report.json

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"total": 79,
3+
"ok": 77,
4+
"warn": 2,
5+
"error": 0
6+
}

Diff for: implementations/mercurius/report.json

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"total": 79,
3+
"ok": 49,
4+
"warn": 29,
5+
"error": 1
6+
}

Diff for: implementations/pioneer/report.json

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"total": 79,
3+
"ok": 76,
4+
"warn": 3,
5+
"error": 0
6+
}

Diff for: implementations/postgraphile/report.json

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"total": 79,
3+
"ok": 46,
4+
"warn": 33,
5+
"error": 0
6+
}

Diff for: implementations/thegraph/report.json

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"total": 79,
3+
"ok": 7,
4+
"warn": 58,
5+
"error": 14
6+
}

Diff for: scripts/audit-implementation.mjs

+17-5
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
*
33
* Tests a running local server for GraphQL over HTTP compliance.
44
*
5-
* Optionally creates a report in markdown given the {reportPath} argument.
5+
* Optionally creates reports in Markdown and JSON given to the [reportsDir] argument.
66
*
77
* Usage example from root of project:
88
*
99
* ```sh
1010
* yarn build:esm
11-
* PORT=4000 node scripts/audit-implementation.mjs {reportPath}
11+
* PORT=4000 node scripts/audit-implementation.mjs [reportsDir]
1212
* ```
1313
*
1414
* Note that graphql-http has to be built before running this script!
@@ -18,6 +18,7 @@
1818
import os from 'os';
1919
import fetch from 'node-fetch';
2020
import fs from 'fs/promises';
21+
import path from 'path';
2122
import { auditServer } from '../lib/index.mjs';
2223

2324
/**
@@ -55,9 +56,20 @@ async function main() {
5556
}
5657

5758
// write report if path specified
58-
const reportPath = process.argv[2];
59-
if (reportPath) {
60-
await fs.writeFile(reportPath, report);
59+
const reportsDir = process.argv[2];
60+
if (reportsDir) {
61+
await fs.writeFile(path.join(reportsDir, 'README.md'), report);
62+
await fs.writeFile(
63+
path.join(reportsDir, 'report.json'),
64+
JSON.stringify(
65+
{
66+
...counts,
67+
// TODO: more info, like what tests failed and so on
68+
},
69+
undefined,
70+
' ',
71+
) + '\n',
72+
);
6173
}
6274
}
6375

0 commit comments

Comments
 (0)