CI: allow no-testing on the release tarball

This commit is contained in:
Adriaan de Groot 2022-05-21 13:26:30 +02:00
parent 8466d1eb3e
commit 72f25f24ef

View File

@ -27,11 +27,13 @@
# * `-B` do not build (before tagging) # * `-B` do not build (before tagging)
# * `-P` do not package (tag, sign, tarball) # * `-P` do not package (tag, sign, tarball)
# * `-T` do not respect string freeze # * `-T` do not respect string freeze
# * '-b' do not build-and-test tarball
# #
# The build / package settings can be influenced via environment variables: # The build / package settings can be influenced via environment variables:
# * BUILD_DEFAULT set to `false` to avoid first build with gcc # * BUILD_DEFAULT set to `false` to avoid first build with gcc
# * BUILD_CLANG set to `false` to avoid second build with clang # * BUILD_CLANG set to `false` to avoid second build with clang
# * BUILD_ONLY set to `true` to break after building # * BUILD_ONLY set to `true` to break after building
# * TEST_TARBALL set to 'false' to skip build-and-test phase after tarring
# #
### END USAGE ### END USAGE
@ -43,9 +45,10 @@ which cmake > /dev/null 2>&1 || { echo "No cmake(1) available." ; exit 1 ; }
test -z "$BUILD_DEFAULT" && BUILD_DEFAULT=true test -z "$BUILD_DEFAULT" && BUILD_DEFAULT=true
test -z "$BUILD_CLANG" && BUILD_CLANG=true test -z "$BUILD_CLANG" && BUILD_CLANG=true
test -z "$BUILD_ONLY" && BUILD_ONLY=false test -z "$BUILD_ONLY" && BUILD_ONLY=false
test -z "$TEST_TARBALL" && TEST_TARBALL=true
STRING_FREEZE=true STRING_FREEZE=true
while getopts "hBPT" opt ; do while getopts "hBbPT" opt ; do
case "$opt" in case "$opt" in
h|\?) h|\?)
sed -e '1,/USAGE/d' -e '/END.USAGE/,$d' < "$0" sed -e '1,/USAGE/d' -e '/END.USAGE/,$d' < "$0"
@ -55,6 +58,9 @@ while getopts "hBPT" opt ; do
BUILD_DEFAULT=false BUILD_DEFAULT=false
BUILD_CLANG=false BUILD_CLANG=false
;; ;;
b)
TEST_TARBALL=false
;;
P) P)
BUILD_ONLY=true BUILD_ONLY=true
;; ;;
@ -142,12 +148,14 @@ SHA256=$(sha256sum "$TAR_FILE" | cut -d" " -f1)
### Build the tarball ### Build the tarball
# #
# #
D=$(date +%Y%m%d-%H%M%S) if test "x$TEST_TARBALL" = "xtrue" ; then
TMPDIR=$(mktemp -d ./cala-tar-XXXXXX) D=$(date +%Y%m%d-%H%M%S)
test -d "$TMPDIR" || { echo "Could not create tarball-build directory." ; exit 1 ; } TMPDIR=$(mktemp -d ./cala-tar-XXXXXX)
tar xzf "$TAR_FILE" -C "$TMPDIR" || { echo "Could not unpack tarball." ; exit 1 ; } test -d "$TMPDIR" || { echo "Could not create tarball-build directory." ; exit 1 ; }
test -d "$TMPDIR/$TAR_V" || { echo "Tarball did not contain source directory." ; exit 1 ; } tar xzf "$TAR_FILE" -C "$TMPDIR" || { echo "Could not unpack tarball." ; exit 1 ; }
( cd "$TMPDIR/$TAR_V" && cmake . && make -j4 && make test ) || { echo "Tarball build failed in $TMPDIR ." ; exit 1 ; } test -d "$TMPDIR/$TAR_V" || { echo "Tarball did not contain source directory." ; exit 1 ; }
( cd "$TMPDIR/$TAR_V" && cmake . && make -j4 && make test ) || { echo "Tarball build failed in $TMPDIR ." ; exit 1 ; }
fi
gpg -s -u $KEY_ID --detach --armor $TAR_FILE # Sign the tarball gpg -s -u $KEY_ID --detach --armor $TAR_FILE # Sign the tarball
### Cleanup ### Cleanup