Skip to content

Commit

Permalink
Deploy mac ci builds (Mudlet#829)
Browse files Browse the repository at this point in the history
* Add after_success scripts for deployment

* Some fixes to installer creation process

* Add transfer.sh deployment for macOS installers

* Make end output a little nicer and echo deploy URL

* Add gitter notification to after_success hook

* Adapt travis.osx.after_succes.sh to latest installer changes

* Add everything needed for tag deployment

* Fix shellcheck warnings

* Avoid building the installer if the build repo is not "Mudlet/Mudlet"
  • Loading branch information
keneanung authored Apr 3, 2017
1 parent 49246d2 commit 3b9b6ee
Show file tree
Hide file tree
Showing 6 changed files with 82 additions and 11 deletions.
17 changes: 10 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,17 @@ compiler:
- gcc
- clang
env:
- Q_OR_C_MAKE=qmake
matrix:
- Q_OR_C_MAKE=cmake
- Q_OR_C_MAKE=qmake
global:
- secure: VFI3UCiDrp47WTcUhsatdQvvWg+3gk00eBMZgSOXXKY5+hk+NOX7bOFcIM5t9nlZDbpHDr10SFTuUOw+PeWmLpFO06Zrjg86M9jm9WS4i8Cs9hfxoT6H4isXlR1vubX2LmNlHyzg8WtdNanlsufgecyaGksJxr7tVhG/cWyD6yo=
matrix:
# Something goes wrong internally in Qt (5.0.2) for CMake Clang builds on Linux
allow_failures:
- os: linux
compiler: clang
env: Q_OR_C_MAKE=cmake
allow_failures:
- os: linux
compiler: clang
env: Q_OR_C_MAKE=cmake

before_install: ./CI/travis.before_install.sh
install: ./CI/travis.install.sh
Expand All @@ -28,8 +31,8 @@ script:
- if [ "${TRAVIS_OS_NAME}" = "osx" ]; then export LDFLAGS=" -L/usr/local/opt/qt5/lib ${LDFLAGS}"; export CPPFLAGS=" -I/usr/local/opt/qt5/include ${CPPFLAGS}"; fi
- if [ "${Q_OR_C_MAKE}" = "qmake" ]; then qmake -v; qmake ../src/src.pro && make -j2; else cmake --version; cmake .. && make -j2 && make check; fi
after_success:
# use variables from the set-build-info above
- echo "Finished building Mudlet ${VERSION}${BUILD}"
- cd ${TRAVIS_BUILD_DIR}
- bash CI/travis.after_success.sh
notifications:
webhooks:
urls:
Expand Down
Binary file added CI/mudlet-deploy-key.enc
Binary file not shown.
30 changes: 30 additions & 0 deletions CI/travis.after_success.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash

if [ "${TRAVIS_REPO_SLUG}" != "Mudlet/Mudlet" ]; then
exit 0
fi

if [ -z "${TRAVIS_OS_NAME}" ] || [ "${TRAVIS_OS_NAME}" = "linux" ]; then
echo Deploy on linux.
. CI/travis.linux.after_success.sh;
fi
if [ "${TRAVIS_OS_NAME}" = "osx" ]; then
echo Deploy on OSX.
. CI/travis.osx.after_success.sh;
fi

if [ ! -z "${DEPLOY_URL}" ]; then
curl \
--data-urlencode "message=Deployed Mudlet \`${VERSION}${BUILD}\` (${TRAVIS_OS_NAME}) to [${DEPLOY_URL}](${DEPLOY_URL})" \
https://webhooks.gitter.im/e/cc99072d43b642c4673a
fi

echo ""
echo "******************************************************"
echo ""
echo "Finished building Mudlet ${VERSION}${BUILD}"
if [ ! -z "${DEPLOY_URL}" ]; then
echo "Deployed the output to ${DEPLOY_URL}"
fi
echo ""
echo "******************************************************"
Empty file.
38 changes: 38 additions & 0 deletions CI/travis.osx.after_success.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/bin/bash

set -e

# we deploy only qmake and clang combination for macOS
if [ "${Q_OR_C_MAKE}" = "qmake" ] && [ "${CC}" = "clang" ]; then
git clone https://github.com/Mudlet/installers.git "${TRAVIS_BUILD_DIR}/../installers"

cd "${TRAVIS_BUILD_DIR}/../installers/osx"

ln -s "${TRAVIS_BUILD_DIR}" source

if [ -z "${TRAVIS_TAG}" ]; then
appBaseName="Mudlet-${VERSION}${BUILD}"
mv "source/build/Mudlet.app" "source/build/${appBaseName}.app"

bash make-installer.sh "${appBaseName}.app"

DEPLOY_URL=$(wget --method PUT --body-file="${HOME}/Desktop/${appBaseName}.dmg" "https://transfer.sh/${appBaseName}.dmg" -O - -q)
else

# add ssh-key to ssh-agent for deployment
# shellcheck disable=2154
# the two "undefined" variables are defined by travis
openssl aes-256-cbc -K "${encrypted_70dbe4c5e427_key}" -iv "${encrypted_70dbe4c5e427_iv}" -in "${TRAVIS_BUILD_DIR}/CI/mudlet-deploy-key.enc" -out /tmp/mudlet-deploy-key -d
eval "$(ssh-agent -s)"
chmod 600 /tmp/mudlet-deploy-key
ssh-add /tmp/mudlet-deploy-key

bash make-installer.sh -r "${VERSION}" source/build/Mudlet.app

mv "${HOME}/Desktop/Mudlet.dmg" "${HOME}/Desktop/Mudlet-${VERSION}.dmg"

DEPLOY_URL=$(scp -i /tmp/mudlet-deploy-key "${HOME}/Desktop/Mudlet-${VERSION}.dmg" "keneanung@mudlet.org:${DEPLOY_PATH}")
fi
export DEPLOY_URL
fi

8 changes: 4 additions & 4 deletions CI/travis.set-build-info.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ fi
VERSION=""

if [ "${Q_OR_C_MAKE}" = "cmake" ]; then
VERSION=$(perl -lne 'print $1 if /^SET\(APP_VERSION (.+)\)/' < ${TRAVIS_BUILD_DIR}/CMakeLists.txt)
perl -pi -e "s/SET\(APP_BUILD \"-dev\"\)/SET(APP_BUILD \"${BUILD}\")/" ${TRAVIS_BUILD_DIR}/CMakeLists.txt
VERSION=$(perl -lne 'print $1 if /^SET\(APP_VERSION (.+)\)/' < "${TRAVIS_BUILD_DIR}/CMakeLists.txt")
perl -pi -e "s/SET\(APP_BUILD \"-dev\"\)/SET(APP_BUILD \"${BUILD}\")/" "${TRAVIS_BUILD_DIR}/CMakeLists.txt"
elif [ "${Q_OR_C_MAKE}" = "qmake" ]; then
VERSION=$(perl -lne 'print $1 if /^VERSION = (.+)/' < ${TRAVIS_BUILD_DIR}/src/src.pro)
perl -pi -e "s/BUILD = -dev/BUILD = ${BUILD}/" ${TRAVIS_BUILD_DIR}/src/src.pro
VERSION=$(perl -lne 'print $1 if /^VERSION = (.+)/' < "${TRAVIS_BUILD_DIR}/src/src.pro")
perl -pi -e "s/BUILD = -dev/BUILD = ${BUILD}/" "${TRAVIS_BUILD_DIR}/src/src.pro"
fi

export VERSION
Expand Down

0 comments on commit 3b9b6ee

Please sign in to comment.