This repository has been archived by the owner on Feb 6, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
/
.travis.yml
169 lines (148 loc) · 5.79 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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
sudo: required
dist: trusty
language: python
python:
- '3.5'
env:
global:
# ✨ UNCOMMENT AND CHANGE THE FOLLOWING TO THE REMOTE SERVER YOU WANT TO BUILD
# - DEPLOY_COMMAND="git push -f dokku@SERVER:APP HEAD:master"
# ✨ CHANGE THE FOLLOWING TO SLUG OF YOUR REPO AND BRANCH
# TO TRIGGER DEPLOY
- DEPLOY_SLUG=beavyHQ/beavy
- DEPLOY_BRANCH=master
# ✨ END OF CHANGES
- BEAVY_ENV=TEST
- LD_LIBRARY_PATH=/home/travis/lib
- secure: 42qbN2sBRUwB8q99XdMJDsr1FelB3fUA8wRjRbH7ZGKRDH6CKHALno/RV2QIzpbJTlwi/6ax5MV3FQTEPN5p726Zj1JiwOun3RW2kRdqCm/xNGyh4B5FxJxyzq0hSIFdJCXihJd1Frm2JltHMkRCadl6VtlmdY9L7N1SRHQoJs0X4wU354LJFpDu2trBZKESUWee73VgdynDwlT6nehwcj42TxyXt9lr3moZUHLIfXvnyMFL7tp1CDMdbAkD4m1hq1UG1jxHQRbHfzTEtem+8oVAi8I3Hrpds4/lnIjP6/LJi8bR3c9rKKykKe1EKZnhYUf/lwD00jdR4g8c1tR3F/kTByFjxGFRfpRUzJXi6dD8Q2JOdu8zVAuIgnZg2Gh+c5z+V3/L27ax1x4sYyiXbi/lQpbE6XSkn4wLWi9Y1TK1kl1N92NkVipLwHz535tcWLwQ9KwzpVUBznGcYw5XQO3sbVcSF4PiEpiET+MjwV5o5MkOfD67FATZo9GlSwKpmSoSsd2JgpjzieRNt+VDyC4liDWco2HA3191DSO2f/q91w3bpwlGRCKP/X78npeIVGCMOzWSnTmPtOLZd3MjC/g/HFb90SG6cjAC1nTkR8RHTAXYBSnUZgr1Gl/8A1I86LSDKhXGoBGHjJTFt0ViAX+Ho9Yn0LCrtrN7SeiuSEs=
matrix:
# ✨ REPLACE THESE WITH THE APP YOU WANT TO BUILD
# RECOMMENDED WAY: comment these and add your own after
- APP=minima
- APP=hacker_news
# - APP=myAwesomeApp
before_install:
# install latest ICU for best localisation support
- bash .infrastructure/install_icu.sh
# if there isn't a config file, pick up the
# one used for the testing of the app
- "[ ! -f config.yml ] && cp -f \"beavy_apps/$APP/tests/config.yml\" config.yml || echo \"config file already found\" "
# use NVM to install latest stable NODE – the predelivered
# one isn't able to build our es6 modules
- nvm install stable
# NPM-gyp weirdly needs python2.7 (no Python3 support)
# so set that before we are running the installs
- npm config set python /usr/bin/python2.7
# install all node dependencies
- npm install --all
# install all python dependencies (requires a config.yml!)
- python install.py
# install coveralls to send coverage stats there
- pip install coveralls
before_script:
# for full frontend behave testing, we are using
# firefox, which we need to have xvfb for
- "export DISPLAY=:99.0"
- "sh -e /etc/init.d/xvfb start"
- wget https://chromedriver.storage.googleapis.com/2.12/chromedriver_linux64.zip
- unzip chromedriver_linux64.zip
- chmod +x chromedriver
- export PATH=$PATH:$PWD
- psql -c 'create database "beavy-test";' -U postgres
# now make sure we can build the assets
- npm run build
# and upgrade the database from zero
- python manager.py db upgrade heads
script:
# we are starting with running all unit tests
- python manager.py pytest -v
# lets run jstests – currently without reporitng
- npm test
# starting up test-server
# and running behaviour tests against it
- |
#!/bin/bash
set -e
# -a means we are appending the coverage
coverage run -a manager.py runserver -R &
python manager.py behave
# shutting down gracefully so coverage is written
curl http://localhost:5000/__TESTS__/shutdown
# give it a few seconds to stop the process
sleep 3
# let's make sure the styles are okay, too
- npm run style-check
- flake8 $(python manager.py paths) *.py
after_success:
# show us the coverage report
- coverage report -m
# send it all to coveralls
- coveralls || echo "skipped"
# decrypt the ssh key
# ✨ YOU PROBABLY HAVE TO REPLACE THIS WITH THE COMMAND FOR YOUR
# OWN id_rsa file!
# (in "no fail mode: `|| true`)
- openssl aes-256-cbc -K $encrypted_14a798302832_key -iv $encrypted_14a798302832_iv -in .infrastructure/travis/beavy_deploy.enc -out .infrastructure/travis/id_rsa -d || true
# now try to deploy the app, if we are
# on the deploy branch and the deploy repo
- |
#!/bin/bash
set -e
# start ssh agent
export DEFAULT_DEPLOY_SERVER="[email protected]"
export NEW_TAG="CI_$APP_$TRAVIS_JOB_NUMBER"
if [ "$TRAVIS_PULL_REQUEST" == "false" ] &&
[ "$TRAVIS_REPO_SLUG" == "$DEPLOY_SLUG" ] &&
[ "$TRAVIS_BRANCH" == "$DEPLOY_BRANCH" ]; then
echo "We are trying to deploy $DEPLOY_SLUG:$DEPLOY_BRANCH"
eval "$(ssh-agent -s)"
chmod 600 .infrastructure/travis/id_rsa
ssh-add .infrastructure/travis/id_rsa
git config push.default simple
git config --global user.name "Travis CI"
git config --global user.email "[email protected]"
git add -f config.yml var/assets/*
git commit -m"Adding config and assets for deploy"
git tag $NEW_TAG
# this will trigger the autodeploy if setup properly
if [[ -z "$DEPLOY_COMMAND" ]]; then
# Without a deploy command, we use our default setup
# for beavy itself
git remote add deploy "$DEFAULT_DEPLOY_SERVER:~/beavy-apps/$APP"
git push deploy $NEW_TAG
else
eval "$DEPLOY_COMMAND"
fi
else
echo "We are not on the target deploy branch. Aborting."
fi
# this is a special bit for
- python .infrastructure/travis/scripts/travis_after_all.py && python .infrastructure/travis/scripts/auto_pr.py || echo "skipped"
cache:
directories:
- $HOME/.cache/pip
- $HOME/.icu_cache
- node_modules
services:
- redis-server
addons:
ssh_known_hosts:
- github.com
- 46.101.137.120
# ✨ ADD YOUR DEPLOYMENT SERVERNAME/IP HERE:
# - myserver.example.org
postgresql: '9.4'
code_climate:
repo_token: 267de20fcb1419ff02cfe22e5009111ffc86347f398762cbb700ad56f8279ca6
apt:
sources:
- google-chrome
packages:
- google-chrome-stable
notifications:
webhooks:
urls:
- https://webhooks.gitter.im/e/e72c826c6364f1f79f02
on_success: change
on_failure: always
on_start: never