Skip to content

Latest commit

 

History

History
129 lines (98 loc) · 5.5 KB

ci.md

File metadata and controls

129 lines (98 loc) · 5.5 KB

CI — the engine is the compiler, and a broken model cannot merge

GENERATED by the Axle Keys repository. Do not hand-edit.

Keep your models in git. On every push, build all of them with the same engine axlekeys.com runs, and fail the run if any model has an error. A collision that a reviewer would have to notice becomes a red check and an annotation on the line of the diff that caused it.

The one-liner

name: verify models
on: [push, pull_request]

jobs:
  verify:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: AxleKeys/cad-engine@main
        with:
          models: "models/**/*.js"

That is the whole integration. The Action sets up Node 24 and runs

npx -y @axle-keys/cad-engine@0.2.1 verify "models/**/*.js" --github

— nothing else. All of the logic is in the CLI, which is deliberate: a verdict decided in YAML would be a second implementation of the checks, and your CI is the worst place to find out the two disagree.

Inputs

Input Required Default What it is
models yes — Files or globs, whitespace-separated. Quote them — the engine expands the globs itself, so the pattern means the same thing on every runner and on your laptop.
version no 0.2.1 The @axle-keys/cad-engine release to run. Pin it, and the Action and the engine move together.

You can skip the Action entirely and run the CLI, which is the same thing with the setup written out:

      - uses: actions/setup-node@v4
        with: { node-version: "24" }
      - run: npx -y @axle-keys/cad-engine@0.2.1 verify "models/**/*.js" --github

What the exit codes mean

verify builds every matched model in one process on one warm kernel and exits with the worst code any of them produced.

Code Meaning What to do
0 every model built and passed — no finding of severity error merge; read any warnings
1 at least one model built with an error finding read the annotation: it names the rule and, for an interference, the shared volume in mm³
2 at least one model threw while building the model's own error is in the annotation — this is a code fault, not a geometry one
3 the run could not be made a file could not be read, a --param names something a model does not declare, or a pattern matched no files at all

⚠ That last case is deliberate. A glob that matches nothing would otherwise produce a green job that verified zero models — which reads exactly like "every model is clean". Rename a directory and your CI would keep passing forever. So it is a failure, and the message names the pattern and the directory it looked from.

Every finding carries a severity, and only an error fails a model. A warning — a part with nothing beneath it, say — is annotated as a warning and does not fail the run; an info is a notice. A finding marked unverified is the build saying "I could not tell": it is annotated as a warning and does not fail the run either, whatever its severity. "I could not measure that pair in the time I allowed myself" is not "there is a defect".

With --json (instead of --github), verify prints one record per model and then a { summary }: clean and withProblems count the models that exited 0 and 1; errors, warnings, info and unverified count findings by kind; and problems is the same number as errors, kept under its older name for scripts that already read it.

A parameter matrix

A model is parametric, so "does it build" is really "does it build across the range people will actually set". Run the CLI directly and let the matrix supply the values:

jobs:
  clearances:
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        clearance: [0, 0.5, 1, 2]
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with: { node-version: "24" }
      - run: npx -y @axle-keys/cad-engine@0.2.1 verify "models/drawer-*.js" --param clearance=${{ matrix.clearance }} --github

--param is applied to every matched model, and a model that does not declare that parameter is a 3 for that file — it says so, and lists what the model does declare. So point a matrix at the models that share the parameter, not at the whole repository.

If you would rather search a range than enumerate it, axle sweep does that in one run and ranks the results by a measured field — see the README.

What this repository does with it

AxleKeys/cad-engine runs the Action on itself, through the published package, on every push:

  • the shipped examples are clean — 5 model(s) that must verify 0.
  • the loud fixture is still loud — 1 model(s) that must verify non-zero. The step is continue-on-error, and the job then asserts its outcome really was failure.

That second job is the one worth copying. continue-on-error on its own makes a job green whether the thing failed, passed, or never ran; asserting the outcome turns it into a positive control, so the Actions tab shows both that the clean models pass and that the checks can still catch a bad one. A green board that proves nothing is worse than no board.

Before you wire it up

Run it locally first — it is the same command and the same verdict:

npx -y @axle-keys/cad-engine@0.2.1 verify "models/**/*.js"

CI should tell you what you already know from your own machine. If the two ever disagree, that is a bug we want to hear about.