Permalink
Newer
100644
99 lines (84 sloc)
2.79 KB
|
|
||
| 1 | # Makefile for building & starting rep-containers | |
|
|
||
| 2 | # arguments can be supplied by -e definitions: | |
|
|
||
| 3 | # | |
|
|
||
| 4 | # TESTS -- list of tests to run | |
| 5 | # M -- commit message | |
|
|
||
| 6 | # | |
| 7 | # | |
| 8 | ||
| 9 | SHELL := /bin/bash | |
| 10 | TEST_OPTIONS := -s tests -N 2 | |
|
|
||
| 11 | TESTS := test_happy_mp | |
|
|
||
| 12 | IP = $(shell python -c 'from IPython.utils.localinterfaces import public_ips; print (public_ips()[0])' 2>/dev/null) | |
| 13 | OPTIONS = --debug --port 8000 --no-ssl --JupyterHub.hub_ip=${IP} | |
|
|
||
| 14 | UPLOADDIR ?= ~/upload_screens | |
|
|
||
| 15 | PYTHON_MAJOR = $(shell python -c 'import sys; print(sys.version_info[0])') | |
| 16 | IS_PYTHON3 = $(shell which python3) | |
| 17 | ||
| 18 | ifeq (${PYTHON_MAJOR}, 3) | |
| 19 | PYTHON = python | |
| 20 | PIP = pip | |
| 21 | else ifdef IS_PYTHON3 | |
| 22 | PYTHON = python3 | |
| 23 | PIP = pip3 | |
| 24 | else | |
| 25 | $(error Unable to find python) | |
| 26 | endif | |
| 27 | ||
|
|
||
| 28 | ifeq ($(shell uname -s),Linux) | |
|
|
||
| 29 | SPAWNER_IP = "127.0.0.1" | |
|
|
||
| 30 | else | |
|
|
||
| 31 | SPAWNER_IP = "192.168.99.100" | |
|
|
||
| 32 | endif | |
|
|
||
| 33 | ||
|
|
||
| 34 | include run.makefile | |
|
|
||
| 35 | ||
|
|
||
| 36 | .PHONY: install reload clean run run-daemon stop test tail | |
|
|
||
| 37 | ||
| 38 | help: | |
| 39 | @echo Usage: make [-e VARIABLE=VALUE] targets | |
| 40 | @echo "variables:" | |
| 41 | @grep -h "#\s\+\w\+ -- " $(MAKEFILE_LIST) |sed "s/#\s//" | |
| 42 | @echo | |
| 43 | @echo targets and corresponding dependencies: | |
|
|
||
| 44 | @fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' -e 's/^/ /' | sed -e 's/##//' | |
|
|
||
| 45 | ||
| 46 | install: ## install everware | |
| 47 | npm install | |
|
|
||
| 48 | npm install configurable-http-proxy | |
|
|
||
| 49 | ${PIP} install $${PIP_OPTIONS} -r requirements.txt | |
| 50 | ${PIP} install -e . | |
| 51 | ${PYTHON} setup.py css | |
|
|
||
| 52 | ${PYTHON} setup.py js | |
|
|
||
| 53 | ||
| 54 | if [ ! -f env.sh ] ; then cp env.sh.orig env.sh ; fi | |
| 55 | ||
|
|
||
| 56 | docker-build: ## build docker image | |
| 57 | docker build --no-cache -t everware/everware:0.10.0 . | |
|
|
||
| 58 | ||
|
|
||
| 59 | clean: ## clean user base | |
| 60 | if [ -f ${PIDFILE} ] ; then echo "${PIDFILE} exists, cannot continute" ; exit 1; fi | |
| 61 | rm -f jupyterhub.sqlite | |
| 62 | ||
| 63 | run-linux: clean ## run everware server on linux | |
| 64 | source ./env.sh && \ | |
| 65 | ${EXECUTOR} -f etc/local_config.py --no-ssl 2>&1 | tee ${LOG} | |
| 66 | ||
|
|
||
| 67 | test: ## run all tests | |
| 68 | export UPLOADDIR=${UPLOADDIR}; \ | |
|
|
||
| 69 | py.test everware/ && \ | |
|
|
||
| 70 | build_tools/test_frontend.sh --Spawner.container_ip=${SPAWNER_IP} | |
|
|
||
| 71 | ||
|
|
||
| 72 | gistup: ## install gistup | |
|
|
||
| 73 | git clone https://github.com/anaderi/gistup.git src/gistup | |
| 74 | cd src/gistup ; \ | |
|
|
||
| 75 | npm install -g | |
| 76 | ||
| 77 | upload_screens: ## upload screenshots of failed tests | |
| 78 | @which gistup > /dev/null || (echo "setup https://github.com/anaderi/gistup first" && exit 1 ) | |
|
|
||
| 79 | echo ${UPLOADDIR} | |
|
|
||
| 80 | if [[ -d ${UPLOADDIR} && `find ${UPLOADDIR} -not -path "*/.git/*" -type f -print` != "" ]] ; then \ | |
|
|
||
| 81 | cd ${UPLOADDIR} ; \ | |
|
|
||
| 82 | if [ ! -d ".git" ] ; then \ | |
| 83 | if [[ ! -f ~/.gistup.json ]] ; then \ | |
| 84 | if [ -n "$${GIST_TOKEN}" ] ; then \ | |
| 85 | echo "{\"token\": \"$${GIST_TOKEN}\", \"protocol\": \"https\" }" > ~/.gistup.json ; \ | |
| 86 | else \ | |
| 87 | echo "no GIST_TOKEN specified. exit"; exit 1; \ | |
| 88 | fi ; \ | |
| 89 | fi ;\ | |
|
|
||
| 90 | OPTIONS="--no-open" ; \ | |
|
|
||
| 91 | if [ "${M}" != "" ] ; then OPTIONS+=" --description '${M}'" ; fi ;\ | |
|
|
||
| 92 | gistup $${OPTIONS} ; \ | |
|
|
||
| 93 | else \ | |
| 94 | git add * ;\ | |
| 95 | git commit -am "${M}" ;\ | |
| 96 | git push ;\ | |
|
|
||
| 97 | fi ;\ | |
|
|
||
| 98 | fi |