CI: make the release script more flexible

This commit is contained in:
Adriaan de Groot 2019-04-15 09:52:43 -04:00
parent 189b33a376
commit 094110dccf

View File

@ -15,30 +15,52 @@
# - 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=.)
rm -rf "$BUILDDIR"
mkdir "$BUILDDIR" || { echo "Could not create build directory." ; exit 1 ; } ### Build with default compiler
( cd "$BUILDDIR" && cmake .. && make -j4 ) || { echo "Could not perform test-build." ; exit 1 ; } #
( cd "$BUILDDIR" && make test ) || { echo "Tests failed." ; exit 1 ; } #
if test "x$BUILD_DEFAULT" = "xtrue" ; then
rm -rf "$BUILDDIR"
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" && make test ) || { echo "Tests failed." ; exit 1 ; }
fi
### Build with clang ### Build with clang
# #
# #
if which clang++ > /dev/null 2>&1 ; then if test "x$BUILD_CLANG" = "xtrue" ; then
# Do build again with clang if which clang++ > /dev/null 2>&1 ; then
rm -rf "$BUILDDIR" # Do build again with clang
mkdir "$BUILDDIR" || { echo "Could not create build directory." ; exit 1 ; } rm -rf "$BUILDDIR"
( cd "$BUILDDIR" && CC=clang CXX=clang++ cmake .. && make -j4 ) || { echo "Could not perform test-build." ; exit 1 ; } mkdir "$BUILDDIR" || { echo "Could not create build directory." ; exit 1 ; }
( cd "$BUILDDIR" && make test ) || { echo "Tests failed." ; 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 ; }
fi
fi
if test "x$BUILD_ONLY" = "xtrue" ; then
echo "Builds completed, release stopped."
exit 1
fi fi
### Get version number for this release ### Get version number for this release