Skip to content

Commit 6e09c73

Browse files
author
Senior Dev Rotation
committed
chore(json2sql): add misc, docs, CI workflow, dev tooling, tests
Automated batch commit. Files changed: M .gitignore M README.md M package.json ?? .github/workflows/release-audit.yml ?? eslint.config.mjs ?? tests/smoke.test.js
1 parent 2da1f1a commit 6e09c73

6 files changed

Lines changed: 135 additions & 0 deletions

File tree

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: release-audit
2+
3+
on:
4+
pull_request:
5+
branches: [main, master]
6+
push:
7+
branches: [main, master]
8+
workflow_dispatch:
9+
10+
jobs:
11+
audit:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 (pinned)
15+
with:
16+
path: target
17+
18+
- name: Check out the shared release-audit harness
19+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 (pinned)
20+
with:
21+
repository: Coding-Dev-Tools/release-audit
22+
path: harness
23+
# Pin to a tag once a stable release is published; main is fine
24+
# for now since the harness is small and self-contained.
25+
ref: main
26+
27+
- name: Set up Python
28+
uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5.0.0 (pinned)
29+
with:
30+
python-version: "3.11"
31+
32+
- name: Run the 8-angle release audit
33+
working-directory: harness
34+
env:
35+
GITHUB_WORKSPACE: ${{ github.workspace }}
36+
run: |
37+
python audit.py "$GITHUB_WORKSPACE/target" --out-dir scorecard
38+
python3 - <<'PY'
39+
import json, os, pathlib
40+
repo = pathlib.Path(os.environ["GITHUB_WORKSPACE"], "target").name
41+
data = json.loads(pathlib.Path("scorecard", f"{repo}.json").read_text())
42+
print("## Release Audit (8 angles)")
43+
print()
44+
print(f"**Overall grade: {data['overall_grade']}** ({data['angles_passing']}/{data['angles_total']} angles passing)")
45+
print()
46+
print("| Angle | Grade |")
47+
print("|-------|-------|")
48+
for a in data["angles"]:
49+
print(f"| {a['angle']} | {a['grade']} |")
50+
PY
51+
52+
- name: Fail on blockers
53+
working-directory: harness
54+
env:
55+
GITHUB_WORKSPACE: ${{ github.workspace }}
56+
run: |
57+
python3 - <<'PY'
58+
import json, os, pathlib, sys
59+
repo = pathlib.Path(os.environ["GITHUB_WORKSPACE"], "target").name
60+
data = json.loads(pathlib.Path("scorecard", f"{repo}.json").read_text())
61+
if data["blockers"] > 0:
62+
print(f"::error::{data['blockers']} release-blocker angle(s) — see audit output above")
63+
sys.exit(1)
64+
PY

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,3 +72,6 @@ Thumbs.db
7272
research/
7373
fixtures/generated/
7474
.ruff_cache/
75+
76+
# Added by release-prep
77+
node_modules

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,3 +130,15 @@ json2sql is one of eleven CLI tools in the Revenue Holdings suite. One license c
130130
## License
131131

132132
MIT
133+
134+
## Install
135+
136+
```bash
137+
npm install
138+
```
139+
140+
## Test
141+
142+
```bash
143+
npm test # runs: node --test tests/
144+
```

eslint.config.mjs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import js from "@eslint/js";
2+
import globals from "globals";
3+
4+
export default [
5+
js.configs.recommended,
6+
{
7+
languageOptions: {
8+
ecmaVersion: 2023,
9+
sourceType: "commonjs",
10+
globals: { ...globals.node },
11+
},
12+
rules: {
13+
"no-unused-vars": "error",
14+
"no-undef": "error",
15+
"no-console": "warn",
16+
"eqeqeq": "error",
17+
"no-eval": "error",
18+
"no-implied-eval": "error",
19+
},
20+
},
21+
];

package.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,14 @@
4141
"preferGlobal": true,
4242
"publishConfig": {
4343
"access": "public"
44+
},
45+
"scripts": {
46+
"test": "node --test tests/*.test.js",
47+
"lint": "eslint .",
48+
"test:py": "pytest"
49+
},
50+
"devDependencies": {
51+
"@eslint/js": "^9.0.0",
52+
"eslint": "^9.0.0"
4453
}
4554
}

tests/smoke.test.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
const test = require("node:test");
2+
const assert = require("node:assert");
3+
const { execFileSync } = require("node:child_process");
4+
const fs = require("node:fs");
5+
const path = require("node:path");
6+
7+
test("smoke: package main entry exists and parses", () => {
8+
const pkg = require(path.join(__dirname, "..", "package.json"));
9+
assert.ok(pkg.name, "package.json has a name");
10+
const main = pkg.main || "index.js";
11+
const cli = pkg.bin ? Object.values(pkg.bin)[0] : null;
12+
const entry = cli || main;
13+
if (fs.existsSync(path.join(__dirname, "..", entry))) {
14+
assert.doesNotThrow(
15+
() => execFileSync("node", ["--check", entry], { stdio: "ignore" }),
16+
`${entry} must be valid JavaScript`
17+
);
18+
}
19+
});
20+
21+
test("smoke: required repo files present", () => {
22+
const root = path.join(__dirname, "..");
23+
for (const f of ["package.json", "README.md", "LICENSE"]) {
24+
assert.ok(fs.existsSync(path.join(root, f)), `${f} must exist`);
25+
}
26+
});

0 commit comments

Comments
 (0)