forked from mozilla/kitsune
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.sh
executable file
·73 lines (59 loc) · 2.03 KB
/
build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/bin/bash
# This script should run from inside Hudson
cd $WORKSPACE
VENV=$WORKSPACE/venv
echo "Starting build..."
if [ -z $1 ]; then
echo "Warning: You should provide a unique name for this job to prevent database collisions."
echo "Usage: ./build.sh <name>"
echo "Continuing, but don't say you weren't warned."
BUILD_NAME='default'
else
BUILD_NAME=$1
fi
# Clean up after last time.
find . -name '*.pyc' -delete;
# Using a virtualenv for python26 and compiled requirements.
if [ ! -d "$VENV/bin" ]; then
echo "No virtualenv found; making one..."
virtualenv --no-site-packages $VENV
fi
source $VENV/bin/activate
# Check for the python26 executable
# If you don't find it, create a symlink
# Hack for the new jenkins till SUMO moves to RHEL 6
# Bug 672218
PYTHON26=`which python26`
if [ -z "$PYTHON26" ]; then
ln -s $VENV/bin/python $VENV/bin/python26
fi
pip install -r requirements/tests-compiled.txt
# Fix any mistakes with private repos.
git submodule sync
# Using a vendor library for the rest.
git submodule update --init --recursive
python manage.py update_product_details
cat > kitsune/settings_local.py <<SETTINGS
from settings import *
ROOT_URLCONF = '%s.urls' % ROOT_PACKAGE
LOG_LEVEL = logging.ERROR
DATABASES['default']['NAME'] = 'kitsune_$BUILD_NAME'
DATABASES['default']['HOST'] = 'localhost'
DATABASES['default']['USER'] = 'hudson'
DATABASES['default']['TEST_NAME'] = 'test_kitsune_$BUILD_NAME'
DATABASES['default']['TEST_CHARSET'] = 'utf8'
DATABASES['default']['TEST_COLLATION'] = 'utf8_general_ci'
CELERY_ALWAYS_EAGER = True
CACHE_BACKEND = 'caching.backends.locmem://'
ES_INDEX_PREFIX = 'sumo_$BUILD_NAME'
ES_URLS = ['http://jenkins-es20:9200']
SETTINGS
echo "Starting tests..." `date`
export FORCE_DB=1
if [ -z $COVERAGE ]; then
python manage.py test -v 2 --noinput --logging-clear-handlers --with-xunit --with-fixture-bundling
else
coverage run manage.py test -v 2 --noinput --logging-clear-handlers --with-xunit --with-fixture-bundling
coverage xml $(find apps lib -name '*.py')
fi
echo 'Booyahkasha!'