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:
Gabriel20xx committed 2026-10-19 21:14:31 +00:00
1 parent 199a5efaef
commit 22887fef03
100 files changed
+9740 -429

No files matched your search

+3 -2
View File
@@ -1,10 +1,11 @@
import { readFile, writeFile } from 'node:fs/promises';
const source = await readFile(new URL('../packages/web-ui/dist/styles.css', import.meta.url), 'utf8');
const tokenImport = "@import '@gabriel20xx/design-tokens/theme.css';";
// The token import may be written with single or double quotes, and with or without the semicolon.
const tokenImport = /^@import\s+(['"])@gabriel20xx\/design-tokens\/theme\.css\1\s*;?$/;
const componentStyles = source
.split(/\r?\n/)
.filter((line) => line.trim() !== tokenImport)
.filter((line) => !tokenImport.test(line.trim()))
.join('\n')
.trimStart();
+1 -1
View File
@@ -10,4 +10,4 @@ if ($LASTEXITCODE -ne 0) {
throw 'Could not configure the shared Git hooks path.'
}
Write-Host "Installed shared post-commit synchronization hook in $repositoryRoot."
Write-Host "Installed shared post-commit synchronization hook in $repositoryRoot. It runs only for commits made with SHARED_SYNC_COMMIT=1."
+12 -11
View File
@@ -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) {
+3 -3
View File
@@ -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
View File
@@ -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');
-1
View File
@@ -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*$/);
+5 -7
View File
@@ -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'));
+11 -1
View File
@@ -270,9 +270,19 @@ foreach ($consumerProject in $consumerProjects) {
$dirtyDestination = @(Invoke-GitText -WorkingDirectory $projectRoot -Arguments @('status', '--porcelain', '--', $destination))
$dirtyLegacy = if ($isLegacyEligible) { @(Invoke-GitText -WorkingDirectory $projectRoot -Arguments @('status', '--porcelain', '--', $legacyDirectoryName)) } else { @() }
if (($dirtyDestination.Count -gt 0 -or $dirtyLegacy.Count -gt 0) -and -not $Force) {
$hasLocalChanges = $dirtyDestination.Count -gt 0 -or $dirtyLegacy.Count -gt 0
if ($hasLocalChanges -and -not $Force) {
throw "$destination has local changes. Commit them or rerun with -Force."
}
if ($hasLocalChanges) {
# -Force replaces the snapshot, so keep a copy of what it replaces first.
$backupRoot = Join-Path ([IO.Path]::GetTempPath()) ('shared-sync-backup-' + [Guid]::NewGuid().ToString('N'))
New-Item -ItemType Directory -Force -Path $backupRoot | Out-Null
foreach ($existingEntry in @($destinationEntry, $legacyEntry) | Where-Object { $null -ne $_ }) {
Copy-Item -LiteralPath $existingEntry.FullName -Destination (Join-Path $backupRoot $existingEntry.Name) -Recurse -Force
}
Write-Host " Backed up the local $destination changes in $relativeProject to $backupRoot before overwriting."
}
if ($null -ne $legacyEntry) {
$temporaryRenamePath = Join-Path $projectRoot ('.shared-sync-rename-' + [Guid]::NewGuid().ToString('N'))