Skip to content

Commit

Permalink
Merge pull request #52 from betatim/travisci
Browse files Browse the repository at this point in the history
We don't have Travis, yet
  • Loading branch information
anaderi committed Mar 6, 2016
2 parents 250fd09 + 9dfef96 commit b59f465
Show file tree
Hide file tree
Showing 8 changed files with 125 additions and 2 deletions.
32 changes: 32 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
language: python

# Needed so we can spawn docker containers
sudo: required
services:
- docker

addons:
apt:
packages:
- build-essential

python:
- 3.5
- 3.4
env:
- JHUB_VERSION=master
- JHUB_VERSION=latest # latest released version

before_install:
- npm install
- npm install -g configurable-http-proxy
- git clone --quiet --depth 1 https://github.com/minrk/travis-wheels travis-wheels
install: ./build_tools/travis/install.sh

script:
- nose2 -v --start-dir everware # unit tests live in everware/
- ./build_tools/travis/test_frontend.sh

# Make travis quiet
notifications:
email: false
34 changes: 34 additions & 0 deletions base_config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import os
import everware
import jupyterhub.handlers.pages
import jupyterhub.handlers.base


# TODO: find a way to change default handlers
# instead of this shit
jupyterhub.handlers.base.UserSpawnHandler.get = everware.UserSpawnHandler.get
jupyterhub.handlers.pages.SpawnHandler.post = everware.SpawnHandler.post
jupyterhub.handlers.pages.SpawnHandler.get = everware.SpawnHandler.get
jupyterhub.handlers.pages.SpawnHandler._spawn = everware.SpawnHandler._spawn
jupyterhub.handlers.pages.HomeHandler.get = everware.HomeHandler.get

c = get_config()

# spawn with custom docker containers
c.JupyterHub.spawner_class = 'everware.CustomDockerSpawner'

c.Spawner.tls = False
c.Spawner.debug = True
c.Spawner.start_timeout = 1000
c.Spawner.remove_containers = True
c.Spawner.tls_assert_hostname = False
c.Spawner.use_docker_client_env = True

# The docker containers need access to the Hub, so the default loopback
# port doesn't work:
from jupyter_client.localinterfaces import public_ips
c.JupyterHub.hub_ip = public_ips()[0]
c.JupyterHub.hub_api_ip = public_ips()[0]

c.JupyterHub.data_files_path = 'share'
c.JupyterHub.template_paths = ['share/static/html']
4 changes: 4 additions & 0 deletions build_tools/travis/frontend_test_config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
c = get_config()
load_subconfig('base_config.py')

c.JupyterHub.authenticator_class = 'dummyauthenticator.DummyAuthenticator'
15 changes: 15 additions & 0 deletions build_tools/travis/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#! /usr/bin/env bash

if [[ "$JHUB_VERSION" == "master" ]]; then
echo "Using jupyterhub master"
pushd /tmp
git clone --quiet --depth 1 https://github.com/jupyter/jupyterhub.git
cd jupyterhub
pip install -r requirements.txt -e.
python setup.py js
python setup.py css
popd
echo "Done installing jupyterhub master"
fi

pip install -f travis-wheels/wheelhouse -r requirements.txt .
16 changes: 16 additions & 0 deletions build_tools/travis/test_frontend.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash

# This script is meant to be run from the script step in .travis.yml
# The tests run by this script are "frontend" testing

set -e
echo "In" `pwd`

# Start a hub that our tests can interact with
echo "Starting everware"
jupyterhub -f build_tools/travis/frontend_test_config.py \
--no-ssl --debug &
sleep 3

echo "Start running frontend tests"
nose2 -v --start-dir frontend_tests
Empty file added frontend_tests/.empty
Empty file.
21 changes: 21 additions & 0 deletions local_dockermachine_config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import os
import everware


c = get_config()
load_subconfig('base_config.py')

authenticator = everware.GitHubOAuthenticator
c.JupyterHub.authenticator_class = 'everware.GitHubOAuthenticator'
whitelist_file = 'whitelist.txt'
whitelist_handler = everware.DefaultWhitelistHandler(whitelist_file,
c,
authenticator)
c.GitHubOAuthenticator.oauth_callback_url = os.environ['OAUTH_CALLBACK_URL']
c.GitHubOAuthenticator.client_id = os.environ['GITHUB_CLIENT_ID']
c.GitHubOAuthenticator.client_secret = os.environ['GITHUB_CLIENT_SECRET']

# change this to the ip that `boot2docker ip` or
# `docker-machine ip <vm_name>`tells you if
# you use boot2docker/a VM, otherwise remove the line
c.Spawner.container_ip = '192.168.99.100'
5 changes: 3 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
ipython[notebook]
coveralls
pytest-cov
pytest
nose2
selenium
jupyterhub-dummyauthenticator
jupyterhub
dockerspawner
GitPython==1.0.1

0 comments on commit b59f465

Please sign in to comment.