addons-server/scripts/build.sh

50 строки
1.3 KiB
Bash
Executable File

# This script should be called from within Hudson
cd $WORKSPACE
VENV=$WORKSPACE/venv
echo "Starting build on executor $EXECUTOR_NUMBER..."
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."
fi
# Make sure there's no old pyc files around.
find . -name '*.pyc' | xargs rm
if [ ! -d "$VENV/bin" ]; then
echo "No virtualenv found. Making one..."
virtualenv $VENV
fi
source $VENV/bin/activate
pip install -q -r requirements/dev.txt -r requirements/compiled.txt
cat > settings_local.py <<SETTINGS
from settings import *
ROOT_URLCONF = 'workspace.urls'
LOG_LEVEL = logging.ERROR
# Database name has to be set because of sphinx
DATABASES['default']['NAME'] = 'zamboni_$1'
DATABASES['default']['TEST_NAME'] = 'test_zamboni_$1'
DATABASES['default']['TEST_CHARSET'] = 'utf8'
DATABASES['default']['TEST_COLLATION'] = 'utf8_general_ci'
CACHE_BACKEND = 'caching.backends.locmem://'
CELERY_ALWAYS_EAGER = True
SETTINGS
echo "Starting tests..."
export FORCE_DB='yes sir'
coverage run manage.py test --noinput --logging-clear-handlers --with-xunit
coverage xml $(find apps lib -name '*.py')
echo "Building documentation..."
cd docs
make clean dirhtml SPHINXOPTS='-q'
cd $WORKSPACE
echo 'shazam!'