-
Notifications
You must be signed in to change notification settings - Fork 143
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/json schema for workflows #159
base: main
Are you sure you want to change the base?
Changes from all commits
036edce
db9901f
123c9ed
54c3846
153300f
fd9bb37
49ed65d
f8b7fed
6152e05
5a73116
c14bb48
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"yaml.schemas": { | ||
"schemas/workflow.json": "specs/*/*.yaml" | ||
} | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: could we end all files with a new line |
Original file line number | Diff line number | Diff line change | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,142 @@ | ||||||||||||||
{ | ||||||||||||||
"$schema": "http://json-schema.org/draft-07/schema", | ||||||||||||||
"definitions": { | ||||||||||||||
"url": { | ||||||||||||||
"oneOf": [ | ||||||||||||||
{ | ||||||||||||||
"type": "string", | ||||||||||||||
"minLength": 1, | ||||||||||||||
"pattern": "^https?://.+" | ||||||||||||||
}, | ||||||||||||||
{ | ||||||||||||||
"type": "null" | ||||||||||||||
} | ||||||||||||||
] | ||||||||||||||
}, | ||||||||||||||
"nullable-string": { | ||||||||||||||
"oneOf": [ | ||||||||||||||
{ | ||||||||||||||
"type": "string", | ||||||||||||||
"minLength": 1 | ||||||||||||||
}, | ||||||||||||||
{ | ||||||||||||||
"type": "null" | ||||||||||||||
} | ||||||||||||||
] | ||||||||||||||
} | ||||||||||||||
}, | ||||||||||||||
"title": "workflow", | ||||||||||||||
"description": "A workflow", | ||||||||||||||
"type": "object", | ||||||||||||||
"required": [ | ||||||||||||||
"name", | ||||||||||||||
"command" | ||||||||||||||
], | ||||||||||||||
"properties": { | ||||||||||||||
"name": { | ||||||||||||||
"title": "name", | ||||||||||||||
"description": "A name of the current workflow\nhttps://github.com/EmilySeville7cfg/warp-workflows/blob/main/FORMAT.md#name", | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would you mind updating all of these links to point at the warpdotdev repo instead of your fork of this repo?https://github.com/warpdotdev/workflows/blob/main/FORMAT.md |
||||||||||||||
"type": "string", | ||||||||||||||
"minLength": 1, | ||||||||||||||
"examples": [ | ||||||||||||||
"Root your emulator" | ||||||||||||||
] | ||||||||||||||
}, | ||||||||||||||
"command": { | ||||||||||||||
"title": "command", | ||||||||||||||
"description": "A command of the current workflow\nhttps://github.com/EmilySeville7cfg/warp-workflows/blob/main/FORMAT.md#command", | ||||||||||||||
"type": "string", | ||||||||||||||
"minLength": 1, | ||||||||||||||
"examples": [ | ||||||||||||||
"adb root" | ||||||||||||||
] | ||||||||||||||
}, | ||||||||||||||
"tags": { | ||||||||||||||
"title": "tags", | ||||||||||||||
"description": "Tags of the current workflow\nhttps://github.com/EmilySeville7cfg/warp-workflows/blob/main/FORMAT.md#tags", | ||||||||||||||
"type": "array", | ||||||||||||||
"uniqueItems": true, | ||||||||||||||
"items": { | ||||||||||||||
"description": "A tag of the current workflow\nhttps://github.com/EmilySeville7cfg/warp-workflows/blob/main/FORMAT.md#tags", | ||||||||||||||
"type": "string", | ||||||||||||||
"minLength": 1, | ||||||||||||||
"examples": [ | ||||||||||||||
"android" | ||||||||||||||
] | ||||||||||||||
} | ||||||||||||||
}, | ||||||||||||||
"description": { | ||||||||||||||
"title": "description", | ||||||||||||||
"description": "A description of the current workflow\nhttps://github.com/EmilySeville7cfg/warp-workflows/blob/main/FORMAT.md#description", | ||||||||||||||
"$ref": "#/definitions/nullable-string" | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm by no means a JSON schema expert, but could you clarify why we need the |
||||||||||||||
}, | ||||||||||||||
"source_url": { | ||||||||||||||
"title": "source url", | ||||||||||||||
"description": "A source url of the current workflow\nhttps://github.com/EmilySeville7cfg/warp-workflows/blob/main/FORMAT.md#source_url", | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would you mind using the description that was originally used in the |
||||||||||||||
"$ref": "#/definitions/url" | ||||||||||||||
}, | ||||||||||||||
"author": { | ||||||||||||||
"title": "author", | ||||||||||||||
"description": "An author of the current workflow\nhttps://github.com/EmilySeville7cfg/warp-workflows/blob/main/FORMAT.md#author", | ||||||||||||||
"$ref": "#/definitions/nullable-string" | ||||||||||||||
}, | ||||||||||||||
"author_url": { | ||||||||||||||
"title": "author url", | ||||||||||||||
"description": "An author url of the current workflow\nhttps://github.com/EmilySeville7cfg/warp-workflows/blob/main/FORMAT.md#author_url", | ||||||||||||||
"$ref": "#/definitions/url" | ||||||||||||||
}, | ||||||||||||||
"shells": { | ||||||||||||||
"title": "shells", | ||||||||||||||
"description": "Shells where the current workflow is valid\nhttps://github.com/EmilySeville7cfg/warp-workflows/blob/main/FORMAT.md#shells", | ||||||||||||||
"type": "array", | ||||||||||||||
"uniqueItems": true, | ||||||||||||||
"items": { | ||||||||||||||
"description": "A shell where the current workflow is valid\nhttps://github.com/EmilySeville7cfg/warp-workflows/blob/main/FORMAT.md#shells", | ||||||||||||||
"type": "string", | ||||||||||||||
"enum": [ | ||||||||||||||
"zsh", | ||||||||||||||
"bash", | ||||||||||||||
"fish" | ||||||||||||||
Comment on lines
+96
to
+99
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The existing format accepts either workflows/workflow-types/src/lib.rs Lines 5 to 10 in 495b5cf
I think we should make that explicit in this format because there could be existing workflow yaml files in the wild that use the uppercase format. |
||||||||||||||
] | ||||||||||||||
} | ||||||||||||||
}, | ||||||||||||||
"arguments": { | ||||||||||||||
"title": "arguments", | ||||||||||||||
"description": "Arguments of the current workflow\nhttps://github.com/EmilySeville7cfg/warp-workflows/blob/main/FORMAT.md#arguments", | ||||||||||||||
"type": "array", | ||||||||||||||
"uniqueItems": true, | ||||||||||||||
"items": { | ||||||||||||||
"description": "An argument of the current workflow\nhttps://github.com/EmilySeville7cfg/warp-workflows/blob/main/FORMAT.md#arguments", | ||||||||||||||
"type": "object", | ||||||||||||||
"required": [ | ||||||||||||||
"name" | ||||||||||||||
], | ||||||||||||||
"properties": { | ||||||||||||||
"name": { | ||||||||||||||
"title": "name", | ||||||||||||||
"description": "A name of the current argument\nhttps://github.com/EmilySeville7cfg/warp-workflows/blob/main/FORMAT.md#argumentsname", | ||||||||||||||
"type": "string", | ||||||||||||||
"minLength": 1 | ||||||||||||||
}, | ||||||||||||||
"description": { | ||||||||||||||
"title": "description", | ||||||||||||||
"description": "A description of the current argument\nhttps://github.com/EmilySeville7cfg/warp-workflows/blob/main/FORMAT.md#argumentsdescription", | ||||||||||||||
"$ref": "#/definitions/nullable-string" | ||||||||||||||
}, | ||||||||||||||
"default_value": { | ||||||||||||||
"title": "default value", | ||||||||||||||
"description": "A default value of the current argument\nhttps://github.com/EmilySeville7cfg/warp-workflows/blob/main/FORMAT.md#argumentsdefault_value", | ||||||||||||||
"type": [ | ||||||||||||||
"boolean", | ||||||||||||||
"number", | ||||||||||||||
"string", | ||||||||||||||
"null" | ||||||||||||||
] | ||||||||||||||
} | ||||||||||||||
}, | ||||||||||||||
"additionalProperties": false | ||||||||||||||
} | ||||||||||||||
} | ||||||||||||||
}, | ||||||||||||||
"additionalProperties": false | ||||||||||||||
} | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. could we also end this file with a newline? |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,19 +2,28 @@ | |
|
||
set -e | ||
|
||
if ! command -v brew; then | ||
echo "Installing brew..." | ||
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" | ||
echo "Please make sure brew is set correctly in your PATH" | ||
exit 1 | ||
fi | ||
|
||
if ! command -v cargo; then | ||
echo "Installing rust..." | ||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh | ||
echo "Please start a new terminal session so that cargo is in your PATH" | ||
exit 1 | ||
fi | ||
reset='\e[0m' | ||
red='\e[31m' | ||
green='\e[32m' | ||
cyan='\e[36m' | ||
|
||
install_dependency() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: Would you mind documenting each argument to this function? |
||
id_dependency="$1" | ||
id_description="$2" | ||
id_installation_command="$3" | ||
|
||
if ! command -v "$id_dependency" > /dev/null; then | ||
printf "${green}Installing '$red%s$green' ('$cyan%s$green' binary)\n$reset" "$id_description" "$id_dependency" | ||
sh -c "$id_installation_command" | ||
printf "${green}Installed '$cyan%s$green' successfully. | ||
Please make sure '$cyan%s$green' binary is in your \$PATH.\n$reset" "$id_dependency" "$id_dependency" | ||
exit 1 | ||
fi | ||
} | ||
|
||
# shellcheck disable=SC2016 | ||
install_dependency brew Homebrew '/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"' | ||
install_dependency rustc Rust 'curl --proto "=https" --tlsv1.2 -sSf https://sh.rustup.rs | sh' | ||
|
||
cargo install cargo-bundle | ||
cargo install cargo-diff-tools --git https://github.com/warpdotdev/cargo-diff-tools | ||
|
@@ -23,3 +32,6 @@ cargo install cargo-diff-tools --git https://github.com/warpdotdev/cargo-diff-to | |
brew update | ||
|
||
rustup component add clippy | ||
|
||
install_dependency python3-pip 'Python package manager' 'sudo apt install python3-pip' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we should avoid Also, I'm curious your thoughts on whether we should use https://www.npmjs.com/package/ajv-cli instead. It's the one of the official CLI JSON validators mentioned by the JSON schema org https://json-schema.org/implementations.html. |
||
install_dependency jsonschema-cli 'JSON schema validator' 'pip3 install jsonschema-cli' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we support both
yaml
andyml
? IMO we should be flexible and support both (this is what Github actoins does as well, fwiw https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#about-yaml-syntax-for-workflows)