CI: make the release script more flexible

main
Adriaan de Groot 6 years ago
parent 189b33a376
commit 094110dccf

@ -15,24 +15,40 @@
# - pulling translations # - pulling translations
# - updating the language list # - updating the language list
# - switching to the right branch # - switching to the right branch
#
# You can influence the script a little with environment variables:
# - BUILD_DEFAULT set to false to avoid first build with gcc
# - BUILD_CLANG set to false to avoid second build with clang
# - BUILD_ONLY set to true to break after building
test -d .git || { echo "Not at top-level." ; exit 1 ; } test -d .git || { echo "Not at top-level." ; exit 1 ; }
test -d src/modules || { echo "No src/modules." ; exit 1 ; } test -d src/modules || { echo "No src/modules." ; exit 1 ; }
which cmake > /dev/null 2>&1 || { echo "No cmake(1) available." ; exit 1 ; } which cmake > /dev/null 2>&1 || { echo "No cmake(1) available." ; exit 1 ; }
### Build with default compiler test -z "$BUILD_DEFAULT" && BUILD_DEFAULT=true
test -z "$BUILD_CLANG" && BUILD_CLANG=true
test -z "$BUILD_ONLY" && BUILD_ONLY=false
### Setup
# #
# #
BUILDDIR=$(mktemp -d --suffix=-build --tmpdir=.) BUILDDIR=$(mktemp -d --suffix=-build --tmpdir=.)
### Build with default compiler
#
#
if test "x$BUILD_DEFAULT" = "xtrue" ; then
rm -rf "$BUILDDIR" rm -rf "$BUILDDIR"
mkdir "$BUILDDIR" || { echo "Could not create build directory." ; exit 1 ; } mkdir "$BUILDDIR" || { echo "Could not create build directory." ; exit 1 ; }
( cd "$BUILDDIR" && cmake .. && make -j4 ) || { echo "Could not perform test-build." ; exit 1 ; } ( cd "$BUILDDIR" && cmake .. && make -j4 ) || { echo "Could not perform test-build." ; exit 1 ; }
( cd "$BUILDDIR" && make test ) || { echo "Tests failed." ; exit 1 ; } ( cd "$BUILDDIR" && make test ) || { echo "Tests failed." ; exit 1 ; }
fi
### Build with clang ### Build with clang
# #
# #
if test "x$BUILD_CLANG" = "xtrue" ; then
if which clang++ > /dev/null 2>&1 ; then if which clang++ > /dev/null 2>&1 ; then
# Do build again with clang # Do build again with clang
rm -rf "$BUILDDIR" rm -rf "$BUILDDIR"
@ -40,6 +56,12 @@ if which clang++ > /dev/null 2>&1 ; then
( cd "$BUILDDIR" && CC=clang CXX=clang++ cmake .. && make -j4 ) || { echo "Could not perform test-build." ; exit 1 ; } ( cd "$BUILDDIR" && CC=clang CXX=clang++ cmake .. && make -j4 ) || { echo "Could not perform test-build." ; exit 1 ; }
( cd "$BUILDDIR" && make test ) || { echo "Tests failed." ; exit 1 ; } ( cd "$BUILDDIR" && make test ) || { echo "Tests failed." ; exit 1 ; }
fi fi
fi
if test "x$BUILD_ONLY" = "xtrue" ; then
echo "Builds completed, release stopped."
exit 1
fi
### Get version number for this release ### Get version number for this release
# #

Loading…
Cancel
Save