test.sh 1.48 KB
Newer Older
1 2
#! /bin/bash

3 4 5
set -e
set -x

6 7 8 9 10 11 12 13 14 15 16
function github_status {
    gcli status create mitx mitx $GIT_COMMIT \
         --params=$1 \
                  target_url:$BUILD_URL \
                  description:"Build #$BUILD_NUMBER $2" \
         -f csv
}

function github_mark_failed_on_exit {
    trap '[ $? == "0" ] || github_status state:failure "failed"' EXIT
}
17

18 19
git remote prune origin

20
github_mark_failed_on_exit
21
github_status state:pending "is running"
22

23 24 25 26 27 28 29
# Reset the submodule, in case it changed
git submodule foreach 'git reset --hard HEAD'

# Set the IO encoding to UTF-8 so that askbot will start
export PYTHONIOENCODING=UTF-8

GIT_BRANCH=${GIT_BRANCH/HEAD/master}
30 31 32 33
if [ ! -d /mnt/virtualenvs/"$JOB_NAME" ]; then
    mkdir -p /mnt/virtualenvs/"$JOB_NAME"
    virtualenv /mnt/virtualenvs/"$JOB_NAME"
fi
34

35
source /mnt/virtualenvs/"$JOB_NAME"/bin/activate
36
pip install -q -r pre-requirements.txt
37
pip install -q -r test-requirements.txt
38
yes w | pip install -q -r requirements.txt
39 40 41

rake clobber
TESTS_FAILED=0
42
rake test_cms[false] || TESTS_FAILED=1
43 44 45
rake test_lms[false] || TESTS_FAILED=1
rake test_common/lib/capa || TESTS_FAILED=1
rake test_common/lib/xmodule || TESTS_FAILED=1
46 47 48
# Don't run the lms jasmine tests for now because 
# they mostly all fail anyhow
# rake phantomjs_jasmine_lms || true
49
rake phantomjs_jasmine_cms || TESTS_FAILED=1
50
rake phantomjs_jasmine_common/lib/xmodule || TESTS_FAILED=1
51

52
rake coverage:xml coverage:html
53 54

[ $TESTS_FAILED == '0' ]
55 56
rake autodeploy_properties

57
github_status state:success "passed"