CI Validation
CI Validation

Run IOModel validation in pre-commit hooks and CI pipelines.

For Git-projects, validation belongs in the same gates as code: a pre-commit hook to catch issues early, and CI to block invalid model or spec changes from merging.

Pre-commit

Validate changed model and spec files before they are committed.

# lefthook.yml
pre-commit:
  commands:
    iomodel-validate:
      glob: "{models,specs}/**/*.{yaml,mdx}"
      run: iomodel validate --json --quiet

GitHub Actions

# .github/workflows/iomodel-ci.yml
name: IOModel CI
on: [pull_request, push]
jobs:
  validate:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
      - run: npx @iomodel/cli validate --json > validation.json
      - uses: actions/upload-artifact@v4
        if: always()
        with:
          name: validation
          path: validation.json

Exit codes drive the gate

Exit codeCI result
0Pass (warnings allowed)
1Fail — validation errors
2Fail — fatal error (broken YAML, no project)

Format checks too

Add iomodel format --check to CI to enforce consistent YAML. It exits non-zero when files need formatting.

Add a pre-commit hook

Catch errors locally before they reach review.

Add a CI job

Validate on every pull request and push.

Publish results

Upload the JSON report (or post it as a PR comment) for visibility.

Keep CI fast by validating the whole project on PRs and relying on the editor and pre-commit for incremental feedback during authoring.

Last updated on