diff --git a/.github/workflows/audits.yml b/.github/workflows/audits.yml index 99487c40..3576e168 100644 --- a/.github/workflows/audits.yml +++ b/.github/workflows/audits.yml @@ -30,12 +30,14 @@ 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: name: express-graphql-report - path: README.md + path: | + README.md + report.json apollo-server: runs-on: ubuntu-latest @@ -57,12 +59,14 @@ 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: name: apollo-server-report - path: README.md + path: | + README.md + report.json mercurius: runs-on: ubuntu-latest @@ -84,12 +88,14 @@ 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: name: mercurius-report - path: README.md + path: | + README.md + report.json graphql-yoga: runs-on: ubuntu-latest @@ -111,12 +117,14 @@ 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: name: graphql-yoga-report - path: README.md + path: | + README.md + report.json graphql-helix: runs-on: ubuntu-latest @@ -138,12 +146,14 @@ 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: name: graphql-helix-report - path: README.md + path: | + README.md + report.json graph-client: runs-on: ubuntu-latest @@ -165,12 +175,14 @@ 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: name: graph-client-report - path: README.md + path: | + README.md + report.json thegraph: runs-on: ubuntu-latest @@ -190,12 +202,14 @@ 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: name: thegraph-report - path: README.md + path: | + README.md + report.json hotchocolate: runs-on: ubuntu-latest @@ -218,12 +232,14 @@ 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: name: hotchocolate-report - path: README.md + path: | + README.md + report.json postgraphile: runs-on: ubuntu-latest @@ -246,12 +262,14 @@ 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: 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]')" @@ -273,12 +291,14 @@ 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: name: pioneer-report - path: README.md + path: | + README.md + report.json report: name: Report 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 diff --git a/implementations/apollo-server/report.json b/implementations/apollo-server/report.json new file mode 100644 index 00000000..749a9563 --- /dev/null +++ b/implementations/apollo-server/report.json @@ -0,0 +1,6 @@ +{ + "total": 79, + "ok": 53, + "warn": 26, + "error": 0 +} diff --git a/implementations/express-graphql/report.json b/implementations/express-graphql/report.json new file mode 100644 index 00000000..74ddd1e1 --- /dev/null +++ b/implementations/express-graphql/report.json @@ -0,0 +1,6 @@ +{ + "total": 79, + "ok": 46, + "warn": 33, + "error": 0 +} diff --git a/implementations/graph-client/report.json b/implementations/graph-client/report.json new file mode 100644 index 00000000..ff51d2fc --- /dev/null +++ b/implementations/graph-client/report.json @@ -0,0 +1,6 @@ +{ + "total": 79, + "ok": 79, + "warn": 0, + "error": 0 +} diff --git a/implementations/graphql-helix/report.json b/implementations/graphql-helix/report.json new file mode 100644 index 00000000..28344c4d --- /dev/null +++ b/implementations/graphql-helix/report.json @@ -0,0 +1,6 @@ +{ + "total": 79, + "ok": 47, + "warn": 30, + "error": 2 +} diff --git a/implementations/graphql-yoga/report.json b/implementations/graphql-yoga/report.json new file mode 100644 index 00000000..ff51d2fc --- /dev/null +++ b/implementations/graphql-yoga/report.json @@ -0,0 +1,6 @@ +{ + "total": 79, + "ok": 79, + "warn": 0, + "error": 0 +} diff --git a/implementations/hotchocolate/report.json b/implementations/hotchocolate/report.json new file mode 100644 index 00000000..de5b9e54 --- /dev/null +++ b/implementations/hotchocolate/report.json @@ -0,0 +1,6 @@ +{ + "total": 79, + "ok": 77, + "warn": 2, + "error": 0 +} diff --git a/implementations/mercurius/report.json b/implementations/mercurius/report.json new file mode 100644 index 00000000..d14e0a07 --- /dev/null +++ b/implementations/mercurius/report.json @@ -0,0 +1,6 @@ +{ + "total": 79, + "ok": 49, + "warn": 29, + "error": 1 +} diff --git a/implementations/pioneer/report.json b/implementations/pioneer/report.json new file mode 100644 index 00000000..0b6c72a3 --- /dev/null +++ b/implementations/pioneer/report.json @@ -0,0 +1,6 @@ +{ + "total": 79, + "ok": 76, + "warn": 3, + "error": 0 +} diff --git a/implementations/postgraphile/report.json b/implementations/postgraphile/report.json new file mode 100644 index 00000000..74ddd1e1 --- /dev/null +++ b/implementations/postgraphile/report.json @@ -0,0 +1,6 @@ +{ + "total": 79, + "ok": 46, + "warn": 33, + "error": 0 +} diff --git a/implementations/thegraph/report.json b/implementations/thegraph/report.json new file mode 100644 index 00000000..d082b2c2 --- /dev/null +++ b/implementations/thegraph/report.json @@ -0,0 +1,6 @@ +{ + "total": 79, + "ok": 7, + "warn": 58, + "error": 14 +} diff --git a/scripts/audit-implementation.mjs b/scripts/audit-implementation.mjs index 53b1f429..16115b9b 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, + // TODO: more info, like what tests failed and so on + }, + undefined, + ' ', + ) + '\n', + ); } }