maint(mac): add TC build scripts for macOS

Fixes: #14190
Part-of: #13399
Build-bot: release mac
Test-bot: skip
This commit is contained in:
Eberhard Beilharz 2025-06-30 17:12:01 +02:00
parent 9c6838096e
commit 02ca6222bd
No known key found for this signature in database
GPG key ID: E9140597606020D3
4 changed files with 152 additions and 0 deletions

View file

@ -14,3 +14,11 @@ ba_mac_clean_xcode_derived_data() {
rm -rf "${HOME}/Library/Developer/Xcode/DerivedData"
builder_echo end "clean" success "Finished cleaning XCode DerivedData mess"
}
ba_mac_unmount_volumes_keyman() {
builder_echo start "unmount" "Unmounting Keyman volumes"
if [[ -d /Volumes/Keyman ]]; then
hdiutil detach /Volumes/Keyman;
fi
builder_echo end success "unmount" "Finished unmounting Keyman volumes"
}

View file

@ -0,0 +1,88 @@
#!/usr/bin/env bash
# Keyman is copyright (C) SIL Global. MIT License.
#
# TC build script for Keyman macOS/Release
#
# Requires: env variable $MAC_BUILDAGENT_PASSWORD set
# 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/build/builder.inc.sh"
## END STANDARD BUILD SCRIPT INCLUDE
# shellcheck disable=SC2154
. "${KEYMAN_ROOT}/resources/shellHelperFunctions.sh"
. "${KEYMAN_ROOT}/resources/teamcity/includes/tc-helpers.inc.sh"
. "${KEYMAN_ROOT}/resources/teamcity/includes/tc-mac.inc.sh"
. "${KEYMAN_ROOT}/resources/teamcity/macos/macos-actions.inc.sh"
################################ Main script ################################
builder_describe \
"Build release of Keyman for macOS" \
"all run all actions" \
"clean clean artifact directories" \
"build build Keyman for macOS" \
"publish publish Keyman for macOS" \
"--rsync-path=RSYNC_PATH rsync path on remote server" \
"--rsync-user=RSYNC_USER rsync user on remote server" \
"--rsync-host=RSYNC_HOST rsync host on remote server" \
"--rsync-root=RSYNC_ROOT rsync root on remote server" \
"--help.keyman.com=HELP_KEYMAN_COM path to help.keyman.com repository"
builder_parse "$@"
cd "${KEYMAN_ROOT}/mac"
function _publish_to_downloads_keyman_com() {
builder_echo start "publish to downloads.keyman.com" "Publishing release to downloads.keyman.com"
local UPLOAD_DIR
# Note that the `rsync` tool that exists on Macs by default is a very old version and must be updated to a newer version, e.g. by using Homebrew.
UPLOAD_DIR="Keyman4MacIM/output/upload/${KEYMAN_VERSION}"
# Set permissions as required on download site
builder_echo "Setting upload file permissions for downloads.keyman.com"
chmod g+w "${UPLOAD_DIR}"
chmod a+rx "${UPLOAD_DIR}"
chmod g+rw "${UPLOAD_DIR}"/*
chmod a+r "${UPLOAD_DIR}"/*
builder_echo "Performing rsync call"
# shellcheck disable=SC2154
tc_rsync_upload "${UPLOAD_DIR}" "mac/${KEYMAN_TIER}"
builder_echo end "publish to downloads.keyman.com" success "Finished publishing release to downloads.keyman.com"
}
function _build_publish() {
builder_echo start "publish" "Publishing Keyman for macOS"
# shellcheck disable=SC2154
"${KEYMAN_ROOT}/mac/build.sh" publish
builder_echo end success "publish" "Finished publishing Keyman for macOS"
}
function _do_publish() {
_build_publish
_publish_to_downloads_keyman_com
upload_help "Keyman for macOS" mac
}
ba_mac_unlock_keychain
if builder_has_action all; then
macos_clean_action
macos_build_action
do_publish
else
builder_run_action clean macos_clean_action
builder_run_action build macos_build_action
builder_run_action publish do_publish
fi

View file

@ -0,0 +1,42 @@
#!/usr/bin/env bash
# Keyman is copyright (C) SIL Global. MIT License.
#
# TC build script for Keyman macOS/Test
#
# Requires: env variable $MAC_BUILDAGENT_PASSWORD set
# 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/build/builder.inc.sh"
## END STANDARD BUILD SCRIPT INCLUDE
# shellcheck disable=SC2154
. "${KEYMAN_ROOT}/resources/shellHelperFunctions.sh"
. "${KEYMAN_ROOT}/resources/teamcity/includes/tc-mac.inc.sh"
. "${KEYMAN_ROOT}/resources/teamcity/macos/macos-actions.inc.sh"
################################ Main script ################################
builder_describe \
"Build Keyman for macOS" \
"all run all actions" \
"clean clean artifact directories" \
"build build Keyman for macOS"
builder_parse "$@"
cd "${KEYMAN_ROOT}/mac"
ba_mac_unlock_keychain
if builder_has_action all; then
macos_clean_action
macos_build_action
else
builder_run_action clean macos_clean_action
builder_run_action build macos_build_action
fi

View file

@ -0,0 +1,14 @@
#!/usr/bin/env bash
# Keyman is copyright (C) SIL Global. MIT License.
macos_clean_action() {
ba_mac_clean_xcode_derived_data
ba_mac_unmount_volumes_keyman
}
macos_build_action() {
builder_echo start "build" "Building Keyman for macOS"
# shellcheck disable=SC2154
"${KEYMAN_ROOT}/mac/build.sh" configure build test publish
builder_echo end success "build" "Finished building Keyman for macOS"
}