diff --git a/.gitignore b/.gitignore index e55d834b..71b3d24c 100644 --- a/.gitignore +++ b/.gitignore @@ -2,7 +2,6 @@ node_modules/ release/*/*/build/ sample/*/*/build/ experimental/*/*/build/ -servervars.sh .cache *.kpj.user diff --git a/ci.sh b/ci.sh index 79c86e1c..110fb5c9 100755 --- a/ci.sh +++ b/ci.sh @@ -27,7 +27,6 @@ else APP7Z="/c/Program Files/7-Zip/7z.exe" fi -. "$MODELROOT/servervars.sh" . "$MODELROOT/resources/util.inc.sh" . "$MODELROOT/resources/rsync-tools.inc.sh" diff --git a/resources/teamcity/models/models-build-deploy.sh b/resources/teamcity/models/models-build-deploy.sh new file mode 100755 index 00000000..04dfd031 --- /dev/null +++ b/resources/teamcity/models/models-build-deploy.sh @@ -0,0 +1,59 @@ +#!/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 models" \ + "all run all actions" \ + "build build models" \ + "publish deploy models" \ + "--downloads-keyman-com=DOWNLOADS_KEYMAN_COM_URL URL of downloads server" \ + "--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 REMOTE_RSYNC_PATH +export RSYNC_DEST + +function do_build() { + builder_echo "Building all models" + "${REPO_ROOT}/build.sh" configure build test + builder_echo "Finished building all models" +} + +function do_publish() { + if [[ -z "${DOWNLOADS_KEYMAN_COM_URL+x}" ]]; then + builder_die "Option --downloads-keyman-com must be specified for publish action" + fi + if [[ -z "${REMOTE_RSYNC_PATH+x}" ]]; then + builder_die "Option --rsync-path must be specified for publish action" + fi + if [[ -z "${RSYNC_DEST+x}" ]]; then + builder_die "Option --rsync-dest must be specified for publish action" + fi + builder_echo "Uploading models to downloads.keyman.com" + "${REPO_ROOT}/ci.sh" + builder_echo "Finished uploading models to downloads.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 diff --git a/resources/teamcity/models/models-test-prs.sh b/resources/teamcity/models/models-test-prs.sh new file mode 100755 index 00000000..13097a69 --- /dev/null +++ b/resources/teamcity/models/models-test-prs.sh @@ -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 models" + "${REPO_ROOT}/build.sh" configure build test + builder_echo "Finished building all models" +} + +cd "${REPO_ROOT}" + +builder_run_action all do_build