Add support for Travis CI
We should add support for Travis CI so all our Pull Requests, branches, and pushes are automatically built. It will help us avoid bad merges and will show the build: passing icon in the main page.
I have played with it a little bit but didn't manage to arrive to a correct .travis.yml file. There are two things I'd like to do with it:
- Either install everything and execute the web server to make sure there are no Python non-runtime errors
- Or have it build from the
Dockerfileand run it
Of course, when we have tests, we can also run the tests there.
I managed to do the first one, however, the web server is running non-stop and therefore the build never stops. Any ideas on how to fix that?
About the second one, I will try some more, but running docker inside docker inside a VM can be complex and still has the same issues as before (web server never quits).
An example .travis.yml file for Docker can be:
language: python
sudo: required
python:
- "2.7"
services:
- docker
install: true
script: docker build .
However this will only test if the Dockerfile works and the app can be packaged. Any ideas how to test the code inside? Running the container won't be of much help unless we find a way to stop it. I think all these problems will be solved by fixing #42 but let's see what we can do until then.
I know just running an application without testing it will cause it to fail. I wonder if it could be ran and then do like a wget
Correct. We can use either requests and run a python script or use wget and run a bash script.
I think you must create a test suite using flask tools for that, and then run the standard test suite. So for me #42 should be fixed first.
Once the test suite is added, you can use tox to test the application in various python environment (i.e: several python versions (2.7, 3.3, 3.4, 3.5), diferent backends (if they are added), or a combination of both.
Once tox is added you can use this .travis.yml file:
language: python
install:
- pip install tox
script:
- tox
env:
- TOXENV=py27
- TOXENV=py33
- TOXENV=py34
- TOXENV=py35
That will test (in paralel) tox py27,py33,py34 and py35 environments.
I have added a very early stage .travis.yml which only checks if the files follow PEP8 or not.