-
Notifications
You must be signed in to change notification settings - Fork 64
Configuring lernanta on hudson
Hudson is a continuous integration server. It watches the source tree for changes and when they're detected, obtains the source and performs some actions. Here we'll document how that's configured for Lernanta. The server is online at coin.5cat.com.
- Run migrations and unit tests on each commit
- Setup a bleeding edge test server where the latest code can be previewed
The Hudson 2.0.0 .deb was installed on a relatively clean Ubuntu 11.04 Linode. All apt-gettable prerequisites for Lernanta development were installed (as described in the readme.) An email server and other system packages were installed.
Hudson was configured for a basic security model (although this will likely change). Hudson emails were configured.
Three Hudson plugins were installed: git, github and setenv
The job is configured with the git:// URL to the sources. The job is set to poll every 5 minutes for updates. @@TODO: Switch to a github commit hook. Email notification is enabled for [email protected]. Publish junit test report is configured for nosetests.xml. Setenv is configured as follows:
PATH=.env/bin:$PATH
Four build scripts are configured representing four stages:
#!/bin/bash
# Step 1 - create virtualenv
if [ -d ".env" ]; then
echo "**> virtualenv exists"
else
echo "**> creating virtualenv"
virtualenv .env
fi
source .env/bin/activate
#!/bin/bash
# Step 2 - install required dependencies
pip install -r requirements/compiled.txt
pip install -r requirements/prod.txt
pip install -r requirements/dev.txt
#!/bin/bash
# Step 3 - copy settings_local if needed
if [ -f "settings_local.py" ]; then
echo "**> settings_local.py exists"
else
echo "**> creating settings_local.py"
# cp settings_local.dist.py settings_local.py
fi
@@TODO: At some point, we should commit a settings_local for Hudson.
#!/bin/bash
# Step 4 - sync and tests
source .env/bin/activate
./manage.py syncdb --noinput --migrate
FORCE_DB=True ./manage.py test --with-xunit --noinput
Tests failed due to a line in settings.py: ROOT_URLCONF = 'lernanta.urls' The paths are not the same as a typical Lernanta developer's paths. This was overridden in settings_local.py: ROOT_URLCONF = 'urls' This might be a bug in Lernanta but is easy enough to work around.