Skip to content

v0.18.0

Choose a tag to compare

@github-actions github-actions released this 24 Nov 03:05
· 35 commits to main since this release
Immutable release. Only release title and notes can be modified.
f796a21

Added

  • A reusable workflow, .github/workflows/site.yml, builds a library's documentation site from the library's content folder and publishes it to that library's GitHub Pages from its default branch. A library calls it at one pinned commit and holds no npm manifest or lockfile. Its inputs are content-path, deploy and toolchain-ref, and its output is page-url. A pull request builds the site and keeps it as an artifact for a week (ADR-1001).
  • After the build, the workflow loads every page of the library's site in the runner's Google Chrome at 1440, 1280, 1024 and 390 px, and fails when an element of a page's content leaves its content column or a scroll container in it hides part of its content sideways, naming the page's source file, the width and the element. A code block, and an element a library marks with data-scrolls, scroll sideways by design. A Markdown table too wide for the column fails too: the message names it by its first column names and says to lay it out as a card per entry or give it fewer columns. An inline component a library marks with data-inline, such as an evidence mark, fails when it stands apart from the sentence it belongs to, on a line of its own or right after a block. npm run site '--' check <library folder> runs the same check on a site built beside the toolchain (#41, #47, #59, ADR-1013, ADR-1015, ADR-1018).
  • Sites are built with Astro Starlight and NCode's design system, Instrument, from NCode Brand 0.13.0: its tokens, its fonts, Instrument Sans in roman and italic and Martian Mono, its mapping of Starlight's properties, its code-block syntax theme and its marks, vendored from the release, the toolchain's rules for Starlight's markup, which set inline code in the brand's mono face on its code tint with no edge, the shared components Status, Readout, Braces and Pitfalls, which lays out a guide's pitfalls as a list of titled entries with italic labels, a search, and a 404 page. A library's own component styles itself with the brand's public tokens, prefixed --nc-. The toolchain's rules set each text in the brand's type role that names its use, running text in the reading role on the brand's measure, and read none of the brand's private primitives. The 404 page is the library's own 404.mdx or 404.md, or else the toolchain's, with the header's search box and a link to the site's start, and the build prints no warning about it (ADR-1000, ADR-1006, #6, #2, #27, #35, #48, ADR-1008, #60, ADR-1019, #63).
  • A page with a hero keeps the hero one column while the sidebar leaves the content column narrower than 50rem, so a landing page that keeps the navigation, with the default template and tableOfContents: false, has room for its image, and a hero with no image is one column at every width, so its title has the width of the page. On such a landing page the hero and a CardGrid take the width of the page, and every other part keeps to the content column; splash gives a page with no navigation and a wide layout (#42, ADR-1020).
  • In a window wider than the sidebar, the page and the "On this page" panel together, about 1450 px, the three stay together in the middle of the window with the same margin on both sides, and the site bar keeps to their width, its search field starting where the page does. The page is as wide as a listing of the brand's full width with its padding, and the panel beside it is 15rem. The sidebar and the panel are set at the brand's dense interface size, with entries a small control high; a table, a callout and a card's text are at the interface size; and a link button is a control of the interface, as high as a phone's in a window narrower than 40rem. npm run test measures the content column at 1440, 1280, 1024 and 390 px and fails when the table in CONTRACT.md differs (ADR-1020).
  • vendor/brand/ holds the files vendor/brand/brand.lock.json names from one release of NCodeGroup/brand, each pinned by its SHA-256, the release's own vendoring script, vendor/brand/vendoring/vendor-brand.mjs, among them: npm run update:brand '--' <version> takes another release, script included, and npm run check:vendor, which the tests run, fails with no network when a vendored file differs from the lock. Every day, the brand-watch workflow keeps one open issue labeled brand-update and dependencies while NCodeGroup/brand has a release newer than the one the lock pins, with the release's links and the command that takes it, and closes it once the lock pins the newest release; npm run watch:brand '--' --dry-run shows what it would do. The tests also fail when the theme, the code blocks or a component reads a custom property that neither the brand's stylesheets nor the theme define, or a step of the brand's colour ramps or type scale (#2, #26, #27, #38, ADR-1008, ADR-1009).
  • A table written in Markdown wraps its cells, code in them included, to fit the content column, and must fit it: one that still cannot fit scrolls sideways inside the column, as a last resort, and fails the layout check. In a window narrower than 40rem (640 px), such as a phone's, it is a stack of rows, each cell under its column's name, which the build copies from the table's head; a code listing wider than its screen lights each edge it has more code past, and its keyboard focus ring is drawn in the screen's lit colour just inside its edge, so no page scrolls sideways (#3, #40, #47, ADR-1007, ADR-1014, ADR-1015).
  • A library configures its site in site.config.json: title, description, repository, URL, navigation, mark, version label, links and sample globs. The file is checked against schema/site.config.schema.json before anything is built, and a wrong one stops the build with a message that names the key. A sample glob names files under the repository root: each file it matches is checked by its real path, with every symbolic link on its path followed, and one that a pattern or a symbolic link puts outside the repository stops the build too, as does a symbolic link that leads nowhere or around in a loop.
  • A site can require headings on the pages a glob names, in order, with requiredHeadings in site.config.json, such as ## Checklist on every guide. A page without one, or with them out of order, stops the build, and so does a rule whose glob matches no page or whose exception is not a page it covers; a site without the key has no rule (#33, ADR-1011).
  • The build reads every .astro and .css file of a library's _components/ folder before it starts, and stops on a --nc- token the brand does not define or on a step of its colour ramps or type scale, naming the file and the token (ADR-1012).
  • A page includes a compiled sample by its key, cs snippet=Key, from a region of the library's tests marked // begin-snippet: Key and // end-snippet. An unknown key, a key defined twice, a region that is never closed, a malformed marker and a block with code of its own each stop the build (ADR-1002).
  • A page shows a file of the library's repository, whole or from the line that holds one text to the line that holds another, with an empty block such as ```xml file=Directory.Build.props from="<ItemGroup" to="</ItemGroup>": the build fills it, titles it with the path, and links it to those lines at the commit the site was built from. A path outside the repository or inside .git, a missing, binary or oversized file, a text on no line or on several, a selection of blank lines, a lines= range and a language the code blocks do not highlight each stop the build (#32, ADR-1010).
  • An author writes links from the site's root, and the build adds the base path, so one page works under /<repository>/ and at the root of a custom domain. A broken link, a relative link, a link written with the base path and a built page that links outside the base path each stop the build (ADR-1003).
  • C# 14 extension blocks are highlighted as declarations (ADR-1004).
  • Each page links to its source in the library's repository and shows the date of the last commit that changed it. Where the library is in a repository whose history git cannot read, the pages show no date and the build warns, with git's message, as an annotation in GitHub Actions.
  • scripts/site.mjs builds, serves or previews a library's site from a clone beside it: npm run dev '--' <library folder> follows edits to pages, sample files and the files pages include, and writes nothing to the library. Each command runs Astro in a folder of its own, so one checkout of the toolchain builds and serves several libraries, or several worktrees of one, at once, into any output folder; a second command that writes the same output folder stops with a message that names the first. A library copies the launcher fixture/build/site.mjs into its build/ folder, and node build/site.mjs <command> builds the checkout it is in, its main checkout or any worktree of it, with the toolchain it finds beside the main checkout. Every documented npm command that passes arguments to its script quotes the separator as '--', so it runs as written in PowerShell 7, where npm is its npm.ps1 shim, and in bash, and npm run test fails on a documented command that writes the separator bare (#38, #57, #58, ADR-1016, ADR-1017).
  • CONTRACT.md states what a library holds for its site and what the build does with it, when a landing page keeps the navigation, and how wide the content column is for a library's own components, how an inline component keeps to its sentence, and how a page reads calmly; README.md's one-time setup lists, in order and with who can do each, the GitHub Pages settings, the site's address at <name>.ncode.io in the DNSSEC-signed ncode.io zone, the redeploy and the checks that address needs, the repository's website and the package's project URL; and fixture/ is a complete small library that the tests build (#42, #43, #44, #52, #59, #60).
  • CONTRACT.md and README.md link NCode.Buffers' card components, at its release v5.3.2, as examples of data laid out as a card per entry, and its Pitfalls and Proof components as examples of a calm page (#46, #60).
  • docs/architecture.md describes the toolchain's components and the rules its design keeps, and docs/assurance-case.md states its security requirements, its threat model and trust boundary, the check each input gets, the secure design principles it applies and the weaknesses it counters (#13).
  • GOVERNANCE.md names the maintainer and owner, @polewskm, and says continuity stays incomplete until a second owner can administer the repository; ROADMAP.md states the plans for the next twelve months: keeping external inputs pinned and current, and reaching the OpenSSF Best Practices silver level (#14).
  • CI checks the toolchain's code with Biome before it builds: npm run lint fails on a formatting difference in the JavaScript and TypeScript files and on a lint error or warning in them and in the Astro components, and npm run format applies Biome's formatting and safe fixes (#10, ADR-0201, ADR-1005).
  • Each source file of the toolchain and the fixture starts with a Copyright © NCode Group line and an SPDX-License-Identifier: Apache-2.0 line: CI runs ./.template/Test-FileHeaders.ps1, which fails a JavaScript, TypeScript or Astro file or a stylesheet without them, and -Fix adds them; an Astro component holds them in its frontmatter, so they never reach a built page, and the copies under vendor/ keep their source's lines (#12, ADR-0027).

Security

  • The workflow's job that runs the site's packages and a library's pages has a read-only token. A second job, which checks out nothing and runs no code of the library or the toolchain, deploys, and only from the library's default branch (ADR-1001).
  • No job of the workflow restores or saves a cache, and every build is a full build.
  • Packages are pinned to exact versions, each at least three days old when it is taken, and installed from the lockfile without install scripts. npm refuses a younger version with an ETARGET error, also with --force, and the README's development section says what that error means (#5).
  • npm run update:brand writes a brand release's files only once gh attestation verify proves that NCodeGroup/brand's publish.yml built the release's archive for its tag on a GitHub-hosted runner, and the archive holds exactly the files its manifest lists, at their SHA-256 (#2, ADR-1008).
  • A built site loads its fonts, scripts and styles from its own origin.
  • CI fails when the tests cover less than 90% of the statements or 80% of the branches of the toolchain's code, which npm run test measures and ./.template/Test-Coverage.ps1 checks, so a release is tagged only once that check passes again on its commit (#11, ADR-0026).
  • A release is tagged only once CI passes again on its commit, and in this public repository its tag is signed with gitsign through Sigstore's keyless signing. Releases are immutable, and SECURITY.md says how to verify a release and its tag (#7, ADR-0026, ADR-0028).
  • NCode Review approves a pull request whose review leaves no blocker or should-fix finding open, and a push dismisses that approval (#7, ADR-0022).