Skip to content

Commit

Permalink
chore: report in JSON too (#34)
Browse files Browse the repository at this point in the history
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
enisdenjo and github-actions[bot] authored Jan 10, 2023
1 parent f80c334 commit 7393fdf
Show file tree
Hide file tree
Showing 13 changed files with 118 additions and 25 deletions.
60 changes: 40 additions & 20 deletions .github/workflows/audits.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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]')"
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ umd
docs
CHANGELOG.md
implementations/*/README.md
implementations/*/report.json
6 changes: 6 additions & 0 deletions implementations/apollo-server/report.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"total": 79,
"ok": 53,
"warn": 26,
"error": 0
}
6 changes: 6 additions & 0 deletions implementations/express-graphql/report.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"total": 79,
"ok": 46,
"warn": 33,
"error": 0
}
6 changes: 6 additions & 0 deletions implementations/graph-client/report.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"total": 79,
"ok": 79,
"warn": 0,
"error": 0
}
6 changes: 6 additions & 0 deletions implementations/graphql-helix/report.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"total": 79,
"ok": 47,
"warn": 30,
"error": 2
}
6 changes: 6 additions & 0 deletions implementations/graphql-yoga/report.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"total": 79,
"ok": 79,
"warn": 0,
"error": 0
}
6 changes: 6 additions & 0 deletions implementations/hotchocolate/report.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"total": 79,
"ok": 77,
"warn": 2,
"error": 0
}
6 changes: 6 additions & 0 deletions implementations/mercurius/report.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"total": 79,
"ok": 49,
"warn": 29,
"error": 1
}
6 changes: 6 additions & 0 deletions implementations/pioneer/report.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"total": 79,
"ok": 76,
"warn": 3,
"error": 0
}
6 changes: 6 additions & 0 deletions implementations/postgraphile/report.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"total": 79,
"ok": 46,
"warn": 33,
"error": 0
}
6 changes: 6 additions & 0 deletions implementations/thegraph/report.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"total": 79,
"ok": 7,
"warn": 58,
"error": 14
}
22 changes: 17 additions & 5 deletions scripts/audit-implementation.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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!
Expand All @@ -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';

/**
Expand Down Expand Up @@ -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',
);
}
}

Expand Down

0 comments on commit 7393fdf

Please sign in to comment.