From 84f187338396ac5e1a84e34c1b0398d611aece8b Mon Sep 17 00:00:00 2001 From: enisdenjo Date: Tue, 10 Jan 2023 14:39:24 +0100 Subject: [PATCH 1/7] report with json --- .github/workflows/audits.yml | 20 ++++++++++---------- scripts/audit-implementation.mjs | 22 +++++++++++++++++----- 2 files changed, 27 insertions(+), 15 deletions(-) diff --git a/.github/workflows/audits.yml b/.github/workflows/audits.yml index 99487c40..b23e6b8d 100644 --- a/.github/workflows/audits.yml +++ b/.github/workflows/audits.yml @@ -30,7 +30,7 @@ jobs: - name: Start run: yarn workspace express-graphql start & - name: Audit - run: node scripts/audit-implementation.mjs README.md + run: node scripts/audit-implementation.mjs . - name: Upload report uses: actions/upload-artifact@v3 with: @@ -57,7 +57,7 @@ jobs: - name: Start run: yarn workspace apollo-server start & - name: Audit - run: node scripts/audit-implementation.mjs README.md + run: node scripts/audit-implementation.mjs . - name: Upload report uses: actions/upload-artifact@v3 with: @@ -84,7 +84,7 @@ jobs: - name: Start run: yarn workspace mercurius start & - name: Audit - run: node scripts/audit-implementation.mjs README.md + run: node scripts/audit-implementation.mjs . - name: Upload report uses: actions/upload-artifact@v3 with: @@ -111,7 +111,7 @@ jobs: - name: Start run: yarn workspace graphql-yoga start & - name: Audit - run: node scripts/audit-implementation.mjs README.md + run: node scripts/audit-implementation.mjs . - name: Upload report uses: actions/upload-artifact@v3 with: @@ -138,7 +138,7 @@ jobs: - name: Start run: yarn workspace graphql-helix start & - name: Audit - run: node scripts/audit-implementation.mjs README.md + run: node scripts/audit-implementation.mjs . - name: Upload report uses: actions/upload-artifact@v3 with: @@ -165,7 +165,7 @@ jobs: - name: Start run: yarn workspace graph-client start & - name: Audit - run: node scripts/audit-implementation.mjs README.md + run: node scripts/audit-implementation.mjs . - name: Upload report uses: actions/upload-artifact@v3 with: @@ -190,7 +190,7 @@ jobs: - name: Build run: yarn build:esm - name: Audit - run: node scripts/audit-implementation.mjs README.md + run: node scripts/audit-implementation.mjs . - name: Upload report uses: actions/upload-artifact@v3 with: @@ -218,7 +218,7 @@ jobs: run: yarn workspace hotchocolate start -d --wait # TODO: cache docker build artifacts - name: Audit - run: node scripts/audit-implementation.mjs README.md + run: node scripts/audit-implementation.mjs . - name: Upload report uses: actions/upload-artifact@v3 with: @@ -246,7 +246,7 @@ jobs: run: yarn workspace postgraphile start -d --wait # TODO: cache docker build artifacts - name: Audit - run: node scripts/audit-implementation.mjs README.md + run: node scripts/audit-implementation.mjs . - name: Upload report uses: actions/upload-artifact@v3 with: @@ -273,7 +273,7 @@ jobs: run: yarn workspace pioneer start -d --wait # TODO: cache docker build artifacts - name: Audit - run: node scripts/audit-implementation.mjs README.md + run: node scripts/audit-implementation.mjs . - name: Upload report uses: actions/upload-artifact@v3 with: diff --git a/scripts/audit-implementation.mjs b/scripts/audit-implementation.mjs index 53b1f429..53f595e8 100644 --- a/scripts/audit-implementation.mjs +++ b/scripts/audit-implementation.mjs @@ -2,13 +2,13 @@ * * Tests a running local server for GraphQL over HTTP compliance. * - * Optionally creates a report in markdown given the {reportPath} argument. + * Optionally creates reports in Markdown and JSON given to the [reportsDir] argument. * * Usage example from root of project: * * ```sh * yarn build:esm - * PORT=4000 node scripts/audit-implementation.mjs {reportPath} + * PORT=4000 node scripts/audit-implementation.mjs [reportsDir] * ``` * * Note that graphql-http has to be built before running this script! @@ -18,6 +18,7 @@ import os from 'os'; import fetch from 'node-fetch'; import fs from 'fs/promises'; +import path from 'path'; import { auditServer } from '../lib/index.mjs'; /** @@ -55,9 +56,20 @@ async function main() { } // write report if path specified - const reportPath = process.argv[2]; - if (reportPath) { - await fs.writeFile(reportPath, report); + const reportsDir = process.argv[2]; + if (reportsDir) { + await fs.writeFile(path.join(reportsDir, 'README.md'), report); + await fs.writeFile( + path.join(reportsDir, 'report.json'), + JSON.stringify( + { + ...counts, + summary, + }, + undefined, + ' ', + ), + ); } } From e85b49b21df97e3ca15783c6da3fb41c2444fa79 Mon Sep 17 00:00:00 2001 From: enisdenjo Date: Tue, 10 Jan 2023 14:50:29 +0100 Subject: [PATCH 2/7] summary title unnecessary --- scripts/audit-implementation.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/audit-implementation.mjs b/scripts/audit-implementation.mjs index 53f595e8..a996fc00 100644 --- a/scripts/audit-implementation.mjs +++ b/scripts/audit-implementation.mjs @@ -64,7 +64,7 @@ async function main() { JSON.stringify( { ...counts, - summary, + // TODO: more info, like what tests failed and so on }, undefined, ' ', From ea62466a26ece285163368be22b61673cc2231b5 Mon Sep 17 00:00:00 2001 From: enisdenjo Date: Tue, 10 Jan 2023 15:12:01 +0100 Subject: [PATCH 3/7] include report.json in artifact --- .github/workflows/audits.yml | 40 +++++++++++++++++++++++++++--------- 1 file changed, 30 insertions(+), 10 deletions(-) diff --git a/.github/workflows/audits.yml b/.github/workflows/audits.yml index b23e6b8d..3576e168 100644 --- a/.github/workflows/audits.yml +++ b/.github/workflows/audits.yml @@ -35,7 +35,9 @@ jobs: uses: actions/upload-artifact@v3 with: name: express-graphql-report - path: README.md + path: | + README.md + report.json apollo-server: runs-on: ubuntu-latest @@ -62,7 +64,9 @@ jobs: uses: actions/upload-artifact@v3 with: name: apollo-server-report - path: README.md + path: | + README.md + report.json mercurius: runs-on: ubuntu-latest @@ -89,7 +93,9 @@ jobs: uses: actions/upload-artifact@v3 with: name: mercurius-report - path: README.md + path: | + README.md + report.json graphql-yoga: runs-on: ubuntu-latest @@ -116,7 +122,9 @@ jobs: uses: actions/upload-artifact@v3 with: name: graphql-yoga-report - path: README.md + path: | + README.md + report.json graphql-helix: runs-on: ubuntu-latest @@ -143,7 +151,9 @@ jobs: uses: actions/upload-artifact@v3 with: name: graphql-helix-report - path: README.md + path: | + README.md + report.json graph-client: runs-on: ubuntu-latest @@ -170,7 +180,9 @@ jobs: uses: actions/upload-artifact@v3 with: name: graph-client-report - path: README.md + path: | + README.md + report.json thegraph: runs-on: ubuntu-latest @@ -195,7 +207,9 @@ jobs: uses: actions/upload-artifact@v3 with: name: thegraph-report - path: README.md + path: | + README.md + report.json hotchocolate: runs-on: ubuntu-latest @@ -223,7 +237,9 @@ jobs: uses: actions/upload-artifact@v3 with: name: hotchocolate-report - path: README.md + path: | + README.md + report.json postgraphile: runs-on: ubuntu-latest @@ -251,7 +267,9 @@ jobs: uses: actions/upload-artifact@v3 with: name: postgraphile-report - path: README.md + path: | + README.md + report.json pioneer: runs-on: ubuntu-latest if: "!contains(github.event.head_commit.message, '[skip ci]')" @@ -278,7 +296,9 @@ jobs: uses: actions/upload-artifact@v3 with: name: pioneer-report - path: README.md + path: | + README.md + report.json report: name: Report From de7d0131adb4f6185c9107b709309495813fab99 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 10 Jan 2023 14:16:37 +0000 Subject: [PATCH 4/7] docs(implementations): audit report [skip ci] --- implementations/apollo-server/report.json | 6 ++++++ implementations/express-graphql/report.json | 6 ++++++ implementations/graph-client/report.json | 6 ++++++ implementations/graphql-helix/report.json | 6 ++++++ implementations/graphql-yoga/report.json | 6 ++++++ implementations/hotchocolate/report.json | 6 ++++++ implementations/mercurius/report.json | 6 ++++++ implementations/pioneer/report.json | 6 ++++++ implementations/postgraphile/report.json | 6 ++++++ implementations/thegraph/report.json | 6 ++++++ 10 files changed, 60 insertions(+) create mode 100644 implementations/apollo-server/report.json create mode 100644 implementations/express-graphql/report.json create mode 100644 implementations/graph-client/report.json create mode 100644 implementations/graphql-helix/report.json create mode 100644 implementations/graphql-yoga/report.json create mode 100644 implementations/hotchocolate/report.json create mode 100644 implementations/mercurius/report.json create mode 100644 implementations/pioneer/report.json create mode 100644 implementations/postgraphile/report.json create mode 100644 implementations/thegraph/report.json diff --git a/implementations/apollo-server/report.json b/implementations/apollo-server/report.json new file mode 100644 index 00000000..18a60ce0 --- /dev/null +++ b/implementations/apollo-server/report.json @@ -0,0 +1,6 @@ +{ + "total": 79, + "ok": 53, + "warn": 26, + "error": 0 +} \ No newline at end of file diff --git a/implementations/express-graphql/report.json b/implementations/express-graphql/report.json new file mode 100644 index 00000000..e08f9af2 --- /dev/null +++ b/implementations/express-graphql/report.json @@ -0,0 +1,6 @@ +{ + "total": 79, + "ok": 46, + "warn": 33, + "error": 0 +} \ No newline at end of file diff --git a/implementations/graph-client/report.json b/implementations/graph-client/report.json new file mode 100644 index 00000000..0e3567bd --- /dev/null +++ b/implementations/graph-client/report.json @@ -0,0 +1,6 @@ +{ + "total": 79, + "ok": 79, + "warn": 0, + "error": 0 +} \ No newline at end of file diff --git a/implementations/graphql-helix/report.json b/implementations/graphql-helix/report.json new file mode 100644 index 00000000..c2d6a1f5 --- /dev/null +++ b/implementations/graphql-helix/report.json @@ -0,0 +1,6 @@ +{ + "total": 79, + "ok": 47, + "warn": 30, + "error": 2 +} \ No newline at end of file diff --git a/implementations/graphql-yoga/report.json b/implementations/graphql-yoga/report.json new file mode 100644 index 00000000..0e3567bd --- /dev/null +++ b/implementations/graphql-yoga/report.json @@ -0,0 +1,6 @@ +{ + "total": 79, + "ok": 79, + "warn": 0, + "error": 0 +} \ No newline at end of file diff --git a/implementations/hotchocolate/report.json b/implementations/hotchocolate/report.json new file mode 100644 index 00000000..55a7756d --- /dev/null +++ b/implementations/hotchocolate/report.json @@ -0,0 +1,6 @@ +{ + "total": 79, + "ok": 77, + "warn": 2, + "error": 0 +} \ No newline at end of file diff --git a/implementations/mercurius/report.json b/implementations/mercurius/report.json new file mode 100644 index 00000000..5ab582ec --- /dev/null +++ b/implementations/mercurius/report.json @@ -0,0 +1,6 @@ +{ + "total": 79, + "ok": 49, + "warn": 29, + "error": 1 +} \ No newline at end of file diff --git a/implementations/pioneer/report.json b/implementations/pioneer/report.json new file mode 100644 index 00000000..e9531009 --- /dev/null +++ b/implementations/pioneer/report.json @@ -0,0 +1,6 @@ +{ + "total": 79, + "ok": 76, + "warn": 3, + "error": 0 +} \ No newline at end of file diff --git a/implementations/postgraphile/report.json b/implementations/postgraphile/report.json new file mode 100644 index 00000000..e08f9af2 --- /dev/null +++ b/implementations/postgraphile/report.json @@ -0,0 +1,6 @@ +{ + "total": 79, + "ok": 46, + "warn": 33, + "error": 0 +} \ No newline at end of file diff --git a/implementations/thegraph/report.json b/implementations/thegraph/report.json new file mode 100644 index 00000000..45724c25 --- /dev/null +++ b/implementations/thegraph/report.json @@ -0,0 +1,6 @@ +{ + "total": 79, + "ok": 7, + "warn": 58, + "error": 14 +} \ No newline at end of file From 6e5601240bd88ac2274e7b047e12a1598ba6273a Mon Sep 17 00:00:00 2001 From: enisdenjo Date: Tue, 10 Jan 2023 15:18:17 +0100 Subject: [PATCH 5/7] add new line to report json --- scripts/audit-implementation.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/audit-implementation.mjs b/scripts/audit-implementation.mjs index a996fc00..16115b9b 100644 --- a/scripts/audit-implementation.mjs +++ b/scripts/audit-implementation.mjs @@ -68,7 +68,7 @@ async function main() { }, undefined, ' ', - ), + ) + '\n', ); } } From 9987daad246e0dced412be7f28a29016e351d1c2 Mon Sep 17 00:00:00 2001 From: enisdenjo Date: Tue, 10 Jan 2023 15:20:32 +0100 Subject: [PATCH 6/7] prettier ignore report.json --- .prettierignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.prettierignore b/.prettierignore index 3d96a17c..51719591 100644 --- a/.prettierignore +++ b/.prettierignore @@ -4,3 +4,4 @@ umd docs CHANGELOG.md implementations/*/README.md +implementations/*/report.json From dedfd7dd6989ec5b87b60e47f00a895198e71cbe Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 10 Jan 2023 14:23:11 +0000 Subject: [PATCH 7/7] docs(implementations): audit report [skip ci] --- implementations/apollo-server/report.json | 2 +- implementations/express-graphql/report.json | 2 +- implementations/graph-client/report.json | 2 +- implementations/graphql-helix/report.json | 2 +- implementations/graphql-yoga/report.json | 2 +- implementations/hotchocolate/report.json | 2 +- implementations/mercurius/report.json | 2 +- implementations/pioneer/report.json | 2 +- implementations/postgraphile/report.json | 2 +- implementations/thegraph/report.json | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/implementations/apollo-server/report.json b/implementations/apollo-server/report.json index 18a60ce0..749a9563 100644 --- a/implementations/apollo-server/report.json +++ b/implementations/apollo-server/report.json @@ -3,4 +3,4 @@ "ok": 53, "warn": 26, "error": 0 -} \ No newline at end of file +} diff --git a/implementations/express-graphql/report.json b/implementations/express-graphql/report.json index e08f9af2..74ddd1e1 100644 --- a/implementations/express-graphql/report.json +++ b/implementations/express-graphql/report.json @@ -3,4 +3,4 @@ "ok": 46, "warn": 33, "error": 0 -} \ No newline at end of file +} diff --git a/implementations/graph-client/report.json b/implementations/graph-client/report.json index 0e3567bd..ff51d2fc 100644 --- a/implementations/graph-client/report.json +++ b/implementations/graph-client/report.json @@ -3,4 +3,4 @@ "ok": 79, "warn": 0, "error": 0 -} \ No newline at end of file +} diff --git a/implementations/graphql-helix/report.json b/implementations/graphql-helix/report.json index c2d6a1f5..28344c4d 100644 --- a/implementations/graphql-helix/report.json +++ b/implementations/graphql-helix/report.json @@ -3,4 +3,4 @@ "ok": 47, "warn": 30, "error": 2 -} \ No newline at end of file +} diff --git a/implementations/graphql-yoga/report.json b/implementations/graphql-yoga/report.json index 0e3567bd..ff51d2fc 100644 --- a/implementations/graphql-yoga/report.json +++ b/implementations/graphql-yoga/report.json @@ -3,4 +3,4 @@ "ok": 79, "warn": 0, "error": 0 -} \ No newline at end of file +} diff --git a/implementations/hotchocolate/report.json b/implementations/hotchocolate/report.json index 55a7756d..de5b9e54 100644 --- a/implementations/hotchocolate/report.json +++ b/implementations/hotchocolate/report.json @@ -3,4 +3,4 @@ "ok": 77, "warn": 2, "error": 0 -} \ No newline at end of file +} diff --git a/implementations/mercurius/report.json b/implementations/mercurius/report.json index 5ab582ec..d14e0a07 100644 --- a/implementations/mercurius/report.json +++ b/implementations/mercurius/report.json @@ -3,4 +3,4 @@ "ok": 49, "warn": 29, "error": 1 -} \ No newline at end of file +} diff --git a/implementations/pioneer/report.json b/implementations/pioneer/report.json index e9531009..0b6c72a3 100644 --- a/implementations/pioneer/report.json +++ b/implementations/pioneer/report.json @@ -3,4 +3,4 @@ "ok": 76, "warn": 3, "error": 0 -} \ No newline at end of file +} diff --git a/implementations/postgraphile/report.json b/implementations/postgraphile/report.json index e08f9af2..74ddd1e1 100644 --- a/implementations/postgraphile/report.json +++ b/implementations/postgraphile/report.json @@ -3,4 +3,4 @@ "ok": 46, "warn": 33, "error": 0 -} \ No newline at end of file +} diff --git a/implementations/thegraph/report.json b/implementations/thegraph/report.json index 45724c25..d082b2c2 100644 --- a/implementations/thegraph/report.json +++ b/implementations/thegraph/report.json @@ -3,4 +3,4 @@ "ok": 7, "warn": 58, "error": 14 -} \ No newline at end of file +}