mirror of
https://github.com/keymanapp/keyman.git
synced 2026-09-02 21:57:41 +00:00
Merge pull request #8001 from keymanapp/feat/web/ci-release
feat(web): implements shell scripting for CI release-build configurations 📜
This commit is contained in:
commit
157b5aa49e
2 changed files with 112 additions and 5 deletions
|
|
@ -306,7 +306,7 @@ copy_sources ( ) {
|
|||
do
|
||||
echo "- $SOURCE/$SOURCE_FOLDER/ => $CONFIG_OUT_PATH/src/$SOURCE_FOLDER/"
|
||||
mkdir -p "$CONFIG_OUT_PATH/src/$SOURCE_FOLDER"
|
||||
cp -Rf "$SOURCE/$SOURCE_FOLDER/" "$CONFIG_OUT_PATH/src/$SOURCE_FOLDER"
|
||||
cp -Rf "$SOURCE/$SOURCE_FOLDER/"* "$CONFIG_OUT_PATH/src/$SOURCE_FOLDER/"
|
||||
done
|
||||
|
||||
echo
|
||||
|
|
|
|||
115
web/ci.sh
115
web/ci.sh
|
|
@ -22,12 +22,18 @@ cd "$THIS_SCRIPT_PATH"
|
|||
|
||||
# ################################ Main script ################################
|
||||
|
||||
S_KEYMAN_COM=
|
||||
|
||||
builder_describe "Defines and implements the CI build steps for Keyman Engine for Web (KMW)." \
|
||||
"build" \
|
||||
"test Runs all unit tests." \
|
||||
"post-test Runs post-test cleanup. Should be run even if a prior step fails." \
|
||||
"validate-size Runs the build-size comparison check" \
|
||||
"--debug Runs this script in local-development mode; reports and tests will be locally logged"
|
||||
"test Runs all unit tests." \
|
||||
"post-test Runs post-test cleanup. Should be run even if a prior step fails." \
|
||||
"validate-size Runs the build-size comparison check" \
|
||||
"prepare Prepare upload artifacts for specified target(s)" \
|
||||
":s.keyman.com Target: builds artifacts for s.keyman.com " \
|
||||
":downloads.keyman.com Target: builds artifacts for downloads.keyman.com" \
|
||||
"--debug Runs this script in local-development mode; reports and tests will be locally logged" \
|
||||
"--s.keyman.com=S_KEYMAN_COM Sets the root location of a checked-out s.keyman.com repo"
|
||||
|
||||
builder_parse "$@"
|
||||
|
||||
|
|
@ -83,4 +89,105 @@ if builder_start_action validate-size; then
|
|||
./src/tools/building/check-build-size.sh $FLAGS
|
||||
|
||||
builder_finish_action success validate-size
|
||||
fi
|
||||
|
||||
if builder_start_action prepare:s.keyman.com; then
|
||||
if ! builder_has_option --s.keyman.com; then
|
||||
builder_die "--s.keyman.com is unset!"
|
||||
fi
|
||||
|
||||
if builder_has_option --debug; then
|
||||
# First phase: make sure the s.keyman.com repo is locally-available and up to date.
|
||||
pushd "$S_KEYMAN_COM"
|
||||
|
||||
# For testing on a local development machine / a machine with the repo already loaded.
|
||||
git checkout master
|
||||
git pull
|
||||
popd
|
||||
fi
|
||||
|
||||
# Second phase: copy the artifacts over
|
||||
|
||||
# The main build products are expected to reside at the root of this folder.
|
||||
BASE_PUBLISH_FOLDER="$S_KEYMAN_COM/kmw/engine/$VERSION"
|
||||
mkdir -p "$BASE_PUBLISH_FOLDER"
|
||||
|
||||
cp -Rf build/app/web/release/* "$BASE_PUBLISH_FOLDER"
|
||||
cp -Rf build/app/ui/release/* "$BASE_PUBLISH_FOLDER"
|
||||
|
||||
# Third phase: tweak the sourcemaps
|
||||
# We can use an alt-mode of Web's sourcemap-root tool for this.
|
||||
for sourcemap in "$BASE_PUBLISH_FOLDER/"*.map; do
|
||||
node build/tools/building/sourcemap-root/index.mjs null "$sourcemap" --sourceRoot "https://s.keyman.com/kmw/engine/$VERSION/src"
|
||||
done
|
||||
|
||||
# Actual construction of the PR will be left to CI-config scripting for now.
|
||||
|
||||
builder_finish_action success prepare:s.keyman.com
|
||||
fi
|
||||
|
||||
# Note: for now, this command is used to prepare the artifacts used by the download site, but
|
||||
# NOT to actually UPLOAD them via rsync or to produce related .download_info files.
|
||||
if builder_start_action prepare:downloads.keyman.com; then
|
||||
UPLOAD_PATH="build/upload/$VERSION"
|
||||
|
||||
# --- First action artifact - the KMW zip file ---
|
||||
ZIP="$UPLOAD_PATH/keymanweb-$VERSION.zip"
|
||||
|
||||
mkdir -p "$UPLOAD_PATH"
|
||||
|
||||
# On Windows, we use 7-zip (SEVEN_Z_HOME env var). On other platforms, we use zip.
|
||||
|
||||
COMPRESS_CMD=
|
||||
COMPRESS_ADD=
|
||||
|
||||
# Marc's preference; use $SEVEN_Z_HOME and have the BAs set up with THAT as an env var.
|
||||
if [ ! -z "${SEVEN_Z_HOME+x}" ]; then
|
||||
COMPRESS_CMD="$SEVEN_Z_HOME/7z"
|
||||
COMPRESS_ADD="a -bd -bb0 -r" # add, hide progress, log level 0, recursive
|
||||
fi
|
||||
|
||||
if [[ -z "${COMPRESS_CMD}" ]] ; then
|
||||
if command -v zip &> /dev/null; then
|
||||
# Note: does not support within-archive renames!
|
||||
COMPRESS_CMD=zip
|
||||
COMPRESS_ADD="-r"
|
||||
else
|
||||
builder_die "7z and zip commands are both unavailable"
|
||||
fi
|
||||
fi
|
||||
|
||||
pushd build/app/web/release
|
||||
"${COMPRESS_CMD}" $COMPRESS_ADD ../../../../$ZIP *
|
||||
cd ..
|
||||
"${COMPRESS_CMD}" $COMPRESS_ADD ../../../$ZIP debug
|
||||
popd
|
||||
|
||||
pushd build/app/ui/release
|
||||
"${COMPRESS_CMD}" $COMPRESS_ADD ../../../../$ZIP *
|
||||
cd ..
|
||||
"${COMPRESS_CMD}" $COMPRESS_ADD ../../../$ZIP debug
|
||||
popd
|
||||
|
||||
# --- Second action artifact - the 'static' folder (hosted user testing on downloads.keyman.com) ---
|
||||
|
||||
echo ""
|
||||
echo "Building \`static/\` folder for long-term hosting of testing resources..."
|
||||
STATIC="$UPLOAD_PATH/static"
|
||||
mkdir -p "$STATIC"
|
||||
|
||||
mkdir -p "$STATIC/build"
|
||||
cp -rf build/app "$STATIC/build/app"
|
||||
cp -rf build/engine "$STATIC/build/engine"
|
||||
cp -rf build/tools "$STATIC/build/tools"
|
||||
# avoid build/upload, since that's the folder we're building!
|
||||
|
||||
cp -f index.html "$STATIC/index.html"
|
||||
|
||||
mkdir -p "$STATIC/src/tools"
|
||||
cp -rf src/tools/testing "$STATIC/src/tools/testing"
|
||||
cp -rf src/test "$STATIC/src/test"
|
||||
cp -rf src/samples "$STATIC/src/samples"
|
||||
|
||||
builder_finish_action success prepare:downloads.keyman.com
|
||||
fi
|
||||
Loading…
Add table
Reference in a new issue