IF Commons GitHub

ci/inventory

Written to: 1 requirement: 1 proved, 0 partly, 0 failing, 0 with no test recorded. 0002-libraries-ci-findings FR-005

The inventory of the build policy (commons 0038-build-policy FR-003): every step of every workflow of the model is classified as a red cause, a step whose output is read into findings, a gate or plumbing, by an ordered list of rules written as data with the reason of each; classify gives each step its policy, inventory gives the table of them (the table the documentation shows) with the counts, and policyFindings is the validation of the model against the policy: a step with no policy, a step of findings that is not wrapped or has no time limit below its job's, a matrix that fails fast, a job after a matrix that does not run with always(), plumbing in a cell that can fail it.

A step is placed by its workflow's file, its job's id and its position, and named by its name or its action or the first line of its script. The rules look at the job's id, the step's kind and its words; the first that matches decides. A step that no rule matches has no policy and is a finding of the model, so that a new step must be classified before the generator writes the workflow.

import { inventory } from "./inventory.ts";
inventory([]).counts; // { "red-cause": 0, finding: 0, gate: 0, plumbing: 0 }

Source: commons/libraries/src/ci/inventory.ts

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

Placetypeno test imports it
type Place = { readonly file: string; readonly jobId: string; readonly job: Job; readonly index: number; readonly step: Step };

Where a step is.

stepNameconstno test imports it
const stepName: (s: Step) => string

The name a step is known by in the table: its name, else its action, else the first line of its script.

Ruletypeno test imports it
type Rule = { readonly why: string; readonly match: (p: Place) => boolean; readonly policy: (p: Place) => StepPolicy };

A rule of the inventory: why, which steps, and what they are.

RULESconstno test imports it
const RULES: readonly Rule[]

The rules, in order: the first that matches a step is its policy.

policyOffunctionno test imports it
function policyOf(p: Place): { readonly policy: StepPolicy; readonly why: string; } | undefined

The policy of a step by the first rule that matches it.

classifyfunction
function classify(w: Workflow): Workflow

The workflow with a policy on every step that has none.

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

inventoryfunction
function inventory(ws: readonly Workflow[]): { readonly rows: readonly Row[]; readonly counts: Readonly<Record<"finding" | "gate" | "plumbing" | "red-cause", number>>; }

The table of every step of the workflows, with the counts of each policy.

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

isWrappedconstno test imports it
const isWrapped: (s: Step) => boolean

Whether a step of findings is run through the wrapper.

policyFindingsfunction
function policyFindings(w: Workflow): readonly string[]

What is wrong with a workflow under the policy, one sentence each (0038-build-policy FR-003, FR-004, FR-005).

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

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