backup-utils/script/cibuild

51 строка
1.3 KiB
Bash
Executable File

#!/usr/bin/env bash
# Usage: script/cibuild [--no-package]
set -e
# Enable verbose logging of ssh commands
export GHE_VERBOSE_SSH=true
if ! find test -name "test-*.sh" -print0 | xargs -0 -n 1 /bin/bash; then
exit 1
fi
# Bail out when --no-package given
[ "$1" = "--no-package" ] && exit 0
# files we'll md5sum at the end
pkg_files=
# Build the tarball
ROOTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )"
TMPDIR="$ROOTDIR/test/tmp"
echo "Building tar.gz package ..."
if script/package-tarball 1>$TMPDIR/package-tarball.txt 2>&1; then
pkg_files=$(grep '^Package ' < $TMPDIR/package-tarball.txt | cut -f 2 -d ' ')
else
echo "Packaging tar.gz failed:"
cat $TMPDIR/package-tarball.txt | sed 's/^/ /' 1>&2
exit 1
fi
# Skip deb packaging if debuild not installed
if ! type debuild 1>/dev/null 2>&1; then
echo "debuild not installed, skipping deb packaging ..."
exit 0
fi
# Build the deb related packages
echo "Building deb package ..."
if DEB_BUILD_OPTIONS=nocheck script/package-deb 1>$TMPDIR/package-deb-out.txt 2>$TMPDIR/package-deb-err.txt; then
pkg_files="$pkg_files $(cat $TMPDIR/package-deb-out.txt)"
else
echo "Package build failed:"
cat $TMPDIR/package-deb-out.txt $TMPDIR/package-deb-err.txt >&2
echo >&2
cat dist/debuild/github-backup-utils*.build >&2
exit 1
fi
# Generate md5sums
md5sum $pkg_files