{ "$id": "https://raw.githubusercontent.com/DocSpring/cigen/main/schemas/v1/job.schema.json", "$schema": "https://json-schema.org/draft/2020-12/schema", "title": "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, "$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" ] }, "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" } } ] }, "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 }, "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" ] } } }