ci: expand CI checks and make consumer sync opt-in
- Add Go, npm, Python, and Java validation to CI - Run Go tests against PostgreSQL - Record performance fixes in the report
This commit is contained in:
1 parent
199a5efaef
commit
22887fef03
100 files changed
+9740
-429
No files matched your search
@@ -6,21 +6,18 @@ import { fileURLToPath } from 'node:url';
|
||||
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
||||
const repoRoot = path.resolve(__dirname, '..', '..');
|
||||
|
||||
// The monorepo kept its canonical JS/TS test sources under a single repo-root tests/ dir, which
|
||||
// doesn't exist in this repo. Scan the real locations JS/TS test files can currently live in
|
||||
// this repo instead: webui/src (SvelteKit app) and shared/packages/*/test(s) (vendored from the
|
||||
// shared repo). repoRoot/tests is kept as a forward-compatible root in case one is added later.
|
||||
// As of this repo's extraction, none of these contain vitest/mocha/jest-style test files yet
|
||||
// (shared/packages/node-backend/test/auth.test.js uses plain `node --test`, which shares the same
|
||||
// describe/it/test .skip API surface these patterns already match), so this currently passes
|
||||
// trivially rather than being a dead check.
|
||||
// Scan the JS/TS test locations that exist in this repo: the web-ui tests (packages/web-ui/tests,
|
||||
// plus anything under its source) and the Node package's test directory. repoRoot/tests is kept as a
|
||||
// forward-compatible root. A scan that finds no test files fails, so the check cannot pass
|
||||
// vacuously.
|
||||
const testsRoots = [
|
||||
path.join(repoRoot, 'tests'),
|
||||
path.join(repoRoot, 'webui', 'src'),
|
||||
path.join(repoRoot, 'shared', 'packages'),
|
||||
path.join(repoRoot, 'packages', 'web-ui', 'src'),
|
||||
path.join(repoRoot, 'packages', 'web-ui', 'tests'),
|
||||
path.join(repoRoot, 'packages', 'node-backend', 'test'),
|
||||
];
|
||||
|
||||
const TEST_FILE_EXTENSIONS = new Set(['.js', '.mjs', '.cjs']);
|
||||
const TEST_FILE_EXTENSIONS = new Set(['.js', '.mjs', '.cjs', '.ts']);
|
||||
const DISALLOWED_LINE_PATTERNS = [
|
||||
{
|
||||
name: 'skip/todo/runIf declaration',
|
||||
@@ -79,6 +76,10 @@ function collectViolations(filePath) {
|
||||
}
|
||||
|
||||
const files = testsRoots.flatMap(listTestFiles).sort();
|
||||
if (files.length === 0) {
|
||||
console.error('[enforce-no-skipped-tests] No test files were found in the scanned roots; refusing to report success.');
|
||||
process.exit(1);
|
||||
}
|
||||
const failures = [];
|
||||
|
||||
for (const filePath of files) {
|
||||
|
||||
@@ -12,13 +12,13 @@
|
||||
*/
|
||||
import { spawnSync } from 'node:child_process';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import { dirname, resolve, join } from 'node:path';
|
||||
import { dirname, resolve } from 'node:path';
|
||||
import { existsSync } from 'node:fs';
|
||||
|
||||
const __dirname = dirname(fileURLToPath(import.meta.url));
|
||||
const root = resolve(__dirname, '..', '..');
|
||||
|
||||
const packages = [{ name: 'webui', path: 'webui' }];
|
||||
const packages = [{ name: 'web-ui', path: 'packages/web-ui' }];
|
||||
|
||||
function resolveEslintInvocation({ pkgDir }) {
|
||||
const pkgEslintJs = resolve(pkgDir, 'node_modules', 'eslint', 'bin', 'eslint.js');
|
||||
@@ -65,7 +65,7 @@ for (const pkg of packages) {
|
||||
continue;
|
||||
}
|
||||
|
||||
let parsed = [];
|
||||
let parsed;
|
||||
try {
|
||||
parsed = JSON.parse(result.stdout || '[]');
|
||||
} catch (e) {
|
||||
|
||||
+17
-26
@@ -1,19 +1,18 @@
|
||||
#!/usr/bin/env node
|
||||
/**
|
||||
* Lint all JS/TS packages sequentially with clear section headers, plus a repo-wide Prettier
|
||||
* format check.
|
||||
* Lint all JS/TS packages sequentially with clear section headers, plus the Prettier format check.
|
||||
* Exits non‑zero if any package fails its lint step.
|
||||
*
|
||||
* Shared extraction note: the monorepo version of this script discovered the monorepo root
|
||||
* by walking up for a MediaShared/package.json marker, iterated nine sibling Media* packages
|
||||
* against a shared root eslint.config.mjs/.stylelintrc.json, and ran Prettier/Stylelint out of
|
||||
* MediaShared/node_modules (npm workspace hoisting). None of that exists in this repo: there is
|
||||
* no root package.json, no shared devDependency hoisting, and webui/ is the only JS/TS package —
|
||||
* it already ships its own local eslint.config.js and prettier.config.js. The Stylelint section
|
||||
* has been dropped entirely rather than pointed at a nonexistent .stylelintrc.json: webui has no
|
||||
* stylelint devDependency and its CSS is Tailwind-authored, so there was nothing equivalent to
|
||||
* carry over. If CSS linting is wanted later, it would need its own stylelint config added to
|
||||
* webui/ (or a new root package.json) first.
|
||||
* MediaShared/node_modules (npm workspace hoisting). Here the only JS/TS package with a lint
|
||||
* target is packages/web-ui, linted with the root eslint.config.js (ESLint is a root
|
||||
* devDependency, so `npx eslint` resolves it). Prettier is checked through the root
|
||||
* `format:check` script, which covers only the files written to the Prettier style (see
|
||||
* .prettierrc.json): the older sources were never formatted with it. The Stylelint section has
|
||||
* been dropped entirely rather than pointed at a nonexistent .stylelintrc.json: web-ui's CSS is
|
||||
* Tailwind-authored, so there was nothing equivalent to carry over.
|
||||
*/
|
||||
import { spawnSync } from 'node:child_process';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
@@ -23,7 +22,7 @@ import { existsSync } from 'node:fs';
|
||||
const __dirname = dirname(fileURLToPath(import.meta.url));
|
||||
const root = resolve(__dirname, '..', '..');
|
||||
|
||||
const packages = [{ name: 'webui', path: 'webui' }];
|
||||
const packages = [{ name: 'web-ui', path: 'packages/web-ui' }];
|
||||
|
||||
function resolveEslintInvocation({ pkgDir }) {
|
||||
const pkgEslintJs = resolve(pkgDir, 'node_modules', 'eslint', 'bin', 'eslint.js');
|
||||
@@ -80,23 +79,15 @@ for (const pkg of packages) {
|
||||
}
|
||||
}
|
||||
|
||||
// ===== webui: Prettier format check =====
|
||||
console.log('\n===== FORMAT CHECK (Prettier, webui) =====');
|
||||
// ===== Prettier format check (the files covered by the root format:check script) =====
|
||||
console.log('\n===== FORMAT CHECK (Prettier) =====');
|
||||
{
|
||||
const webuiDir = resolve(root, 'webui');
|
||||
const prettierBin = resolve(webuiDir, 'node_modules', 'prettier', 'bin', 'prettier.cjs');
|
||||
const npxCmd = process.platform === 'win32' ? 'npx.cmd' : 'npx';
|
||||
const fmtResult = existsSync(prettierBin)
|
||||
? spawnCrossPlatform(process.execPath, [prettierBin, '--check', '.'], {
|
||||
cwd: webuiDir,
|
||||
stdio: 'inherit',
|
||||
env: process.env,
|
||||
})
|
||||
: spawnCrossPlatform(npxCmd, ['prettier', '--check', '.'], {
|
||||
cwd: webuiDir,
|
||||
stdio: 'inherit',
|
||||
env: process.env,
|
||||
});
|
||||
const npmCmd = process.platform === 'win32' ? 'npm.cmd' : 'npm';
|
||||
const fmtResult = spawnCrossPlatform(npmCmd, ['run', 'format:check'], {
|
||||
cwd: root,
|
||||
stdio: 'inherit',
|
||||
env: process.env,
|
||||
});
|
||||
if (fmtResult.error || fmtResult.status !== 0) {
|
||||
failures++;
|
||||
console.error('✖ Format check failed');
|
||||
|
||||
@@ -48,7 +48,6 @@ child.stdout.on('data', d => {
|
||||
// Capture last JSON object emitted by vitest reporter (it prints progress lines + final JSON)
|
||||
jsonBlock += text;
|
||||
});
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
child.on('close', _code => {
|
||||
// Attempt to find the final JSON object (Vitest prints *only* JSON in our current mode but be defensive)
|
||||
const match = jsonBlock.match(/(\{[\s\S]*\})\s*$/);
|
||||
|
||||
@@ -100,13 +100,11 @@ async function updatePackageJson(packageJsonPath) {
|
||||
return { changed, changes };
|
||||
}
|
||||
|
||||
// this repo has no root package.json / npm workspaces (unlike the monorepo this was extracted
|
||||
// from), so there's no "workspaces" array to discover packages from. webui/ is the only local npm
|
||||
// package whose dependency versions this repo owns and should bump directly. shared/package.json
|
||||
// is intentionally excluded: it's a vendored, byte-for-byte copy synced in from the separate
|
||||
// shared repo (see scripts/sync-shared.mjs) and any local edit to it would just be overwritten by
|
||||
// the next sync — dependency bumps for shared/ belong upstream in that repo instead.
|
||||
const LOCAL_PACKAGE_DIRS = ['webui'];
|
||||
// The root package.json declares npm workspaces (packages/*). The local packages whose dependency
|
||||
// versions this repo owns and bumps directly are listed here. Vendored copies of this library in
|
||||
// other repositories are not listed: any local edit to them would be overwritten by the next sync,
|
||||
// so bumps for them belong upstream.
|
||||
const LOCAL_PACKAGE_DIRS = ['packages/web-ui', 'packages/node-backend'];
|
||||
|
||||
async function main() {
|
||||
const packageJsonPaths = LOCAL_PACKAGE_DIRS.map(dir => path.join(repoRoot, dir, 'package.json'));
|
||||
|
||||
Reference in new issue
Block a user