CI integration¶
Run OntoIndex validation in continuous integration to catch ontology lint and parse errors before merge.
Exit codes¶
ontoindex validate follows the rules in workspace-limits.md:
| Outcome | Exit code |
|---|---|
| No diagnostic errors (warnings/info allowed) | 0 |
| One or more diagnostic errors | non-zero |
Warnings and info are printed to stderr but do not fail the job.
GitHub Actions (cargo install)¶
name: Ontology validation
on:
push:
branches: [main]
pull_request:
jobs:
validate-ontologies:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Install ontoindex CLI
run: cargo install ontoindex-cli --locked
- name: Validate ontology files
run: ontoindex validate .
Adjust the path (. or ontologies/) to the directory containing your .ttl, .owl, etc.
Classify in CI¶
Fail the job when EL classification finds unsatisfiable classes:
- name: Install ontoindex CLI
run: cargo install ontoindex-cli --locked
- name: Classify ontologies (EL)
run: ontoindex classify . --profile el --format json
classify exits non-zero when consistent is false. See workspace-limits.md and Reasoner guide.
GitHub Actions (release binary)¶
For faster CI without compiling Rust dependencies:
- name: Download and validate ontology files
run: |
VERSION=0.8.0
ASSET="ontoindex-v${VERSION}-x86_64-unknown-linux-gnu.tar.gz"
BIN="ontoindex-v${VERSION}-x86_64-unknown-linux-gnu"
curl -fsSL -o "${ASSET}" \
"https://github.com/eddiethedean/ontocode/releases/download/v${VERSION}/${ASSET}"
tar xzf "${ASSET}"
chmod +x "${BIN}"
./"${BIN}" validate .
Verify checksums per release-integrity.md in production pipelines.
Query diagnostics in CI¶
ontoindex query . "SELECT code, severity, message, file FROM diagnostics WHERE severity = 'error'"
Use --format json for machine-readable output.
Patch automation¶
Apply Turtle patches in CI (preview first):
ontoindex patch ./ontology.ttl patches.json --preview
ontoindex patch ./ontology.ttl patches.json
ontoindex validate .
Patch format: patch-reference.md.
Tips¶
- Index only the ontology subtree if the repo is large:
ontoindex validate ./src/ontologies - Resource limits apply — see workspace-limits.md
- For VS Code-only workflows, the same rules apply via
ontoindex validatein CI; the extension is not required in the pipeline