forked from CenterForOpenScience/osf.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
151 lines (129 loc) · 5.31 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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
# Config file for automatic testing at travis-ci.org
language: python
python:
- "2.7"
sudo: false
cache:
directories:
- $HOME/.cache
- node_modules
- website/static/vendor/bower_components
env:
global:
- PROJECT_DIR="$PWD"
- WHEELHOUSE="$HOME/.cache/wheelhouse"
- LIBXML2_DEB="libxml2-dbg_2.9.1+dfsg1-3ubuntu4.9_amd64.deb"
- POSTGRES_DEB="postgresql-9.6_9.6.3-1.pgdg12.4+1_amd64.deb"
- ELASTICSEARCH_ARCHIVE="elasticsearch-1.5.0.tar.gz"
- LIBJEMALLOC_DEB="libjemalloc1_3.5.1-2_amd64.deb"
- LIBPCRE_DEB="libpcre3_8.31-2ubuntu2.3_amd64.deb"
- VARNISH_DEB="varnish_4.1.0-1~trusty_amd64.deb"
- OSF_DB_PORT="54321"
matrix:
- TEST_BUILD="osf"
- TEST_BUILD="else"
- TEST_BUILD="api1_and_js"
- TEST_BUILD="api2"
- TEST_BUILD="api3"
# - TEST_BUILD="varnish"
before_install:
# cache directories
- |
mkdir -p $HOME/.cache/downloads
mkdir -p $HOME/.cache/pip
mkdir -p $HOME/.cache/wheelhouse
# postgres
- |
cd $HOME/.cache/downloads
if [ ! -f "$LIBXML2_DEB" ]; then
curl -SLO http://security.ubuntu.com/ubuntu/pool/main/libx/libxml2/$LIBXML2_DEB
fi
if [ ! -f "$POSTGRES_DEB" ]; then
curl -SLO http://apt.postgresql.org/pub/repos/apt/pool/main/p/postgresql-9.6/$POSTGRES_DEB
fi
dpkg -x $LIBXML2_DEB /tmp/libxml2
dpkg -x $POSTGRES_DEB /tmp/postgres
- |
export LD_LIBRARY_PATH=/tmp/libxml2/usr/lib/x86_64-linux-gnu
/tmp/postgres/usr/lib/postgresql/9.6/bin/initdb /tmp/postgres/data --nosync -U postgres
sed -i -e 's/#fsync.*/fsync = off/' /tmp/postgres/data/postgresql.conf
sed -i -e 's/#synchronous_commit.*/synchronous_commit = off/' /tmp/postgres/data/postgresql.conf
sed -i -e 's/#full_page_writes.*/full_page_writes = off/' /tmp/postgres/data/postgresql.conf
/tmp/postgres/usr/lib/postgresql/9.6/bin/postgres -k /tmp -D /tmp/postgres/data -p 54321 > /dev/null & export POSTGRES_PID=$!
# elasticsearch
- |
cd $HOME/.cache/downloads
if [ ! -f "$ELASTICSEARCH_ARCHIVE" ]; then
curl -SLO https://download.elasticsearch.org/elasticsearch/elasticsearch/$ELASTICSEARCH_ARCHIVE
fi
if [ ! -f "$ELASTICSEARCH_ARCHIVE.sha1.txt" ]; then
curl -SLO https://download.elasticsearch.org/elasticsearch/elasticsearch/$ELASTICSEARCH_ARCHIVE.sha1.txt
fi
sha1sum --check $ELASTICSEARCH_ARCHIVE.sha1.txt
mkdir -p /tmp/elasticsearch
tar xzf $ELASTICSEARCH_ARCHIVE -C /tmp/elasticsearch --strip-components=1
- /tmp/elasticsearch/bin/elasticsearch > /dev/null & export ELASTICSEARCH_PID=$!
# varnish
- |
cd $HOME/.cache/downloads
if [ ! -f "$LIBJEMALLOC_DEB" ]; then
curl -SLO http://mirrors.kernel.org/ubuntu/pool/universe/j/jemalloc/$LIBJEMALLOC_DEB
fi
if [ ! -f "$LIBPCRE_DEB" ]; then
curl -SLO http://security.ubuntu.com/ubuntu/pool/main/p/pcre3/$LIBPCRE_DEB
fi
if [ ! -f "$VARNISH_DEB" ]; then
curl -SLO https://repo.varnish-cache.org/ubuntu/pool/varnish-4.1/v/varnish/$VARNISH_DEB
fi
dpkg -x $LIBJEMALLOC_DEB /tmp/libjemalloc
dpkg -x $LIBPCRE_DEB /tmp/libpcre
dpkg -x $VARNISH_DEB /tmp/varnish
- |
if [ "$TEST_BUILD" = "varnish" ]; then
export ENABLE_VARNISH=True
export LD_LIBRARY_PATH=/tmp/libpcre/lib/x86_64-linux-gnu:/tmp/libjemalloc/usr/lib/x86_64-linux-gnu:/tmp/varnish/usr/lib/varnish
/tmp/varnish/usr/sbin/varnishd -n /tmp -p feature=+esi_disable_xml_check -p vmod_dir=/tmp/varnish/usr/lib/varnish/vmods -F -f $PROJECT_DIR/tests/test_files/varnish.vcl -a *:8080 > /dev/null & export VARNISH_PID=$!
fi
install:
- nvm install 0.12.4
- nvm use 0.12.4
- npm install -g [email protected]
- cd $PROJECT_DIR
- cp website/settings/local-travis.py website/settings/local.py
- cp api/base/settings/local-travis.py api/base/settings/local.py
- '[ -d $HOME/preprints ] || ( mkdir -p $HOME/preprints && touch $HOME/preprints/index.html )'
- travis_retry pip install --upgrade pip
- travis_retry pip install invoke==0.13.0
- travis_retry pip install flake8==2.4.0 --force-reinstall --upgrade
- travis_retry npm install jshint
- travis_retry invoke wheelhouse --dev --addons
- travis_retry invoke travis_addon_settings
- travis_retry invoke requirements --dev --addons
# Hack to fix package conflict between uritemplate and uritemplate.py (dependency of github3.py)
- pip uninstall uritemplate.py --yes
- pip install uritemplate.py==0.3.0
- travis_retry invoke assets --dev
# Run Python tests (core and addon) and JS tests
script:
- invoke test_travis_$TEST_BUILD -n 4
before_cache:
- rm -Rf $HOME/.cache/pip/http
- rm -f $HOME/.cache/pip/log/debug.log
# exclude python requirements from github repo's
- rm -f $HOME/.cache/wheelhouse/modular_odm-*.whl
- rm -f $HOME/.cache/wheelhouse/mfr-*.whl
- rm -f $HOME/.cache/wheelhouse/httpretty-*.whl
- rm -f $HOME/.cache/wheelhouse/mendeley-*.whl
- rm -f $HOME/.cache/wheelhouse/feedparser-*.whl
# exclude npm from github repo's
- rm -Rf node_modules/dropzone
- rm -Rf node_modules/treebeard
# kill any running processes
- kill -9 $POSTGRES_PID
- kill -9 $ELASTICSEARCH_PID
- kill -9 $VARNISH_PID
branches:
except:
- /^[0-9]/
notifications:
flowdock: 0221882cdda034c0e9ac2a0e766053dd