IF Commons GitHub

plan

The plan of CI (commons 0001-libraries FR-012): the libraries a push or a pull request affects, and for each the cells that the one workflow ci runs, so that a change proves what it touches and nothing else.

bun commons/libraries/src/plan.ts --base origin/main the plan for what changed since the merge base with origin/main, as JSON bun commons/libraries/src/plan.ts --all every library bun commons/libraries/src/plan.ts --files a.ts,b/c.ts the libraries these files affect bun commons/libraries/src/plan.ts --base REF --github-output "$GITHUB_OUTPUT" the same, written as the outputs of a step: has-linux, linux, has-systems, systems

The libraries are those of affected.ts (the same code the development loop and every check read), with the reach of verify: what a library's verify reads, and what depends on it. Each library has a cell on Linux; a library whose record of CI (LIBRARY_CI) names Windows or macOS has a cell on each of them too, because it has code of its own for them. A matrix with no cell is not written as a matrix (a workflow cannot run one): has-linux and has-systems say whether there is one.

import { planOf } from "./plan.ts";
planOf([{ name: "net", folder: "commons/net", verify: "bun run verify" }]).systems.include.map((c) => c.os); // ["windows-latest", "macos-latest"]

Spec: 0001-libraries FR-012

Source: commons/libraries/src/plan.ts

4 of 6 exports are imported by a test of the run. A test that imports an export may not call it or check what it returns.

Plannedtypeno test imports it
type Planned = { readonly name: string; readonly folder: string; readonly verify: string };

A library as the plan reads it.

Includetypeno test imports it
type Include = { readonly include: readonly Cell[] };

The cells of a job: what strategy.matrix reads as {"include": [...]}.

planOffunction
function planOf(libs: readonly Planned[], packs?: ReadonlySet<string>): Plan

The plan for these libraries: a cell on Linux for each, and one on each system its record names, in the order of the libraries; the packing is checked in the cells of the libraries named in packs.

Imported by 4 tests of the run (4 passed, 0 failed): the library's results

exportsLinefunction
function exportsLine(packageJson: string): string

The exports of a package.json as one line, the keys in order, so that two of them are the same where the entries are.

Imported by 4 tests of the run (4 passed, 0 failed): the library's results

packsForfunction
function packsFor(repo: string, base: string, libs: readonly Planned[], single?: boolean): Promise<ReadonlySet<string>>

The libraries whose packing a push checks (FR-013): those that changed their exports since the base (a new library included), and every library where the packer itself changed. Git that cannot say gives every library.

Imported by 4 tests of the run (4 passed, 0 failed): the library's results

outputsOffunction
function outputsOf(p: Plan): string

The outputs of a step that a workflow reads: the matrices as one line of JSON each and whether each has a cell.

Imported by 4 tests of the run (4 passed, 0 failed): the library's results

Titles, headings, exports, tables, columns and requirements. Esc closes.