How to use SKMTC in CI/CD
Run skmtc generate reliably in continuous integration, with appropriate verification gates.
When to use this
You want generation to run automatically — either on every PR (verify the committed output matches what would be regenerated) or on a schedule (regenerate when the schema changes).
Prerequisites
- A working SKMTC project locally.
- A CI runner that supports Deno installation (most do).
Steps
Pin the Deno version
Add the Deno version to your CI config so the runtime is deterministic. For GitHub Actions:
- uses: denoland/setup-deno@v1
with:
deno-version: v1.46.x # match your local versionInstall the CLI in CI
SKMTC_VERSION=<version> curl -fsSL https://skm.tc/install | shPin to a specific CLI version with SKMTC_VERSION. The CLI itself
doesn't appear in your project's deno.json (it's a global
install) — the pin keeps CI runs reproducible.
--unstable-worker-options is required: the worker uses Deno's
Worker.deno.permissions API, which is gated behind this flag on
current Deno releases. Omitting it produces a runtime error on the
first skmtc generate — discovered in CI long after install
"succeeded." The flag must be baked into the installed CLI binary at install time.
Bundle (if any generators are cloned)
If the project has cloned or locally-created generators, rebuild the bundle in CI:
skmtc bundle <project>If the project is JSR-only (no clones), this step is unnecessary — the published bundle is used.
Run with --no-input --json
skmtc generate <project> --no-input --json > generate-output.jsonThe --no-input flag enforces strict mode (no interactive
prompts). --json produces machine-parseable output for
downstream verification.
Pipe to jq for any post-checks you need:
fails=$(jq '.manifest.parseIssues | map(select(.level == "error")) | length' generate-output.json)
if [ "$fails" -gt 0 ]; then
echo "Generation produced $fails errors"
jq '.manifest.parseIssues' generate-output.json
exit 1
fiArchive the manifest
Upload the manifest.json as a CI artifact for retrospective
inspection:
- uses: actions/upload-artifact@v4
with:
name: skmtc-manifest
path: .skmtc/<project>/manifest.jsonUseful when debugging an unexpected generation outcome later.
Verification
Add a "drift check" step that confirms the committed generated files match what would be regenerated:
skmtc generate <project> --no-input
git diff --exit-code src/generated/If the diff is non-empty, the committed output is stale — fail the build and prompt the developer to regenerate.
Troubleshooting
- Schema URL unreachable in CI — The CI environment may have network restrictions. Either pin the schema to a local file committed in the repo, or use a CI secret for the URL with appropriate firewall config.
skmtc generatetimes out — Large schemas (thousands of operations) can take a while. Increase the CI timeout or partition into multiple smaller projects.- Lockfile changes in CI — If
skmtc installwas run on another branch, the lockfile may need updating. Commit lockfile changes deliberately, not as part of every generate run. - "Stale bundle" warning — Add
skmtc bundlebeforeskmtc generatein your CI flow.
Related
skmtc generatereferenceskmtc bundlereferenceskmtc doctorreference — useful as a CI pre-check