Skip to content

Commit

Permalink
Fix macOS/Linux builds (Mudlet#3537)
Browse files Browse the repository at this point in the history
* Fix macOS/Linux builds

* Take out exit call from validation
  • Loading branch information
vadi2 authored Mar 28, 2020
1 parent 31d4c40 commit c372136
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 50 deletions.
4 changes: 2 additions & 2 deletions CI/travis.osx.after_success.sh
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,10 @@ if [ "${DEPLOY}" = "deploy" ]; then

if [ "${public_test_build}" == "true" ]; then
echo "=== Creating release in Dblsqd ==="
dblsqd release -a mudlet -c public-test-build -m "(test release message here)" "${VERSION,,}${MUDLET_VERSION_BUILD,,}"
dblsqd release -a mudlet -c public-test-build -m "(test release message here)" "${VERSION}${MUDLET_VERSION_BUILD}"

echo "=== Registering release with Dblsqd ==="
dblsqd push -a mudlet -c public-test-build -r "${VERSION,,}${MUDLET_VERSION_BUILD,,}" -s mudlet --type "standalone" --attach mac:x86_64 "${DEPLOY_URL}"
dblsqd push -a mudlet -c public-test-build -r "${VERSION}${MUDLET_VERSION_BUILD}" -s mudlet --type "standalone" --attach mac:x86_64 "${DEPLOY_URL}"
else
echo "=== Registering release with Dblsqd ==="
dblsqd push -a mudlet -c release -r "${VERSION}" -s mudlet --type "standalone" --attach mac:x86_64 "${DEPLOY_URL}"
Expand Down
7 changes: 4 additions & 3 deletions CI/travis.set-build-info.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ if [ -z "${TRAVIS_TAG}" ]; then
fi
fi

# not all systems we deal with allow uppercase ascii characters
MUDLET_VERSION_BUILD="${MUDLET_VERSION_BUILD,,}"

VERSION=""

if [ "${Q_OR_C_MAKE}" = "cmake" ]; then
Expand All @@ -29,5 +26,9 @@ elif [ "${Q_OR_C_MAKE}" = "qmake" ]; then
VERSION=$(perl -lne 'print $1 if /^VERSION = (.+)/' < "${TRAVIS_BUILD_DIR}/src/mudlet.pro")
fi

# not all systems we deal with allow uppercase ascii characters
MUDLET_VERSION_BUILD=$(echo "$MUDLET_VERSION_BUILD" | tr '[:upper:]' '[:lower:]')
VERSION=$(echo "$VERSION" | tr '[:upper:]' '[:lower:]')

export VERSION
export MUDLET_VERSION_BUILD
92 changes: 47 additions & 45 deletions CI/travis.validate_deployment.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,49 +2,51 @@

if [ -z "${TRAVIS_TAG}" ]; then
echo "Not a release build - skipping release validation."
exit 0
# don't use exit here:
# https://docs.travis-ci.com/user/job-lifecycle#how-does-this-work-or-why-you-should-not-use-exit-in-build-steps
else

error() {
# shellcheck disable=SC2059
printf "error: $1\n" "${@:2}" >&2
exit 1
}

function validate_qmake() {
local VALID_QMAKE VALID_BUILD

VALID_QMAKE=$(pcregrep --only-matching=1 "^VERSION ? = ?(\d+\.\d+\.\d+)$" < src/mudlet.pro)
if [ -z "${VALID_QMAKE}" ]; then
error "mudlet.pro's VERSION variable isn't formatted following the semantic versioning rules in a release build."
fi

VALID_BUILD=$(pcregrep --only-matching=1 ' +BUILD ? = ? ("")' < src/mudlet.pro)
if [ "${VALID_BUILD}" != '""' ]; then
error "mudlet.pro's BUILD variable isn't set to \"\" as it should be in a release build."
fi
}

function validate_cmake() {
local VALID_CMAKE VALID_BUILD
VALID_CMAKE=$(pcregrep --only-matching=1 "set\(APP_VERSION (\d+\.\d+\.\d+)\)$" < CMakeLists.txt)

if [ -z "${VALID_CMAKE}" ]; then
error "CMakeLists.txt VERSION variable isn't formatted following the semantic versioning rules in a release build."
fi

VALID_BUILD=$(pcregrep --only-matching=1 'set\(APP_BUILD ("")\)$' < CMakeLists.txt)
if [ "${VALID_BUILD}" != '""' ]; then
error "CMakeLists.txt APP_BUILD variable isn't set to \"\" as it should be in a release build."
fi
}

function validate_updater_environment_variable() {
if [ "$WITH_UPDATER" == "NO" ]; then
error "Updater is disabled in a release build."
fi
}

validate_qmake
validate_cmake
validate_updater_environment_variable
fi

error() {
# shellcheck disable=SC2059
printf "error: $1\n" "${@:2}" >&2
exit 1
}

function validate_qmake() {
local VALID_QMAKE VALID_BUILD

VALID_QMAKE=$(pcregrep --only-matching=1 "^VERSION ? = ?(\d+\.\d+\.\d+)$" < src/mudlet.pro)
if [ -z "${VALID_QMAKE}" ]; then
error "mudlet.pro's VERSION variable isn't formatted following the semantic versioning rules in a release build."
fi

VALID_BUILD=$(pcregrep --only-matching=1 ' +BUILD ? = ? ("")' < src/mudlet.pro)
if [ "${VALID_BUILD}" != '""' ]; then
error "mudlet.pro's BUILD variable isn't set to \"\" as it should be in a release build."
fi
}

function validate_cmake() {
local VALID_CMAKE VALID_BUILD
VALID_CMAKE=$(pcregrep --only-matching=1 "set\(APP_VERSION (\d+\.\d+\.\d+)\)$" < CMakeLists.txt)

if [ -z "${VALID_CMAKE}" ]; then
error "CMakeLists.txt VERSION variable isn't formatted following the semantic versioning rules in a release build."
fi

VALID_BUILD=$(pcregrep --only-matching=1 'set\(APP_BUILD ("")\)$' < CMakeLists.txt)
if [ "${VALID_BUILD}" != '""' ]; then
error "CMakeLists.txt APP_BUILD variable isn't set to \"\" as it should be in a release build."
fi
}

function validate_updater_environment_variable() {
if [ "$WITH_UPDATER" == "NO" ]; then
error "Updater is disabled in a release build."
fi
}

validate_qmake
validate_cmake
validate_updater_environment_variable

0 comments on commit c372136

Please sign in to comment.