Commit 0ba9e349 authored by Manuel Moos's avatar Manuel Moos
Browse files

Merge: Integrate macOS build

Implements #87

See merge request !117
parents e2c10899 5c676c36
Pipeline #255924164 passed with stages
in 45 minutes and 5 seconds
......@@ -550,6 +550,33 @@ zeroinstall: zeroinstall.tag
#***************************************************************
# build on the mac via GitHub Actions. Requires staging.
context.macbuild: rootcontext.64 ${srcdir}/../deploy/*_macbuild.sh ${srcdir}/../deploy/wait_for_upload.sh ../deploy/* CI_INFO
${srcdir}/prepare_context.sh $@.dir $<.dir/'*' ../deploy/'*' ${srcdir}/../deploy/*_macbuild.sh ${srcdir}/../deploy/wait_for_upload.sh CI_INFO ${srcdir}/../scripts/.cache/gits/macOS
rm -f $@.dir/image
echo "armadeploy_64" > $@.dir/image
echo > $@
result.macbuild: context.macbuild
+$(srcdir)/context_to_result.sh $@.dir ./deploy_macbuild.sh
echo > $@
# only build macOS if we're not staging
macbuild: macbuild.tag
macbuild.tag: maybe_macbuild_${STAGING}.tag
touch $@
maybe_macbuild_.tag:
touch $@
maybe_macbuild_true.tag:
touch $@
maybe_macbuild_false.tag: result.macbuild upload/.tag
cp $<.dir/upload/${PROGRAM_TITLE}* upload/
# rm -rf steamdirs/steam_macOS.dir
# mkdir -p steamdirs/steam_macOS.dir
# cd steamdirs/steam_macOS.dir; unzip ../../$<.dir/upload/${STEAM_PACKAGE_NAME}-${PACKAGE_VERSION}.macOS.zip
touch $@
#***************************************************************
steamdirs/.tag:
mkdir -p steamdirs
echo > $@
......@@ -606,7 +633,7 @@ reformat.tag: result.reformat
# for testing, we want minimal builds before any deployment
# in production, the CI solution is responsible for having built
# everything not explicitly required here
deploy_base.tag: CI_pack.tag debtest.tag reformat.tag ../deploy/targets.sh
deploy_base.tag: CI_pack.tag debtest.tag reformat.tag ../deploy/targets.sh macbuild
echo > $@
deploy_base: deploy_base.tag
......
......@@ -53,6 +53,12 @@ for f in *; do
*win32.zip)
WAIT=false
;;
*-dedicated-*.dmg)
MACOS_SERVER=$f
;;
*.dmg)
MACOS_CLIENT=$f
;;
*-${PACKAGE_VERSION}.zip)
SOURCE_ZIP=$f
;;
......@@ -109,10 +115,12 @@ uri_base: ${DOWNLOAD_URI_BASE}
uri_winclient: ${WIN_CLIENT}
uri_lin64client: ${LIN64_CLIENT}
uri_lin32client: ${LIN32_CLIENT}
uri_macosclient: ${MACOS_CLIENT}
uri_winserver: ${WIN_SERVER}
uri_lin64server: ${LIN64_SERVER}
uri_lin32server: ${LIN32_SERVER}
uri_macosserver: ${MACOS_SERVER}
uri_tarsrc: ${SOURCE_TARBALL}
uri_zipsrc: ${SOURCE_ZIP}
......
#!/bin/bash
# update and push macOS build on GitHib
set +x
mv secrets/ssh ~/.ssh
rm -rf secrets/*
set -x
. ./version.sh || exit $?
. ./targets.sh || exit $?
dd=`dirname $0`
# get tarball URI, make sure it exists
TAR_FILENAME=${PACKAGE_NAME}-${PACKAGE_VERSION}.tbz
TAR_URI=${DOWNLOAD_URI_BASE_STAGING}${TAR_FILENAME}
./wait_for_upload.sh ${TAR_URI} || exit $?
trust_github || exit $?
BRANCH_BASE=${ZI_SERIES}
pushd macOS || exit $?
DEPLOY_BRANCH=deploy_${BRANCH_BASE}_${VERSION_SERIES}
# take current cached revision, put it into the deploy branch
git branch -d ${DEPLOY_BRANCH} > /dev/null 2>&1 || true
git checkout -b ${DEPLOY_BRANCH} || exit $?
git remote add upstream ${MACOS_GIT} || exit $?
STEAM_PACKAGE_NAME=retrocycles
STEAM_PACKAGE_TITLE=Retrocycles
#PACKAGE_NAME_SUFFIX="`echo ${PACKAGE_NAME} | sed -e "s,.*-,-,"`"
#PACKAGE_TITLE_SUFFIX="`echo ${PACKAGE_TITLE} | sed -e "s,.* , ,"`"
#PROGTITLE_RC="${STEAM_PACKAGE_TITLE}${PACKAGE_TITLE_SUFFIX}"
#PROGNAME_RC="${STEAM_PACKAGE_NAME}${PACKAGE_NAME_SUFFIX}"
# write new definiton file
cat > INFO <<EOF
TARBALL=${TAR_URI}
VERSION=${PACKAGE_VERSION}
BRANCH=${ZI_SERIES}
PROGTITLE_RC="${STEAM_PACKAGE_TITLE}"
PROGNAME_RC="${STEAM_PACKAGE_NAME}"
UPLOAD=${UPLOAD_SCP_BASE_STAGING}${SF_DIR}/${PACKAGE_VERSION}/macOS
EOF
cat INFO
CHANGED=`git status --short -uno | sed -e "s/^ . //"`
if test -z "${CHANGED}"; then
echo "Nothing updated."
exit 0
fi
# commit and push
git commit . -m "Update to version ${PACKAGE_VERSION}" || exit $?
if ! test ${STAGING} == true; then
git push --force --set-upstream upstream ${DEPLOY_BRANCH} || exit $?
fi
popd
# cleanup
rm -rf source upload secrets secrets.*
if test ${STAGING} == true; then
# just staging, no actual build is done
exit 0
fi
# wait for result
sleep 300
MACOS_DOWNLOAD=${DOWNLOAD_URI_BASE_STAGING}/macOS/
timeout=5
ERROR=1
while test ${timeout} -gt -1; do
if ./wait_for_upload.sh ${MACOS_DOWNLOAD}mac_is_done.txt; then
timeout=-2
ERROR=0
else
ERROR=$?
fi
timeout=$(( ${timeout} - 1 ))
done
test ${ERROR} == 0 || exit ${ERROR}
mkdir upload
for ext in dmg macOS.zip; do
for base in ${PACKAGE_NAME} ${PACKAGE_NAME}-dedicated; do #${STEAM_PACKAGE_NAME}; do
FILE=${base}-${PACKAGE_VERSION}.${ext}
curl ${MACOS_DOWNLOAD}${FILE} --fail --silent --show-error -L -o upload/${FILE} || exit $?
done
done
......@@ -163,6 +163,8 @@ def main():
if extension == ".zip":
if "source" in filename:
description="Windows Source Zip"
elif ".macOS." in filename:
description="Client macOS Zip"
else:
description="Client Windows Binary Zip for Zero Install"
mime_type="application/zip"
......
# All secrets are expected in the 'secrets' subfolder of the build directory
# current main version
VERSION_SERIES=0.2.8
# program identification
SUFFIX=`echo @prognamebase@ | sed -e s/.*-//` || exit $?
PACKAGE_NAME_BASE=`echo @prognamebase@ | sed -e s/-.*//` || exit $?
# information from CI system
SERIES=`cat CI_INFO | grep SERIES= | sed -e s/^SERIES=//` || exit $?
CI_COMMIT_REF_PROTECTED=`cat CI_INFO | grep CI_COMMIT_REF_PROTECTED= | sed -e s/^CI_COMMIT_REF_PROTECTED=//` || exit $?
CI_COMMIT_SHA=`cat CI_INFO | grep CI_COMMIT_SHA= | sed -e s/^CI_COMMIT_SHA=//` || exit $?
......@@ -21,19 +26,19 @@ test -z ${SUFFIX} && exit 1
case ${SERIES}+${SUFFIX}+@version@ in
CURRENT+armagetronad+*_rc_*)
SF_DIR="rc/${YEAR}"
LP_SERIES="0.2.8"
LP_SERIES="${VERSION_SERIES}"
ZI_SERIES="rc"
STEAM_BRANCH="staging"
;;
CURRENT+armagetronad+*)
SF_DIR="stable"
LP_SERIES="0.2.8"
LP_SERIES="${VERSION_SERIES}"
ZI_SERIES="stable"
STEAM_BRANCH="staging"
;;
CURRENT+beta+*)
SF_DIR="beta/${YEAR}"
LP_SERIES="0.2.8-snapshots"
LP_SERIES="${VERSION_SERIES}-snapshots"
ZI_SERIES="beta"
STEAM_BRANCH="beta"
;;
......@@ -144,8 +149,9 @@ fi
# **********************************************************************
UPLOAD_SCP_BASE_STAGING=arma0install@builder.armagetronad.org:/home/arma0install/staging/
if test ${STAGING} == true; then
UPLOAD_SCP_BASE=arma0install@builder.armagetronad.org:/home/arma0install/staging/
UPLOAD_SCP_BASE=${UPLOAD_SCP_BASE_STAGING}
else
UPLOAD_SCP_BASE=bazaaarmagetron,armagetronad@frs.sourceforge.net:/home/frs/project/a/ar/armagetronad/
fi
......@@ -184,9 +190,10 @@ ZI_GIT=git@gitlab.com:armagetronad/zeroinstall.git
UPLOAD_ZI_SCP=arma0install@builder.armagetronad.org:/home/arma0install/0install/
#UPLOAD_ZI_SCP=arma0install@builder.armagetronad.org:/home/arma0install/0install-staging/
DOWNLOAD_URI_BASE_STAGING=http://download.armagetronad.org/staging/${SF_DIR}/@version@/
if test ${STAGING} == true; then
# download URI base to use for zeroinstall
DOWNLOAD_URI_BASE=http://download.armagetronad.org/staging/${SF_DIR}/@version@/
# download URI base to use for zeroinstall staging and macOS builds
DOWNLOAD_URI_BASE=${DOWNLOAD_URI_BASE_STAGING}
elif test "${SF_DIR}" == "stable"; then
# only stable builds go to launchpad permanently
DOWNLOAD_URI_BASE=https://launchpad.net/${LP_PROJECT}/${LP_SERIES}/${LP_VERSION}/+download/
......@@ -197,6 +204,11 @@ fi
# **********************************************************************
# macOS build: Git reporitory on GitHub with appropriate Action to build
MACOS_GIT=git@github.com:ArmagetronAd/macOS.git
# **********************************************************************
# download site: git repository
DOWNLOAD_SITE_GIT=git@gitlab.com:armagetronad/downloads.git
......@@ -218,6 +230,14 @@ cat >> ~/.ssh/known_hosts <<EOF
EOF
}
function trust_github(){
# GitHub's ssh host keys
cat >> ~/.ssh/known_hosts <<EOF
|1|KRA9jEjogp3RGFX3U2SESqtUkKw=|EeIeiAjDuOEvmm0CING5gnKeKDo= ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ==
|1|FEIACzRx2yRt3VP2h1VHVlmFUi4=|wOwfBt2ioSBsskNq5n1BykyN6rs= ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ==
EOF
}
# requires both the ssh and gpg keys
# **********************************************************************
......
......@@ -32,6 +32,7 @@ function ensure_git(){
return 0
}
ensure_git macOS https://github.com/ArmagetronAd/macOS.git || exit $?
ensure_git winlibs https://gitlab.com/armagetronad/winlibs.git || exit $?
ensure_git codeblocks https://gitlab.com/armagetronad/build_codeblocks.git || exit $?
ensure_git ubuntu https://gitlab.com/armagetronad/ubuntu-packaging.git ${UBUNTU_BRANCH} || exit $?
......
......@@ -18,6 +18,7 @@ function fix_gits(){
set -x
fix_git macOS c77e2d9a24e48f36f1ddab7c76f140e7f145ccf1 || return $?
fix_git winlibs d03e20bf8973a6cbd1e0ecb47dd8333c5614b139 || return $?
fix_git codeblocks 5ab4c626eb7cfa692a0bda7dbf26fed3721e4aa3 || return $?
fix_git ubuntu c4910e573fefd62f8241d4a484482ab8bb205b4d || return $?
......
......@@ -47,6 +47,7 @@ function fix_gits(){
EOF
fix_git macOS
fix_git winlibs
fix_git codeblocks
fix_git ubuntu
......
......@@ -35,7 +35,7 @@ DESTDIR="${BUNDLE}" make install || exit $?
(cd "${BUNDLE}"; dylibbundler -od -b -x "./@prefix@/bin/@progname@" -d "./@prefix@/libs/") || exit $?
# zip
(cd "${BUNDLE}" && zip -r ../@progname@-@version@.zip .) || exit $?
(cd "${BUNDLE}" && zip -r ../@progname@-@version@.macOS.zip .) || exit $?
# pack dmg
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment