forked from Sefaria/Sefaria-Project
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
107 lines (84 loc) · 4.53 KB
/
.travis.yml
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
language: python
dist: xenial
python:
- "3.7"
cache: pip
services:
- redis-server
addons:
sauce_connect: true
env:
PYTHONPATH=$TRAVIS_BUILD_DIR
DJANGO_SETTINGS_MODULE=sefaria.settings
TRAVIS_NODE_VERSION="12.4.0"
MONGODB=3.6.12
before_install:
- sudo apt-get -qq update
- sudo apt-get install libwww-perl
# command to install dependencies
install:
# mongo
- wget http://fastdl.mongodb.org/linux/mongodb-linux-x86_64-${MONGODB}.tgz
- tar xzf mongodb-linux-x86_64-${MONGODB}.tgz
- ${PWD}/mongodb-linux-x86_64-${MONGODB}/bin/mongod --version
- pip install Pillow
# - python setup.py install
# And everything else
- "pip install -r requirements.txt"
- rm -rf ~/.nvm && git clone https://github.com/creationix/nvm.git ~/.nvm && (cd ~/.nvm && git checkout `git describe --abbrev=0 --tags`) && source ~/.nvm/nvm.sh && nvm install $TRAVIS_NODE_VERSION
- npm install
- npm run build-prod
before_script:
# mongo
- mkdir ${PWD}/mongodb-linux-x86_64-${MONGODB}/data
- ${PWD}/mongodb-linux-x86_64-${MONGODB}/bin/mongod --dbpath ${PWD}/mongodb-linux-x86_64-${MONGODB}/data --logpath ${PWD}/mongodb-linux-x86_64-${MONGODB}/mongodb.log --fork
# Create a writable log dir
- mkdir log
- chmod 777 log
# Install mongo 2.6.6 (default is too old) - as per https://docs.mongodb.com/v2.6/tutorial/install-mongodb-on-ubuntu/
# - sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
# - echo 'deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen' | sudo tee /etc/apt/sources.list.d/mongodb.list
# - sudo apt-get update
# - sudo apt-get install -y mongodb-org=2.6.6 mongodb-org-server=2.6.6 mongodb-org-shell=2.6.6 mongodb-org-mongos=2.6.6 mongodb-org-tools=2.6.6
# Download and restore the Sefaria database
- wget -nv $MONGO_DUMP_URL
- tar -xzvf $MONGO_DUMP_FILENAME
- mongorestore --quiet --drop
# Copy in settings files tuned for the travis build
- cp ./sefaria/.travis.settings.py ./sefaria/local_settings.py
- cp ./reader/browsertest/framework/creds-example.py ./reader/browsertest/framework/creds.py
# Get rid of the conftest that forces a copy of the datastore to a test db
- rm ./sefaria/conftest.py
- cp ./sefaria/.travis.conftest.py ./sefaria/conftest.py
# Copy LC_MESSAGES to Django locale dirs -- for unknown reasons this file is missing on Travis.
# When Django admin runs `syncdb` it tries to activate the english language from within
# the Django core files. This is likely related to Travis using virutalenv, may be fixed by upgrading Django.
#- cp -R ./locale/en/LC_MESSAGES/ /home/travis/virtualenv/python2.7.14/lib/python2.7/site-packages/django/conf/locale/en
# Create the user db
- python manage.py migrate --noinput
- python manage.py createsuperuser --email $SEFARIA_SUPERUSER --username $SEFARIA_SUPERUSER --noinput
# Rebuild TOC - TEMP to pass tests involving TOC changes
- ./run rebuild_toc.py
# run the django server, redirecting output to log files
- python manage.py runserver --insecure 2> server.error.log > server.log &
- python scripts/setup_travis_users.py
# Wait for server to come up
- while ! nc -z localhost 8000; do sleep 0.1; done;
# Prime the cache
- GET http://localhost:8000/api/texts/Genesis.1 > /dev/null &
- GET http://localhost:8000/api/preview/Zohar > /dev/null &
- GET http://localhost:8000/api/name/stam?ref_only=1 > /dev/null &
- GET http://localhost:8000/api/name/stam > /dev/null &
script:
- 'py.test -m "not deep and not failing"'
- 'npm run jest-travis'
- 'if [ "${TRAVIS_PULL_REQUEST}" = "false" ]; then cd reader/browsertest && python run_tests_on_travis.py "Build - ${TRAVIS_BUILD_NUMBER}" 2> selenium.error.log; else true; fi;'
after_script:
- pkill mongod
after_failure:
- cat $TRAVIS_BUILD_DIR/reader/browsertest/selenium.error.log
- cat $TRAVIS_BUILD_DIR/server.error.log
notifications:
slack:
rooms:
secure: "nOmFvlzqc8f/p3mQxfLaCpowPuxaohCsrk5f6kgXLccNZhPdc7NRwxo8Rr7a4APVzqwlcxV7TyPDX3qGHxcE5hp2ibHlZX1icx4/DkPejsUfIfPksFg30bYzl9qv18JwyVvtfB9hAehbJDjxKjMR+MPRkspNZbHnKex5p4FgE4wcaMNosqQnvo9qUmgVs7wxcFbx+jj0ULBI1pSbAo49HJF3djebcQLDmx0ZF/R4F8RmXmEDuhwYi/avywklRRRYuq9ilUMMFyuABovFBPzOjt77XpUmp+9jRSH0EbKujCeptyfzu2kc0Y4A6e/IhDL8p8fZ3ppCNY0TpWTiX0hKeUYB+IvAmU31CQb4vJXA21zmR2G/++l56zd+5DPsTDxgw7zdQCNte5Vlt6A6xob2UQZS10vBoxnK5vv4DDPTqUGo6s/1NoB4ReuFi/E26ytYBmdFcQRp967O2YEqCWUmquWc2KaNE8sloXCfvo+MthRHp4FolZ3+fy1znJqqkwA6ux2G03CCfdTiAnxOKLB67jjYCrOBo2ZP2vsVka5Bjcu82HySkMF5kAC5rdUMR9A8HQ5wPHN1Eu7IlG7Dr556GC8dICGFdUSnd4nQMc2Byb/iQWsn45elkGKDTXWGVxTe7qnQ8YGNjE5722aSRi3WaXIiRPrNdydaxIzlKG6YNPU="