Skip to content

Commit

Permalink
Merge branch 'fix/15464-ci-directives_r1' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
isislovecruft committed Mar 26, 2015
2 parents 718adaa + 0344fe8 commit 6a1a935
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 19 deletions.
21 changes: 2 additions & 19 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,29 +59,12 @@ before_install:
- chmod -R og-w $PYTHON_EGG_CACHE

install:
- sudo apt-get install -qq --no-install-suggests --no-install-recommends build-essential openssl sqlite3 python-dev python-setuptools libgeoip-dev geoip-database
- pip install -q --no-use-wheel -r .travis.requirements.txt
- pip install -q --no-use-wheel Twisted==$TWISTED_VERSION pyOpenSSL==$PYOPENSSL_VERSION
- TWISTED_VERSION=$TWISTED_VERSION PYOPENSSL_VERSION=$PYOPENSSL_VERSION ./scripts/install-dependencies
- make install

# Start a BridgeDB instance before running the tests:
before_script:
- mkdir run
- cp -R -t run bridgedb.conf captchas .gnupg
# Add '127.0.0.1' to EMAIL_DOMAINS in bridgedb.conf. This should ONLY be
# done on testing servers, never on production servers.
- sed -r -i -e "s/(EMAIL_DOMAINS)(.*)(])/\1\2\, '127.0.0.1']/" run/bridgedb.conf
# Change EMAIL_SMTP_PORT to 2525:
- sed -r -i -e "s/(EMAIL_SMTP_PORT = )([1-9]{2,5})/\12525/" run/bridgedb.conf
# Enable plaintext HTTP distribution, otherwise the mechanize-based tests in
# test_https.py will fail with CERTIFICATE_VERIFY_FAILED because urllib2
# won't recognize our self-signed certificate:
- sed -r -i -e "s/(HTTP_UNENCRYPTED_BIND_IP = )(None)/\1'127.0.0.1'/" run/bridgedb.conf
- sed -r -i -e "s/(HTTP_UNENCRYPTED_PORT = )(None)/\16788/" run/bridgedb.conf
- leekspin -n 100
- cp -t run networkstatus-bridges cached-extrainfo* bridge-descriptors
- ./scripts/make-ssl-cert
- cp -t run privkey.pem cert
- ./scripts/setup-tests
- bridgedb -r run &

script:
Expand Down
40 changes: 40 additions & 0 deletions scripts/install-dependencies
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/usr/bin/env bash

set -x --

SUDO=
APT_GET=$(which apt-get)
APT_FLAGS='-q --no-install-suggests --no-install-recommends'
PIP=$(which pip)
PIP_FLAGS='--no-use-wheel'
DEPENDS="build-essential openssl sqlite3 python-dev python-setuptools"
DEPENDS="${DEPENDS} libgeoip-dev geoip-database libjpeg-dev"
HERE=$(dirname $0)

if [ "$EUID" != "0" ] ; then SUDO=$(which sudo); fi
# pip is pre-installed on Travis-CI machines in their Python environment, so
# we should avoid reinstalling it (as that might do odd things to the
# virtualenv that we're already inside):
if [ "$TRAVIS" == "true" ] ; then
DEPENDS="${DEPENDS} realpath"
else
DEPENDS="${DEPENDS} python-pip"
fi

MISSING=""
for dep in $DEPENDS ; do
if ! test "$(dpkg -l $dep | grep \"ii $dep\")" ; then
MISSING="${MISSING} $dep"
fi
done

$SUDO $APT_GET install ${APT_FLAGS} ${MISSING}

# When running on Travis, be sure that environment variables are passed from
# .travis.yml to this script:
if [ "$TRAVIS" == "true" ] ; then
$PIP install $PIP_FLAGS -r "$HERE/../.travis.requirements.txt"
$PIP install $PIP_FLAGS "Twisted==$TWISTED_VERSION" "pyOpenSSL==$PYOPENSSL_VERSION"
else
$PIP install $PIP_FLAGS -r "$HERE/../requirements.txt"
fi
29 changes: 29 additions & 0 deletions scripts/setup-tests
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env bash

set -x --

THIS_SCRIPT="$(realpath $0)"
HERE="$THIS_SCRIPT"

while [ "${HERE##*/}" != "bridgedb" ] ; do HERE="${HERE%/*}" ; done

THERE="$HERE"
echo "Found top-level repo directory: $THERE"
cd $THERE

mkdir run
cp -R -t run bridgedb.conf captchas .gnupg
# Add '127.0.0.1' to EMAIL_DOMAINS in bridgedb.conf. This should ONLY be
# done on testing servers, never on production servers.
sed -r -i -e "s/(EMAIL_DOMAINS)(.*)(])/\1\2\, '127.0.0.1']/" run/bridgedb.conf
# Change EMAIL_SMTP_PORT to 2525:
sed -r -i -e "s/(EMAIL_SMTP_PORT = )([1-9]{2,5})/\12525/" run/bridgedb.conf
# Enable plaintext HTTP distribution, otherwise the mechanize-based tests in
# test_https.py will fail with CERTIFICATE_VERIFY_FAILED because urllib2
# won't recognize our self-signed certificate:
sed -r -i -e "s/(HTTP_UNENCRYPTED_BIND_IP = )(None)/\1'127.0.0.1'/" run/bridgedb.conf
sed -r -i -e "s/(HTTP_UNENCRYPTED_PORT = )(None)/\16788/" run/bridgedb.conf
leekspin -n 100
cp -t run networkstatus-bridges cached-extrainfo* bridge-descriptors
./scripts/make-ssl-cert
cp -t run privkey.pem cert

0 comments on commit 6a1a935

Please sign in to comment.