{ "$id": "https://raw.githubusercontent.com/DocSpring/cigen/main/schemas/v1/cigen.schema.json", "$schema": "https://json-schema.org/draft/2020-12/schema", "title": "cigen config", "description": "A cigen config.", "type": "object", "properties": { "$schema": { "description": "The JSON schema this file follows, for editors. cigen ignores it.", "type": [ "string", "null" ], "default": null }, "cigen_install": { "description": "How generated workflows get cigen onto the runner: `release` (the default) or\n`{ job: }`", "$ref": "#/$defs/CigenInstall" }, "circleci": { "description": "Top-level keys passed untouched to CircleCI", "type": [ "object", "null" ], "additionalProperties": true, "default": null }, "commands": { "description": "Reusable commands, by name", "type": "object", "additionalProperties": { "$ref": "#/$defs/CommandDefinition" }, "default": {} }, "github": { "description": "Top-level keys passed untouched to GitHub Actions", "type": [ "object", "null" ], "additionalProperties": true, "default": null }, "input_groups": { "description": "Named groups of inputs. Jobs and other groups reference them as `@name`.", "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } }, "default": {} }, "provider": { "description": "The CI provider(s) to generate for. Required in `cigen.yml` or `.cigen/config.yml`.", "anyOf": [ { "$ref": "#/$defs/ProviderNames" }, { "type": "null" } ], "default": null }, "services": { "description": "Service containers jobs can name, passed to the provider as written", "type": "object", "additionalProperties": true, "default": {} }, "workflows": { "description": "Workflows, by name", "type": "object", "additionalProperties": { "$ref": "#/$defs/WorkflowDocument" }, "default": {} } }, "additionalProperties": false, "$defs": { "Artifact": { "description": "Artifact definition", "type": "object", "properties": { "path": { "description": "Glob pattern for artifact paths", "type": "string" }, "retention": { "description": "Retention period (e.g., \"7d\", \"30d\")", "type": [ "string", "null" ], "default": null } }, "required": [ "path" ] }, "CigenInstall": { "description": "How generated workflows get cigen onto the runner for the jobs that need it.", "anyOf": [ { "description": "`release` (the default): download the cigen release that generated the workflow, check\nits checksum and put it on `PATH`.", "$ref": "#/$defs/InstallMode" }, { "description": "`{ job: }`: take cigen from a job in the same workflow that builds it and uploads it\nas the `cigen-bin` artifact (cigen's own repository tests itself this way).", "$ref": "#/$defs/InstallJob" } ] }, "CommandDefinition": { "description": "Definition of a reusable command (CircleCI style)", "type": "object", "properties": { "description": { "description": "Optional description for the command", "type": [ "string", "null" ], "default": null }, "parameters": { "description": "Parameters accepted by the command", "type": "object", "additionalProperties": { "$ref": "#/$defs/CommandParameter" }, "default": {} }, "steps": { "description": "Steps executed by the command", "type": "array", "default": [], "items": { "$ref": "#/$defs/Step" } } }, "additionalProperties": true }, "CommandParameter": { "description": "Parameter definition inside a command", "type": "object", "properties": { "default": { "description": "Default value for the parameter", "default": null }, "description": { "description": "Description shown in CircleCI UI", "type": [ "string", "null" ], "default": null }, "type": { "description": "Declared parameter type (string, boolean, integer)", "type": [ "string", "null" ], "default": null } }, "additionalProperties": true }, "InstallJob": { "type": "object", "properties": { "job": { "description": "The job that builds cigen", "type": "string" } }, "additionalProperties": false, "required": [ "job" ] }, "InstallMode": { "type": "string", "enum": [ "release" ] }, "Job": { "description": "A job, as written in a config. Unknown keys are errors; settings only one provider\nunderstands go in its `github:` or `circleci:` block.", "type": "object", "properties": { "artifacts": { "description": "Artifacts to store", "type": "array", "default": [], "items": { "$ref": "#/$defs/Artifact" } }, "checkout": { "description": "Checkout configuration overrides (applied to the auto checkout step)", "type": [ "object", "null" ], "additionalProperties": true, "default": null }, "circleci": { "description": "Keys passed untouched to the CircleCI job", "type": [ "object", "null" ], "additionalProperties": true }, "env": { "description": "Environment variables", "type": "object", "additionalProperties": { "type": "string" }, "default": {} }, "github": { "description": "Keys passed untouched to the GitHub Actions job", "type": [ "object", "null" ], "additionalProperties": true }, "image": { "description": "Docker image or runner label (e.g. \"rust:latest\", \"ubuntu-latest\")", "type": "string", "default": "ubuntu-latest" }, "inputs": { "description": "What the job's result depends on: globs, or `@group` references to `input_groups`", "$ref": "#/$defs/OneOrMany" }, "matrix": { "description": "Matrix build configuration", "anyOf": [ { "$ref": "#/$defs/JobMatrix" }, { "type": "null" } ], "default": null }, "modules": { "description": "Modules the job uses, in order: `- rust` or `- rust: { components: [clippy] }`", "type": "array", "items": { "$ref": "#/$defs/ModuleUse" } }, "needs": { "description": "Jobs that must finish first", "$ref": "#/$defs/OneOrMany", "default": [] }, "services": { "description": "Service containers, by name from the top-level `services`", "type": "array", "default": [], "items": { "type": "string" } }, "steps": { "description": "Job steps", "type": "array", "default": [], "items": { "$ref": "#/$defs/Step" } } }, "additionalProperties": false }, "JobMatrix": { "description": "Matrix configuration", "anyOf": [ { "description": "Standard Cartesian dimensions: { key: [v1, v2] }", "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } }, { "description": "Explicit rows: [ { key: v1 }, { key: v2 } ]", "type": "array", "items": { "type": "object", "additionalProperties": { "type": "string" } } } ] }, "ModuleUse": { "description": "A module: its name, or a one-key map from its name to its parameters", "oneOf": [ { "type": "string", "enum": [ "rust" ] }, { "type": "object", "properties": { "rust": { "description": "Installs the Rust toolchain, its components and targets, and caches cargo's downloads and `target/`.", "type": [ "object", "null" ], "properties": { "cache": { "description": "cache the cargo registry, git dependencies and `target/` (default: `true`)" }, "components": { "description": "components to add, such as `[clippy, rustfmt]` (default: `[]`)" }, "path": { "description": "the workspace root, where `Cargo.toml` and `Cargo.lock` are (default: `.`)" }, "targets": { "description": "targets to add, such as `[x86_64-unknown-linux-musl]` (default: `[]`)" }, "toolchain": { "description": "a channel or version; setting it when a toolchain file exists is an error (default: what `rust-toolchain.toml` or `rust-toolchain` names, else `stable`)" } }, "additionalProperties": false } }, "additionalProperties": false, "maxProperties": 1, "minProperties": 1 } ] }, "OneOrMany": { "description": "A string or a list of strings.", "anyOf": [ { "type": "string" }, { "type": "array", "items": { "type": "string" } } ] }, "ProviderName": { "type": "string", "enum": [ "github", "circleci" ] }, "ProviderNames": { "description": "One provider or a list of them.", "anyOf": [ { "$ref": "#/$defs/ProviderName" }, { "type": "array", "items": { "$ref": "#/$defs/ProviderName" } } ] }, "RestoreCacheDefinition": { "description": "restore_cache step options", "type": "object", "properties": { "key": { "type": [ "string", "null" ], "default": null }, "keys": { "type": "array", "default": [], "items": { "type": "string" } }, "name": { "type": [ "string", "null" ], "default": null }, "restore_keys": { "type": "array", "default": [], "items": { "type": "string" } } }, "additionalProperties": true }, "RunCommand": { "description": "The value of `run:`", "anyOf": [ { "type": "string" }, { "$ref": "#/$defs/RunStepOptions" } ] }, "RunStep": { "description": "A run step: `- name: Test` / `run: cargo test`, or `- run: { name: Test, command: cargo test }`", "type": "object", "properties": { "env": { "description": "Environment variables for this step", "type": "object", "additionalProperties": { "type": "string" } }, "if": { "description": "Conditional execution", "type": [ "string", "null" ] }, "name": { "description": "Step name (optional)", "type": [ "string", "null" ] }, "run": { "description": "The command, or a mapping with the command and its options", "$ref": "#/$defs/RunCommand" } }, "additionalProperties": true, "required": [ "run" ] }, "RunStepOptions": { "description": "Run step options (for `run: { name, command }`)", "type": "object", "properties": { "command": { "description": "Command to run", "type": "string" }, "env": { "description": "Environment variables for this step", "type": "object", "additionalProperties": { "type": "string" } }, "if": { "description": "Conditional execution", "type": [ "string", "null" ] }, "name": { "description": "Step name (optional)", "type": [ "string", "null" ] } }, "additionalProperties": true, "required": [ "command" ] }, "SaveCacheDefinition": { "description": "save_cache step options", "type": "object", "properties": { "key": { "type": [ "string", "null" ], "default": null }, "name": { "type": [ "string", "null" ], "default": null }, "paths": { "type": "array", "default": [], "items": { "type": "string" } } }, "additionalProperties": true }, "StageDefinition": { "type": "object", "properties": { "name": { "type": "string" }, "needs": { "type": "array", "default": [], "items": { "type": "string" } } }, "required": [ "name" ] }, "Step": { "description": "Job step. Every key a step is given is kept: keys cigen doesn't model go in `extra` and are\npassed to the provider untouched, never dropped.", "anyOf": [ { "description": "A provider's own reference, such as a GitHub action", "$ref": "#/$defs/UsesStep" }, { "description": "Runs a command: `run: ` or `run: { name, command }`, with optional keys beside it", "$ref": "#/$defs/RunStep" }, { "description": "CircleCI restore_cache step", "type": "object", "properties": { "restore_cache": { "$ref": "#/$defs/RestoreCacheDefinition" } }, "required": [ "restore_cache" ] }, { "description": "CircleCI save_cache step", "type": "object", "properties": { "save_cache": { "$ref": "#/$defs/SaveCacheDefinition" } }, "required": [ "save_cache" ] }, { "description": "Any other step type (a command, or a provider-specific step) - preserved as raw YAML value" } ] }, "UsesStep": { "description": "A provider's own reference, such as a GitHub action (`uses: actions/checkout@v7`), passed\nthrough. Modules are listed under a job's `modules:`, never here.", "type": "object", "properties": { "if": { "description": "Conditional execution", "type": [ "string", "null" ], "default": null }, "name": { "description": "Step name", "type": [ "string", "null" ] }, "uses": { "description": "The reference, with its version (`actions/setup-node@v7`)", "type": "string" }, "with": { "description": "Inputs", "type": "object", "additionalProperties": true, "default": {} } }, "additionalProperties": true, "required": [ "uses" ] }, "WorkflowCondition": { "type": "object", "properties": { "env": { "type": [ "string", "null" ], "default": null }, "equals": { "default": null }, "expression": { "type": [ "string", "null" ], "default": null }, "parameter": { "type": [ "string", "null" ], "default": null }, "provider": { "type": [ "string", "null" ], "default": null }, "variable": { "type": [ "string", "null" ], "default": null } }, "additionalProperties": false }, "WorkflowDocument": { "title": "cigen workflow", "description": "A workflow: its settings and its jobs. The loader takes `jobs` out and reads the rest as\n`WorkflowConfig`, so this type only describes the shape for the schema.", "type": "object", "properties": { "circleci": { "description": "Keys passed untouched to the CircleCI workflow", "type": [ "object", "null" ], "additionalProperties": true }, "default_stage_prefix": { "type": "boolean", "default": false }, "github": { "description": "Keys passed untouched to the GitHub Actions workflow (`on`, `permissions`, ...)", "type": [ "object", "null" ], "additionalProperties": true }, "jobs": { "description": "The workflow's jobs, by id. Ids are unique across workflows.", "type": "object", "additionalProperties": { "$ref": "#/$defs/Job" }, "default": {} }, "run_when": { "description": "Conditions that decide whether the workflow runs", "type": "array", "default": [], "items": { "$ref": "#/$defs/WorkflowCondition" } }, "stage_prefix": { "type": "boolean", "default": false }, "stage_prefix_separator": { "type": "string", "default": "_" }, "stages": { "type": "array", "default": [], "items": { "$ref": "#/$defs/StageDefinition" } } }, "additionalProperties": false } } }