Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 24 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,30 @@ jobs:
npm run validate:members
- name: Check content contracts
if: ${{ !cancelled() && env.CONTENT_ONLY == 'true' }}
run: >-
node --test tests/docs-contract.test.mjs
tests/markdown-references.test.mjs
tests/community-group-coverage.test.mjs
# Every unit suite that reads an authored document (docs/, blog/,
# adr/ or a root document). tests/audit-gate.test.mjs also reads
# SECURITY.md but spends ~40s exercising npm audit, so it stays on
# the full path.
run: |
node --test \
tests/docs-contract.test.mjs \
tests/markdown-references.test.mjs \
tests/community-group-coverage.test.mjs \
tests/adr-contract.test.mjs \
tests/architectures-sidebar-contract.test.mjs \
tests/blog-frontmatter.test.mjs \
tests/community-people-data.test.mjs \
tests/content-security-contract.test.mjs \
tests/contributing-e2e-setup.test.mjs \
tests/contributing-just-build-parity.test.mjs \
tests/dev-environment.test.mjs \
tests/docs-threshold-parity.test.mjs \
tests/e2e-docs-threshold-parity.test.mjs \
tests/enduser-directory-copy.test.mjs \
tests/governance-hygiene-parity.test.mjs \
tests/root-docs-links.test.mjs \
tests/sitemap-exclusions.test.mjs \
tests/static-assets.test.mjs
- name: Build production site
run: npm run build:production

Expand Down
26 changes: 24 additions & 2 deletions tests/content-only-ci-workflow.test.mjs
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import assert from 'node:assert/strict';
import { readFileSync } from 'node:fs';
import { existsSync, readFileSync } from 'node:fs';
import { join } from 'node:path';
import test from 'node:test';

import { resolveRepoRoot } from './helpers.mjs';
import { readWorkflow } from './helpers-workflows.mjs';

const repoRoot = resolveRepoRoot(import.meta.url);
const workflow = readWorkflow('ci.yml').doc;

function step(jobName, name) {
Expand Down Expand Up @@ -49,10 +50,31 @@ test('keeps content contracts and the production build on the focused path', ()
workflow.jobs.validate.env.CONTENT_ONLY,
/document_only == 'true'/u,
);
const contracts = step('validate', 'Check content contracts');
assert.equal(
step('validate', 'Check content contracts').if,
contracts.if,
"${{ !cancelled() && env.CONTENT_ONLY == 'true' }}",
);
// The focused path must run every suite that reads an authored document,
// or a broken README link or unlisted ADR merges unnoticed.
const suites = contracts.run
.replaceAll('\\\n', ' ')
.trim()
.split(/\s+/u)
.slice(2);
for (const required of [
'tests/docs-contract.test.mjs',
'tests/markdown-references.test.mjs',
'tests/adr-contract.test.mjs',
'tests/blog-frontmatter.test.mjs',
'tests/root-docs-links.test.mjs',
'tests/static-assets.test.mjs',
]) {
assert.ok(suites.includes(required), `focused path omits ${required}`);
}
for (const suite of suites) {
assert.ok(existsSync(join(repoRoot, suite)), `${suite} does not exist`);
}
assert.equal(
step('validate', 'Build production site').run,
'npm run build:production',
Expand Down
Loading