forked from SpriteLink/NIPAP
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
121 lines (110 loc) · 7.02 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
language: python
python:
- "2.7"
- "3.2"
# 3.3 doesn't work for some weird reason, it has issues activating the
# virtualenv. Bug in Travis-CI?
# - "3.3"
# 3.4 doesn't appear to be available on Travis-CI, despite it being listed at
# http://docs.travis-ci.com/user/languages/python/
# - "3.4"
env:
matrix:
# Basic build only running nosetests, one using apt and one running in
# a virtualenv.
- INSTALL=venv UPGRADE=false
- INSTALL=apt UPGRADE=false
# Test upgrade by first installing stable package from official repo
# and then build and upgrade to new packages. Not applicable to
# virtualenv since the upgrade process specifically tests the apt
# package upgrade procedure.
- INSTALL=apt UPGRADE=true
matrix:
# NIPAP is not Python 3 compliant yet, so we allow failures
allow_failures:
- python: "3.2"
# don't wait for the above jobs, which are allowed to fail, before marking
# the whole build complete
fast_finish: true
# Ubuntu doesn't come with python3 dependencies through apt, so we can't
# test anything but in a virtualenv.
exclude:
- python: "3.2"
env: INSTALL=apt UPGRADE=true
- python: "3.2"
env: INSTALL=apt UPGRADE=false
virtualenv:
system_site_packages: true
install:
# -- common operations to apt install and virtualenv -----------------------
# install dependencies for building packages and build NIPAP debian packages
- sudo apt-get update
- sudo apt-get install -qq -y --force-yes devscripts python-docutils
# configure .nipaprc
- sed -e 's/username = guest/username = unittest/' -e 's/password = guest/password = gottatest/' nipap-cli/nipaprc > ~/.nipaprc
- chmod 0600 ~/.nipaprc
# -- virtualenv build ------------------------------------------------------
# install nipap dependencies
- if [ "$INSTALL" == "venv" ]; then pip install -r nipap/requirements.txt; fi
# install postgresql module (can't get from pip).
- if [ "$INSTALL" == "venv" ]; then sudo apt-get install -qq -y postgresql-9.1-ip4r; fi
# SQL
- if [ "$INSTALL" == "venv" ]; then sudo su -c "cd nipap/sql; make install" postgres; fi
# move configuration file into place
- if [ "$INSTALL" == "venv" ]; then sudo mkdir /etc/nipap; sudo cp nipap/nipap.conf.dist /etc/nipap/nipap.conf; fi
# create local user for unittest
- if [ "$INSTALL" == "venv" ]; then sudo nipap/nipap-passwd create-database; sudo nipap/nipap-passwd add -u unittest -p gottatest -n unittest; fi
- if [ "$INSTALL" == "venv" ]; then sudo nipap/nipap-passwd add -u readonly -p gottatest --readonly -n "Read-only user for running unit tests"; fi
# install pynipap
- if [ "$INSTALL" == "venv" ]; then cd pynipap; python setup.py install; cd ..; fi
# start nipap backend
- if [ "$INSTALL" == "venv" ]; then nipap/nipapd --no-pid-file -c nipap/nipap.conf.dist; fi
# -- APT build --------------------------------------------------------------
# add NIPAP official Debian repo and keys, we use it to get ip4r
- if [ "$INSTALL" == "apt" ]; then echo "deb http://spritelink.github.io/NIPAP/repos/apt stable main extra" | sudo tee /etc/apt/sources.list.d/nipap.list; fi
- if [ "$INSTALL" == "apt" ]; then wget -O - https://spritelink.github.io/NIPAP/nipap.gpg.key | sudo apt-key add -; fi
- if [ "$INSTALL" == "apt" ]; then sudo apt-get update -qq; fi
# install dependencies for installing & running nipap
- if [ "$INSTALL" == "apt" ]; then sudo apt-get install -qq -y --force-yes python-pysqlite2 python-psycopg2 python-ipy python-docutils postgresql-9.1 postgresql-9.1-ip4r python-tornado python-flask python-flask-xml-rpc python-flask-compress python-parsedatetime python-tz python-dateutil python-psutil python-pyparsing; fi
# if we are testing the upgrade, first install NIPAP packages from official repo
- if [ "$INSTALL" == "apt" ] && [ "$UPGRADE" == "true" ]; then sudo apt-get install -qq nipapd nipap-www nipap-cli; fi
# bump version so that we know we are upgrading beyond what is installed
- if [ "$INSTALL" == "apt" ] && [ "$UPGRADE" == "true" ]; then (echo -e 'Version 9999.9.9\n------------------\n * Test version for Travis-CI automatic upgrade test'; cat NEWS) > NEWS2; mv NEWS2 NEWS; make bumpversion; fi
# populate answers to nipapd package install questions and reconfigure
- if [ "$INSTALL" == "apt" ] && [ "$UPGRADE" == "true" ]; then echo 'set nipapd/autoconf true' | sudo debconf-communicate; echo 'set nipapd/startup true' | sudo debconf-communicate; echo 'set nipapd/upgrade true' | sudo debconf-communicate; sudo dpkg-reconfigure nipapd; fi
# create local user for unittest and restart
- if [ "$INSTALL" == "apt" ] && [ "$UPGRADE" == "true" ]; then sudo nipap/nipap-passwd add -u unittest -p gottatest -f /etc/nipap/local_auth.db -n unittest; sudo /etc/init.d/nipapd restart; fi
# if upgrade, add some data to the database that we can verify later
- if [ "$INSTALL" == "apt" ] && [ "$UPGRADE" == "true" ]; then nosetests tests/upgrade-before.py; fi
# build new NIPAP packages
- if [ "$INSTALL" == "apt" ]; then make builddeb; fi
# install the newly built nipap packages
- if [ "$INSTALL" == "apt" ]; then sudo dpkg -i nipap*.deb python-pynipap*.deb; fi
# populate answers to nipapd package install questions and reconfigure
- if [ "$INSTALL" == "apt" ]; then echo "set nipapd/autoconf true" | sudo debconf-communicate; fi
- if [ "$INSTALL" == "apt" ]; then echo "set nipapd/startup true" | sudo debconf-communicate; fi
# reconfigure to do bootstrapping of db and stuff, unless we are trying
# upgrade in which case this will upgrade everything for us
- if [ "$INSTALL" == "apt" ]; then sudo dpkg-reconfigure nipapd; fi
# create local user for unittests
- if [ "$INSTALL" == "apt" ]; then sudo nipap/nipap-passwd add -u unittest -p gottatest -f /etc/nipap/local_auth.db -n "User for running unit tests"; fi
- if [ "$INSTALL" == "apt" ]; then sudo nipap/nipap-passwd add -u readonly -p gottatest -f /etc/nipap/local_auth.db --readonly -n "Read-only user for running unit tests"; fi
# Don't need to restart, but I would like to make sure that all is updated
# (like local_auth.db is re-read and so forth). Read #654 for more
# information.
#- if [ "$INSTALL" == "apt" ]; then sudo /etc/init.d/nipapd restart; fi
script:
- cd tests
# if upgrade, verify data loaded before upgrade looks correct post upgrade
- if [ "$INSTALL" == "apt" ] && [ "$UPGRADE" == "true" ]; then nosetests upgrade-after.py; fi
- nosetests xmlrpc.py
- nosetests nipaptest.py
- nosetests test_cli.py
- nosetests nipap-ro.py
notifications:
irc:
channels:
# secure variable to prevent forks of NIPAP to send notifications to our IRC channel
# irc.freenode.org#NIPAP
- secure: "VejFQYDTUqrVzo+eHKf9BTWema2LHxdloPAgAbPjFF6W3n3ASbJwuXle2tg6\nr7ZavweLoTnV5LsPT6aCBO4I7ZT90O9SqhcVdZH6wzFkiW/f0HQs8VaEH/ch\nHiAjueMHalUEMdHYNJuKvoJzfG/3MPWuPdxP/Nb3rJYikJea9aE="
skip_join: true