{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://catalog.lintel.tools/schemas/schemastore/fasterci-configuration/latest.json",
  "x-lintel": {
    "source": "https://fasterci.com/config.schema.json",
    "sourceSha256": "ce9fa1febc53a5aa7ff5284e0d78127b3edbdf381279f0d5b1a553c123055a63",
    "fileMatch": [
      "**/.fasterci/config.yaml"
    ],
    "parsers": [
      "yaml"
    ]
  },
  "$defs": {
    "BazelStep": {
      "properties": {
        "build_targets": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "description": "List of bazel targets to build"
        },
        "test_targets": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "description": "List of bazel targets to test"
        },
        "build_flags": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "description": "Build flags to use in addition to defined in /etc/bazel.bazelrc"
        },
        "test_flags": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "description": "Test flags to use in addition to defined in /etc/bazel.bazelrc"
        }
      },
      "type": "object",
      "additionalProperties": false
    },
    "BranchesAndPaths": {
      "required": [
        "branches"
      ],
      "properties": {
        "branches": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "description": "List of branch name masks (doubleglob) to match"
        },
        "paths": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "description": "List of path masks (doubleglob) to match. If not specified, all paths are matched"
        },
        "branches-ignore": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "description": "List of branch name masks (doubleglob) to ignore"
        },
        "paths-ignore": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "description": "List of path masks (doubleglob) to match. If not specified, all paths are ignored"
        },
        "from-branches": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "description": "List of source branches masks (doubleglob) to match. If not specified will match any source branch name"
        },
        "from-branches-ignore": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "description": "List of source branches masks (doubleglob) to ignore. If not specified, no source branch names are ignored"
        }
      },
      "type": "object",
      "additionalProperties": false
    },
    "BranchesOrTags": {
      "anyOf": [
        {
          "required": [
            "branches"
          ]
        },
        {
          "required": [
            "tags"
          ]
        }
      ],
      "properties": {
        "branches": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "description": "List of branch name masks (doubleglob) to match"
        },
        "tags": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "description": "List of tag masks (doubleglob) to match"
        },
        "branches-ignore": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "description": "List of branch name masks (doubleglob) to ignore"
        },
        "tags-ignore": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "description": "List of tag masks (doubleglob) to ignore"
        }
      },
      "type": "object",
      "additionalProperties": false
    },
    "Config": {
      "required": [
        "workflows"
      ],
      "properties": {
        "workflows": {
          "items": {
            "$schema": "http://json-schema.org/draft-04/schema",
            "$ref": "#/$defs/Workflow"
          },
          "type": "array",
          "description": "The list of FasterCI workflows"
        }
      },
      "type": "object",
      "additionalProperties": false
    },
    "On": {
      "anyOf": [
        {
          "required": [
            "push"
          ]
        },
        {
          "required": [
            "pull_request"
          ]
        }
      ],
      "properties": {
        "push": {
          "$schema": "http://json-schema.org/draft-04/schema",
          "$ref": "#/$defs/BranchesOrTags",
          "description": "Run the workflow on code push"
        },
        "pull_request": {
          "$ref": "#/$defs/BranchesAndPaths",
          "description": "Run the workflow on pull request"
        }
      },
      "type": "object",
      "additionalProperties": false
    },
    "Step": {
      "anyOf": [
        {
          "required": [
            "github_check_md_file"
          ]
        },
        {
          "required": [
            "run"
          ]
        },
        {
          "required": [
            "bazel"
          ]
        }
      ],
      "type": "object",
      "properties": {
        "name": {
          "type": "string",
          "description": "Step name, optional"
        },
        "working-directory": {
          "type": "string",
          "description": "Directory to run the step instead of default repo directory"
        },
        "github_check": {
          "type": "boolean",
          "description": "Report the result of the step as a separate github check"
        },
        "github_check_md_file": {
          "type": "string",
          "description": "After completing the step, report as a separate Github Check, using the content of the file as a report body, optional"
        },
        "run": {
          "type": "string",
          "description": "Arbitrary command execution; Could be multiline"
        },
        "bazel": {
          "$schema": "http://json-schema.org/draft-04/schema",
          "$ref": "#/$defs/BazelStep",
          "description": "Bazel step"
        },
        "side_effects": {
          "type": "boolean",
          "description": "Side effects step is anything that may change the state not related to building from the source tree or tests execution. Think of publishing artifacts, sending notifications etc."
        }
      },
      "dependentRequired": {
        "github_check": [
          "name"
        ],
        "github_check_md_file": [
          "name"
        ]
      },
      "additionalProperties": false
    },
    "Workflow": {
      "required": [
        "name",
        "on"
      ],
      "properties": {
        "name": {
          "type": "string",
          "description": "Workflow name"
        },
        "on": {
          "$schema": "http://json-schema.org/draft-04/schema",
          "$ref": "#/$defs/On",
          "description": "Event to activate the workflow on"
        },
        "image": {
          "type": "string",
          "description": "Docker image to run the workflow"
        },
        "cleanup": {
          "type": "string",
          "description": "optional cleanup command, executed after the workflow"
        },
        "max_parallel": {
          "type": "integer",
          "description": "optional maximum number of parallel runs of this workflow"
        },
        "ephemeral": {
          "type": "boolean",
          "description": "optionally mark this workflow as ephemeral. Will not keep the workflow state between runs"
        },
        "env": {
          "description": "Environment variables",
          "type": "object",
          "patternProperties": {
            ".*": {
              "type": "string"
            }
          }
        },
        "secrets": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "description": "List of secrets to mount as environment variables"
        },
        "hide_from_github": {
          "type": "boolean",
          "description": "Do not notify github"
        },
        "init": {
          "type": "string",
          "description": "Optional command to run before the workflow. Use multiline for multiple commands"
        },
        "steps": {
          "items": {
            "$schema": "http://json-schema.org/draft-04/schema",
            "$ref": "#/$defs/Step"
          },
          "type": "array",
          "description": "List of workflow steps to execute"
        }
      },
      "type": "object",
      "additionalProperties": false
    }
  },
  "$ref": "#/$defs/Config"
}
