-
-
Notifications
You must be signed in to change notification settings - Fork 347
maint(common): add TC build scripts for keyboards 🪶 #3604
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
Changes from all commits
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,90 @@ | ||
| #!/usr/bin/env bash | ||
| # Keyman is copyright (C) SIL Global. MIT License. | ||
|
|
||
| # shellcheck disable=SC2164 | ||
| # shellcheck disable=SC1091 | ||
|
|
||
| ## START STANDARD BUILD SCRIPT INCLUDE | ||
| # adjust relative paths as necessary | ||
| THIS_SCRIPT="$(readlink -f "${BASH_SOURCE[0]}")" | ||
| . "${THIS_SCRIPT%/*}/../../../resources/builder.inc.sh" | ||
| ## END STANDARD BUILD SCRIPT INCLUDE | ||
|
|
||
| ################################ Main script ################################ | ||
|
|
||
| builder_describe \ | ||
| "Build and deploy keyboards" \ | ||
| "all run all actions" \ | ||
| "build build keyboards" \ | ||
| "publish deploy keyboards" \ | ||
| "--downloads-keyman-com=DOWNLOADS_KEYMAN_COM_URL URL of downloads server" \ | ||
| "--help-keyman-com=HELP_KEYMAN_COM Path to help.keyman.com repository" \ | ||
| "--s-keyman-com=S_KEYMAN_COM Path to s.keyman.com repository" \ | ||
| "--rsync-path=REMOTE_RSYNC_PATH Path to rsync on remote server" \ | ||
| "--rsync-dest=RSYNC_DEST Destination for rsync" | ||
|
|
||
| builder_parse "$@" | ||
|
|
||
| export DOWNLOADS_KEYMAN_COM_URL | ||
| export HELP_KEYMAN_COM | ||
| export S_KEYMAN_COM | ||
| export REMOTE_RSYNC_PATH | ||
| export RSYNC_DEST | ||
|
|
||
| function do_build() { | ||
| builder_echo "Building all keyboards" | ||
| "${REPO_ROOT}/build.sh" | ||
| builder_echo "Finished building all keyboards" | ||
| } | ||
|
|
||
| function _upload_to_downloads_keyman_com() { | ||
| builder_echo "Uploading keyboards to downloads.keyman.com" | ||
| "${REPO_ROOT}/ci.sh" -no-exe | ||
| builder_echo "Finished uploading keyboards to downloads.keyman.com" | ||
| } | ||
|
|
||
| function _upload_to_s_keyman_com() { | ||
| builder_echo "Uploading new keyboards to s.keyman.com" | ||
| ( | ||
| cd "${REPO_ROOT}/resources" | ||
| "${REPO_ROOT}/resources/s-keyman-com.sh" | ||
| ) | ||
| builder_echo "Finished uploading new keyboards to s.keyman.com" | ||
| } | ||
|
|
||
| function _upload_to_help_keyman_com() { | ||
| builder_echo "Uploading new keyboard help to help.keyman.com" | ||
| ( | ||
| cd "${REPO_ROOT}/resources" | ||
| "${REPO_ROOT}/resources/help-keyman-com.sh" | ||
| ) | ||
| builder_echo "Finished uploading new keyboard help to help.keyman.com" | ||
| } | ||
|
|
||
| function do_publish() { | ||
| if [[ -z "${DOWNLOADS_KEYMAN_COM_URL:-}" ]]; then | ||
| builder_die "Option --downloads-keyman-com must be specified for publish action" | ||
| elif [[ -z "${HELP_KEYMAN_COM:-}" ]]; then | ||
| builder_die "Option --help-keyman-com must be specified for publish action" | ||
| elif [[ -z "${S_KEYMAN_COM:-}" ]]; then | ||
| builder_die "Option --s-keyman-com must be specified for publish action" | ||
| elif [[ -z "${REMOTE_RSYNC_PATH:-}" ]]; then | ||
| builder_die "Option --rsync-path must be specified for publish action" | ||
| elif [[ -z "${RSYNC_DEST:-}" ]]; then | ||
| builder_die "Option --rsync-dest must be specified for publish action" | ||
| fi | ||
|
|
||
| _upload_to_downloads_keyman_com | ||
|
Member
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. We should verify that all parameters are set here (as in keymanapp/lexical-models#319 (comment))
Contributor
Author
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. done |
||
| _upload_to_s_keyman_com | ||
| _upload_to_help_keyman_com | ||
| } | ||
|
|
||
| cd "${REPO_ROOT}" | ||
|
|
||
| if builder_has_action all; then | ||
| do_build | ||
| do_publish | ||
| else | ||
| builder_run_action build do_build | ||
| builder_run_action publish do_publish | ||
| fi | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,50 @@ | ||||||||||||||||||
| #!/usr/bin/env bash | ||||||||||||||||||
| # Keyman is copyright (C) SIL Global. MIT License. | ||||||||||||||||||
|
|
||||||||||||||||||
| # shellcheck disable=SC2164 | ||||||||||||||||||
| # shellcheck disable=SC1091 | ||||||||||||||||||
|
|
||||||||||||||||||
| ## START STANDARD BUILD SCRIPT INCLUDE | ||||||||||||||||||
| # adjust relative paths as necessary | ||||||||||||||||||
| THIS_SCRIPT="$(readlink -f "${BASH_SOURCE[0]}")" | ||||||||||||||||||
| . "${THIS_SCRIPT%/*}/../../../resources/builder.inc.sh" | ||||||||||||||||||
| ## END STANDARD BUILD SCRIPT INCLUDE | ||||||||||||||||||
|
|
||||||||||||||||||
| ################################ Main script ################################ | ||||||||||||||||||
|
|
||||||||||||||||||
| builder_describe \ | ||||||||||||||||||
| "Notify api.keyman.com of updated keyboards" \ | ||||||||||||||||||
| "all run all actions" \ | ||||||||||||||||||
| "--webhook-token=WEBHOOK_TOKEN Token for api.keyman.com webhook" | ||||||||||||||||||
|
|
||||||||||||||||||
| builder_parse "$@" | ||||||||||||||||||
|
|
||||||||||||||||||
| function _notify_api() { | ||||||||||||||||||
| local API_URL URL HTTPRESULT STATUSCODE | ||||||||||||||||||
|
|
||||||||||||||||||
| API_URL=$1 | ||||||||||||||||||
| URL="https://${API_URL}/_control/webhook/keyboards-build-success.json?token=${WEBHOOK_TOKEN}" | ||||||||||||||||||
| HTTPRESULT=$(curl --silent --write-out "\n\nHTTP status code: %{http_code}" "${URL}") | ||||||||||||||||||
| STATUSCODE=$(echo "${HTTPRESULT}" | tail -n1 | cut -d" " -f 4) | ||||||||||||||||||
|
Comment on lines
+25
to
+28
Member
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.
Suggested change
Contributor
Author
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. done |
||||||||||||||||||
| builder_echo "${HTTPRESULT}" | ||||||||||||||||||
| if [[ $STATUSCODE -ne 200 ]]; then | ||||||||||||||||||
| builder_echo "-----------------------------------" | ||||||||||||||||||
| builder_echo error "ERROR: call failed with $STATUSCODE" | ||||||||||||||||||
| exit 1 | ||||||||||||||||||
| fi | ||||||||||||||||||
| } | ||||||||||||||||||
|
|
||||||||||||||||||
| function do_notify_api_keyman_com() { | ||||||||||||||||||
| builder_echo "Notifying api.keyman.com of updated keyboards" | ||||||||||||||||||
| _notify_api "api.keyman.com" | ||||||||||||||||||
| builder_echo "Finished notifying api.keyman.com of updated keyboards" | ||||||||||||||||||
| } | ||||||||||||||||||
|
|
||||||||||||||||||
| function do_notify_api_keyman_staging_com() { | ||||||||||||||||||
| builder_echo "Notifying api.keyman-staging.com of updated keyboards" | ||||||||||||||||||
| _notify_api "api.keyman-staging.com" | ||||||||||||||||||
| builder_echo "Finished notifying api.keyman-staging.com of updated keyboards" | ||||||||||||||||||
| } | ||||||||||||||||||
|
|
||||||||||||||||||
| do_notify_api_keyman_com | ||||||||||||||||||
| do_notify_api_keyman_staging_com | ||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| #!/usr/bin/env bash | ||
| # Keyman is copyright (C) SIL Global. MIT License. | ||
|
|
||
| # shellcheck disable=SC2164 | ||
| # shellcheck disable=SC1091 | ||
|
|
||
| ## START STANDARD BUILD SCRIPT INCLUDE | ||
| # adjust relative paths as necessary | ||
| THIS_SCRIPT="$(readlink -f "${BASH_SOURCE[0]}")" | ||
| . "${THIS_SCRIPT%/*}/../../../resources/builder.inc.sh" | ||
| ## END STANDARD BUILD SCRIPT INCLUDE | ||
|
|
||
| ################################ Main script ################################ | ||
|
|
||
| builder_describe \ | ||
| "Test build of pull request" \ | ||
| "all run all actions" | ||
|
|
||
| builder_parse "$@" | ||
|
|
||
| function do_build() { | ||
| builder_echo "Building all keyboards" | ||
| "${REPO_ROOT}/build.sh" | ||
| builder_echo "Finished building all keyboards" | ||
| } | ||
|
|
||
| cd "${REPO_ROOT}" | ||
|
|
||
| builder_run_action all do_build |
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.
I presume these need to be exported so ci.sh can get to them
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.
done