diff options
-rw-r--r-- | .travis.yml | 9 | ||||
-rwxr-xr-x | tools/report-progress.sh | 46 | ||||
-rwxr-xr-x | tools/travis-install-qt-windows.sh | 27 |
3 files changed, 74 insertions, 8 deletions
diff --git a/.travis.yml b/.travis.yml index 7e0084fcc2..44653e58a2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -107,14 +107,7 @@ before_install: # Workaround to avoid using perl from git-bash $PATH which lacks modules such as Pod::Usage export CMAKE_PROGRAM_PATH=C:/Strawberry/perl/bin fi - - | - if [ "$TRAVIS_OS_NAME" == "windows" ] && [ ! -e "$QT5_BASE_DIR/bin/moc.exe" ]; then - curl -vLo ~/qt-unified-windows-x86-online.exe http://download.qt.io/official_releases/online_installers/qt-unified-windows-x86-online.exe - if ! ~/qt-unified-windows-x86-online.exe --verbose --script tools/qt-installer-windows.qs > ~/qt-installer-output.txt; then - cat ~/qt-installer-output.txt; exit 1 - fi - du -sm "$QT5_BASE_DIR" - fi + - if [ "$TRAVIS_OS_NAME" == "windows" ]; then tools/travis-install-qt-windows.sh; fi # all platforms - pip3 install pytest pytest-xdist before_script: diff --git a/tools/report-progress.sh b/tools/report-progress.sh new file mode 100755 index 0000000000..c947fba5fa --- /dev/null +++ b/tools/report-progress.sh @@ -0,0 +1,46 @@ +#!/bin/bash +# Reads stdin and periodically report the most recently seen output. +# +# Copyright (C) 2019 Peter Wu <peter@lekensteyn.nl> +# SPDX-License-Identifier: GPL-2.0-or-later +# +# Like "travis_wait", it prevents a build timeout due to lack of progress. +# Additionally: +# - During execution it reports the most recent line instead of some fixed text. +# - It does not write the full output at the end of execution. +# - It does not impose a command timeout. + +set -eu + +# Default to a 60 seconds interval between printing messages. +PERIOD=${1:-60} + +nexttime=$PERIOD +msg= +count=0 + +# Reset timer (SECONDS is a special Bash variable). +SECONDS=0 + +while true; do + # Periodically report the last read line. + timeleft=$((nexttime-SECONDS)) + while [ $timeleft -le 0 ]; do + ((nexttime+=PERIOD)) + ((timeleft+=PERIOD)) + printf "[progress] %3d %s\n" $SECONDS "${msg:-(no output)}" + msg= + done + + if read -r -t $timeleft line; then + # Save line for later. + ((count+=1)) + msg="Line $count: $line" + continue + elif [ $? -le 128 ]; then + # EOF (as opposed to a timeout) + [ -z "$msg" ] || printf "[progress] %3d %s\n" $SECONDS "$msg" + printf "[progress] %3d done (read %d lines).\n" $SECONDS $count + break + fi +done diff --git a/tools/travis-install-qt-windows.sh b/tools/travis-install-qt-windows.sh new file mode 100755 index 0000000000..a94a0ae6a8 --- /dev/null +++ b/tools/travis-install-qt-windows.sh @@ -0,0 +1,27 @@ +#!/bin/bash +# Installs Qt on Windows for Travis CI. +# +# Copyright (C) 2019 Peter Wu <peter@lekensteyn.nl> +# SPDX-License-Identifier: GPL-2.0-or-later + +set -eu -o pipefail + +if [ -e "$QT5_BASE_DIR/bin/moc.exe" ]; then + echo "Found an existing Qt installation at $QT5_BASE_DIR" + exit +fi + +echo "Downloading the installer..." +# https is of no use if it redirects to a http mirror... +curl -vLo ~/qt-unified-windows-x86-online.exe http://download.qt.io/official_releases/online_installers/qt-unified-windows-x86-online.exe + +echo "Installing..." +# Run installer and save the installer output. To avoid hitting the timeout, +# periodically print some progress. On error, show the full log and abort. +~/qt-unified-windows-x86-online.exe --verbose --script tools/qt-installer-windows.qs | + tee ~/qt-installer-output.txt | + tools/report-progress.sh || + (cat ~/qt-installer-output.txt; exit 1) + +printf 'Installation size: ' +du -sm "$QT5_BASE_DIR" |