From 7390cc66aa2071b2ecb41b951b2462341f0795b0 Mon Sep 17 00:00:00 2001 From: Marc Durdin Date: Wed, 27 Aug 2025 07:23:40 +0200 Subject: [PATCH] maint(resources): move build trigger scripts into resources/teamcity This also removes the need to have a test for `-b` parameter in trigger-test-builds.sh, because the TC scripts calling this can already factor that in. Testing script trigger so only do builds of common to verify Fixes: #14483 Test-bot: skip Build-bot: skip:all build:common --- .../workflows/auto-merge-keyman-server-pr.yml | 11 +++---- docs/linux/packaging.md | 4 +-- resources/build/README.md | 12 ------- resources/build/version/README.md | 9 +++--- resources/teamcity/triggers/README.md | 18 +++++++++++ .../triggers/trigger-release-builds.sh} | 32 +++++++++---------- .../triggers/trigger-test-builds.sh} | 24 ++++---------- 7 files changed, 52 insertions(+), 58 deletions(-) create mode 100755 resources/teamcity/triggers/README.md rename resources/{build/increment-version.sh => teamcity/triggers/trigger-release-builds.sh} (83%) rename resources/{build/run-required-test-builds.sh => teamcity/triggers/trigger-test-builds.sh} (91%) diff --git a/.github/workflows/auto-merge-keyman-server-pr.yml b/.github/workflows/auto-merge-keyman-server-pr.yml index 39cafc3f91..771fd6ae5e 100644 --- a/.github/workflows/auto-merge-keyman-server-pr.yml +++ b/.github/workflows/auto-merge-keyman-server-pr.yml @@ -1,10 +1,9 @@ # -# Automatically merges pull requests opened by keyman-server -# The initial use of this action is to increment the patch -# version of Keyman with resources/build/increment-version.sh. -# That script creates a PR and then this workflow will be -# triggered to approve the PR (from github-actions account), and -# then automerge it. +# Automatically merges pull requests opened by keyman-server The initial use of +# this action is to increment the patch version of Keyman with +# resources/teamcity/triggers/trigger-release-builds.sh. That script creates a PR and +# then this workflow will be triggered to approve the PR (from github-actions +# account), and then automerge it. # name: Auto Merge PRs from keyman-server on: diff --git a/docs/linux/packaging.md b/docs/linux/packaging.md index d7d58fc977..8e97f8e303 100644 --- a/docs/linux/packaging.md +++ b/docs/linux/packaging.md @@ -35,10 +35,10 @@ and of course the source code for the packages: - [.github/workflows/deb-packaging.yml](https://github.com/keymanapp/keyman/blob/master/.github/workflows/deb-packaging.yml) contains the definition of the packaging GHA -- [resources/build/run-required-test-builds.sh](https://github.com/keymanapp/keyman/blob/master/resources/build/run-required-test-builds.sh) +- [resources/teamcity/triggers/trigger-test-builds.sh](https://github.com/keymanapp/keyman/blob/master/resources/teamcity/triggers/trigger-test-builds.sh) runs on [TeamCity](https://build.palaso.org/buildConfiguration/Keyman_Test?) to trigger the builds for the various platforms, among them the GHA package build. -- [resources/build/increment-version.sh](https://github.com/keymanapp/keyman/blob/master/resources/build/increment-version.sh) +- [resources/teamcity/triggers/trigger-release-builds.sh](https://github.com/keymanapp/keyman/blob/master/resources/teamcity/triggers/trigger-release-builds.sh) runs on [TeamCity](https://build.palaso.org/buildConfiguration/Keyman_TriggerReleaseBuildsMaster?) and increments the version number before triggering the builds for the various platforms. diff --git a/resources/build/README.md b/resources/build/README.md index 1a03fbda34..34528a60dd 100644 --- a/resources/build/README.md +++ b/resources/build/README.md @@ -1,15 +1,3 @@ -# Release builds - -A release is triggered nightly whenever a pull request has been merged to the branch; it -runs from a TeamCity build configuration that runs `increment-version.sh` and then uploads -the resulting `HISTORY.md` to . - -To manually make a release (for example if a build falls over for a transient error or -there was a build configuration problem), create a new PR that targets the branch, -merge it, and then run the **Trigger Release Builds** build configuration for that -branch. If you have no changes, see that as an opportunity to improve documentation, -including this file... - ## Various tools ### builder-basic.inc.sh, builder-full.inc.sh diff --git a/resources/build/version/README.md b/resources/build/version/README.md index f6a4951856..413e37c497 100644 --- a/resources/build/version/README.md +++ b/resources/build/version/README.md @@ -1,10 +1,9 @@ # Version increment and automatic history maintenance -This node module automatically refreshes HISTORY.md with -titles from the latest pull requests merged since the last -automatic version increment, and if any history has been -found, increments the version, and creates a PR for the +This node module automatically refreshes HISTORY.md with titles from the latest +pull requests merged since the last automatic version increment, and if any +history has been found, increments the version, and creates a PR for the increment. -It is wrappered by ../increment-version.sh for normal CI +It is wrappered by ../teamcity/triggers/trigger-release-builds.sh for normal CI usage. \ No newline at end of file diff --git a/resources/teamcity/triggers/README.md b/resources/teamcity/triggers/README.md new file mode 100755 index 0000000000..bc219c8bfe --- /dev/null +++ b/resources/teamcity/triggers/README.md @@ -0,0 +1,18 @@ +# Release builds + +A release is triggered nightly whenever a pull request has been merged to the +master (alpha) or beta branches; it runs from a TeamCity build configuration +that runs `trigger-release-builds.sh` and then uploads the resulting +`HISTORY.md` to . + +For stable releases, these are always manually triggered in TeamCity. + +To manually make a release (for example if a build falls over for a transient error or +there was a build configuration problem), create a new PR that targets the branch, +merge it, and then run the **Trigger Release Builds** build configuration for that +branch. If you have no changes, see that as an opportunity to improve documentation, +including this file... + +# Test builds + +Test builds are triggered for any commit to a PR, via `trigger-test-builds.sh`. \ No newline at end of file diff --git a/resources/build/increment-version.sh b/resources/teamcity/triggers/trigger-release-builds.sh similarity index 83% rename from resources/build/increment-version.sh rename to resources/teamcity/triggers/trigger-release-builds.sh index 2d2ddc3bba..65852ca8de 100755 --- a/resources/build/increment-version.sh +++ b/resources/teamcity/triggers/trigger-release-builds.sh @@ -4,27 +4,27 @@ set -e set -u # -# Usage: increment-version.sh [-f] [commit base] +# Usage: trigger-release-builds.sh [-f] [commit base] # -# Increments the patch version on VERSION.md +# Triggers release builds for the current version, increments the patch version +# on VERSION.md, writes version history to HISTORY.md, and creates an automerge +# PR with the version increment and history update. # -# If -f is specified, triggers a build even with -# no detected changes. +# If -f is specified, triggers a build even with no detected changes. # -# If commit is specified, pushes the new version -# to the repository. base snould be either -# master or beta. +# If commit is specified, pushes the new version to the repository. base snould +# be either master or beta. # ## START STANDARD BUILD SCRIPT INCLUDE # adjust relative paths as necessary THIS_SCRIPT="$(readlink -f "${BASH_SOURCE[0]}")" -. "${THIS_SCRIPT%/*}/../../resources/build/builder-basic.inc.sh" +. "${THIS_SCRIPT%/*}/../../../resources/build/builder-basic.inc.sh" ## END STANDARD BUILD SCRIPT INCLUDE -. "${THIS_SCRIPT%/*}/ci/trigger-definitions.inc.sh" -. "${THIS_SCRIPT%/*}/ci/trigger-builds.inc.sh" -. "${THIS_SCRIPT%/*}/ci/sentry-control.inc.sh" +. "${KEYMAN_ROOT}/resources/build/ci/trigger-definitions.inc.sh" +. "${KEYMAN_ROOT}/resources/build/ci/trigger-builds.inc.sh" +. "${KEYMAN_ROOT}/resources/build/ci/sentry-control.inc.sh" gitbranch=`git branch --show-current` @@ -77,7 +77,7 @@ else fi if [[ $action == help ]]; then - echo "Usage: increment-version.sh [-f] [commit base]" + echo "Usage: trigger-release-builds.sh [-f] [commit base]" echo " -f forces a build even with no changes" echo " base must be either master, beta or stable-x.y." echo " base must be equal to currently checked-out" @@ -87,20 +87,20 @@ fi # Let's ensure our base is up to date with GitHub to # avoid transient errors -echo "increment-version.sh: updating branch $base from GitHub" +echo "trigger-release-builds.sh: updating branch $base from GitHub" git pull origin $base # # Run the increment + history refresh # -echo "increment-version.sh: building resources/build/version" +echo "trigger-release-builds.sh: building resources/build/version" pushd "$KEYMAN_ROOT" npm ci "$KEYMAN_ROOT/resources/build/version/build.sh" -echo "increment-version.sh: running resources/build/version" +echo "trigger-release-builds.sh: running resources/build/version" pushd "$KEYMAN_ROOT" ABORT=0 if [[ -z "$fromversion" ]]; then @@ -131,7 +131,7 @@ popd > /dev/null # if [ "$action" == "commit" ]; then - echo "increment-version.sh: committing to repository and tagging release version $KEYMAN_VERSION_WITH_TAG" + echo "trigger-release-builds.sh: committing to repository and tagging release version $KEYMAN_VERSION_WITH_TAG" KEYMAN_VERSION_MD="$KEYMAN_ROOT/VERSION.md" NEWVERSION=`cat $KEYMAN_VERSION_MD | tr -d "[:space:]"` diff --git a/resources/build/run-required-test-builds.sh b/resources/teamcity/triggers/trigger-test-builds.sh similarity index 91% rename from resources/build/run-required-test-builds.sh rename to resources/teamcity/triggers/trigger-test-builds.sh index cce8713054..967312b18a 100755 --- a/resources/build/run-required-test-builds.sh +++ b/resources/teamcity/triggers/trigger-test-builds.sh @@ -9,29 +9,19 @@ ## START STANDARD BUILD SCRIPT INCLUDE # adjust relative paths as necessary THIS_SCRIPT="$(readlink -f "${BASH_SOURCE[0]}")" -. "${THIS_SCRIPT%/*}/../../resources/build/builder-full.inc.sh" +. "${THIS_SCRIPT%/*}/../../../resources/build/builder-full.inc.sh" ## END STANDARD BUILD SCRIPT INCLUDE -. "${THIS_SCRIPT%/*}/ci/trigger-definitions.inc.sh" -. "${THIS_SCRIPT%/*}/ci/trigger-builds.inc.sh" -. "${THIS_SCRIPT%/*}/ci/trigger-build-bot.inc.sh" -. "${THIS_SCRIPT%/*}/jq.inc.sh" +. "${KEYMAN_ROOT}/resources/build/ci/trigger-definitions.inc.sh" +. "${KEYMAN_ROOT}/resources/build/ci/trigger-builds.inc.sh" +. "${KEYMAN_ROOT}/resources/build/ci/trigger-build-bot.inc.sh" +. "${KEYMAN_ROOT}/resources/build/jq.inc.sh" builder_describe "Run test builds for the given pull request/primary branch" \ "--dry-run,-n Only report back which builds would be started" \ "--branch,-b=PRNUM Branch (master,beta,stable-x.y) or pull-request to test" -if [[ $# -eq 1 ]] && [[ "$1" =~ ^([0-9]+|master|beta|stable-[0-9]+\.[0-9]+)$ ]]; then - # For transitional period, when build configuration on TC needs to support - # both forms, we will pass a modified set of params to builder_parse - # - # TODO: remove this condition once all branches have received this change, - # and update TC build configuration to pass -b parameter - # - builder_parse -b "$1" -else - builder_parse "$@" -fi +builder_parse "$@" # Validate parameters @@ -71,7 +61,7 @@ function triggerTestBuilds() { if builder_has_option --dry-run; then builder_echo "DRY RUN: cancel current builds for $branch" else - node "$THIS_SCRIPT_PATH/ci/cancel-builds/cancel-test-builds.mjs" "$branch" "$TEAMCITY_TOKEN" + node "$KEYMAN_ROOT/resources/build/ci/cancel-builds/cancel-test-builds.mjs" "$branch" "$TEAMCITY_TOKEN" fi for platform in "${!platforms[@]}"; do