cibuild.sh 2.57 KB
Newer Older
1 2
#!/bin/sh

3
if [ -n "$COVERITY" ];
Ben Straub committed
4 5 6 7 8
then
	./script/coverity.sh;
	exit $?;
fi

9 10 11 12 13
# Should we ask Travis to cache this file?
curl -L https://github.com/ethomson/poxyproxy/releases/download/v0.1.0/poxyproxy-0.1.0.jar >poxyproxy.jar || exit $?
# Run this early so we know it's ready by the time we need it
java -jar poxyproxy.jar -d --port 8080 --credentials foo:bar &

14 15 16 17 18 19 20 21 22 23 24 25
mkdir _build
cd _build
# shellcheck disable=SC2086
cmake .. -DCMAKE_INSTALL_PREFIX=../_install $OPTIONS || exit $?
make -j2 install || exit $?

# If this platform doesn't support test execution, bail out now
if [ -n "$SKIP_TESTS" ];
then
	exit $?;
fi

26
# Create a test repo which we can use for the online::push tests
27 28 29
mkdir "$HOME"/_temp
git init --bare "$HOME"/_temp/test.git
git daemon --listen=localhost --export-all --enable=receive-pack --base-path="$HOME"/_temp "$HOME"/_temp 2>/dev/null &
30 31
export GITTEST_REMOTE_URL="git://localhost/test.git"

32
# Run the test suite
33
ctest -V -R libgit2_clar || exit $?
34 35 36 37 38

# Now that we've tested the raw git protocol, let's set up ssh to we
# can do the push tests over it

killall git-daemon
39 40 41 42 43

if [ "$TRAVIS_OS_NAME" = "osx" ]; then
    echo 'PasswordAuthentication yes' | sudo tee -a /etc/sshd_config
fi

44 45 46 47
ssh-keygen -t rsa -f ~/.ssh/id_rsa -N "" -q
cat ~/.ssh/id_rsa.pub >>~/.ssh/authorized_keys
ssh-keyscan -t rsa localhost >>~/.ssh/known_hosts

48 49 50
# Get the fingerprint for localhost and remove the colons so we can parse it as a hex number
export GITTEST_REMOTE_SSH_FINGERPRINT=$(ssh-keygen -F localhost -l | tail -n 1 | cut -d ' ' -f 2 | tr -d ':')

51 52 53 54 55 56
export GITTEST_REMOTE_URL="ssh://localhost/$HOME/_temp/test.git"
export GITTEST_REMOTE_USER=$USER
export GITTEST_REMOTE_SSH_KEY="$HOME/.ssh/id_rsa"
export GITTEST_REMOTE_SSH_PUBKEY="$HOME/.ssh/id_rsa.pub"
export GITTEST_REMOTE_SSH_PASSPHRASE=""

57

58
if [ -e ./libgit2_clar ]; then
59
    ./libgit2_clar -sonline::push -sonline::clone::ssh_cert &&
60
    ./libgit2_clar -sonline::clone::ssh_with_paths || exit $?
61
    if [ "$TRAVIS_OS_NAME" = "linux" ]; then
62
        ./libgit2_clar -sonline::clone::cred_callback || exit $?
63
    fi
64

65
    # Use the proxy we started at the beginning
66
    export GITTEST_REMOTE_PROXY_URL="http://foo:bar@localhost:8080/"
67
    ./libgit2_clar -sonline::clone::proxy_credentials_in_url || exit $?
68 69 70
    export GITTEST_REMOTE_PROXY_URL="http://localhost:8080/"
    export GITTEST_REMOTE_PROXY_USER="foo"
    export GITTEST_REMOTE_PROXY_PASS="bar"
71
    ./libgit2_clar -sonline::clone::proxy_credentials_request || exit $?
72

73
fi
74 75 76

export GITTEST_REMOTE_URL="https://github.com/libgit2/non-existent"
export GITTEST_REMOTE_USER="libgit2test"
77
ctest -V -R libgit2_clar-cred_callback