phpseclib/tests/code_coverage_upload.sh

45 lines
1.1 KiB
Bash
Executable File

#!/bin/sh
#
# This file is part of the phpseclib test suite.
#
# (c) Andreas Fischer <bantu@phpbb.com>
#
# For the full copyright and license information, please view the LICENSE
# file that was distributed with this source code.
#
USERNAME='phpseclib'
HOSTNAME='phpseclib.bantux.org'
LDIRNAME='code_coverage'
RDIRNAME='code_coverage'
ID_RSA='tests/code_coverage_id_rsa'
if ! which expect > /dev/null
then
sudo apt-get update -qq
sudo apt-get install -qq expect
fi
# Workaround for rsync not creating target directories with depth > 1
mv "$LDIRNAME" "x$LDIRNAME"
mkdir -p "$RDIRNAME/$TRAVIS_BUILD_NUMBER"
mv "x$LDIRNAME" "$RDIRNAME/$TRAVIS_BUILD_NUMBER/$TRAVIS_JOB_NUMBER/"
# Stop complaints about world-readable key file.
chmod 600 "$ID_RSA"
export RSYNC_RSH="ssh -4 -i $ID_RSA -o ConnectTimeout=5"
RSYNC_OPT="--recursive --times --progress"
expect << EOF
spawn rsync $RSYNC_OPT "$RDIRNAME/" "$USERNAME@$HOSTNAME:$RDIRNAME/"
expect "RSA key fingerprint is 09:40:96:14:6a:cd:67:46:17:e5:b4:39:24:24:6e:9d."
send "yes\n"
expect "Enter passphrase for key '$ID_RSA':"
send "$CODE_COVERAGE_PASSPHRASE\n"
expect eof
EOF