Skip to content

Commit

Permalink
github-workflow: improve matrix checks
Browse files Browse the repository at this point in the history
Adds initial support for checking values used inside matrix:
- recognize os and check its documented values
- support for include/exclude which are arrays of same matrix elements
- recognize experimental flags
- allow extra properties
  • Loading branch information
ssbarnea committed Oct 13, 2021
1 parent 31d43a1 commit e91df0b
Showing 1 changed file with 52 additions and 3 deletions.
55 changes: 52 additions & 3 deletions src/schemas/json/github-workflow.json
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,57 @@
"$ref": "#/definitions/globs",
"description": "When using the push and pull_request events, you can configure a workflow to run when at least one file does not match paths-ignore or at least one modified file matches the configured paths. Path filters are not evaluated for pushes to tags.\nThe paths-ignore and paths keywords accept glob patterns that use the * and ** wildcard characters to match more than one path name. For more information, see https://help.github.com/en/github/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet.\nYou can exclude paths using two types of filters. You cannot use both of these filters for the same event in a workflow.\n- paths-ignore - Use the paths-ignore filter when you only need to exclude path names.\n- paths - Use the paths filter when you need to filter paths for positive matches and exclude paths."
},
"matrix.os": {
"$ref": "#/definitions/matrix.os",
"type": "string",
"enum": [
"macos-10.15",
"macos-11",
"macos-latest",
"ubuntu-18.04",
"ubuntu-20.04",
"ubuntu-latest",
"windows-2016",
"windows-2019",
"windows-2022",
"windows-latest"
]
},
"matrix": {
"$comment": "https://help.github.com/en/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#jobsjob_idstrategymatrix",
"description": "A build matrix is a set of different configurations of the virtual environment. For example you might run a job against more than one supported version of a language, operating system, or tool. Each configuration is a copy of the job that runs and reports a status.\nYou can specify a matrix by supplying an array for the configuration options. For example, if the GitHub virtual environment supports Node.js versions 6, 8, and 10 you could specify an array of those versions in the matrix.\nWhen you define a matrix of operating systems, you must set the required runs-on keyword to the operating system of the current job, rather than hard-coding the operating system name. To access the operating system name, you can use the matrix.os context parameter to set runs-on. For more information, see https://help.github.com/en/articles/contexts-and-expression-syntax-for-github-actions.",
"$ref": "#/definitions/matrix",
"properties": {
"experimental": {
"description": "Prevent workflow failure when job fails.",
"type": "boolean",
"default": false
},
"os": {
"$comment": "https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners",
"description": "Operating system to use",
"oneOf": [
{ "type": "array",
"items": {"$ref": "#/definitions/matrix.os"}},
{ "$ref": "#/definitions/matrix.os" }
]
},
"include": {
"description": "Include additional entries into the matrix.",
"type": "array",
"items": {
"$ref": "#/definitions/matrix"
}
},
"exclude": {
"description": "Remove listed entries from the matrix.",
"type": "array",
"items": {
"$ref": "#/definitions/matrix"
}
}
}
},
"ref": {
"properties": {
"branches": {
Expand Down Expand Up @@ -724,11 +775,9 @@
"type": "object",
"properties": {
"matrix": {
"$comment": "https://help.github.com/en/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#jobsjob_idstrategymatrix",
"description": "A build matrix is a set of different configurations of the virtual environment. For example you might run a job against more than one supported version of a language, operating system, or tool. Each configuration is a copy of the job that runs and reports a status.\nYou can specify a matrix by supplying an array for the configuration options. For example, if the GitHub virtual environment supports Node.js versions 6, 8, and 10 you could specify an array of those versions in the matrix.\nWhen you define a matrix of operating systems, you must set the required runs-on keyword to the operating system of the current job, rather than hard-coding the operating system name. To access the operating system name, you can use the matrix.os context parameter to set runs-on. For more information, see https://help.github.com/en/articles/contexts-and-expression-syntax-for-github-actions.",
"oneOf": [
{
"type": "object"
"$ref": "#/definitions/matrix"
},
{
"$ref": "#/definitions/expressionSyntax"
Expand Down

0 comments on commit e91df0b

Please sign in to comment.