forked from NCATS-Tangerine/tranql
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
80 lines (63 loc) · 2.22 KB
/
Makefile
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
PYTHON = /usr/bin/env python3
VERSION_FILE = ./src/tranql/_version.py
VERSION = $(shell cut -d " " -f 3 ${VERSION_FILE})
DOCKER_REPO = docker.io
DOCKER_OWNER = helxplatform
DOCKER_APP = tranql
DOCKER_TAG = ${VERSION}
DOCKER_IMAGE = ${DOCKER_OWNER}/${DOCKER_APP}:$(DOCKER_TAG)
TEST_REDIS_DUMP_FILE = "https://stars.renci.org/var/kgx_data/v3.0/roger-mini.rdb"
.DEFAULT_GOAL = help
.PHONY: help clean install test build image publish
#help: List available tasks on this project
help:
@grep -E '^#[a-zA-Z\.\-]+:.*$$' $(MAKEFILE_LIST) | tr -d '#' | awk 'BEGIN {FS = ": "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
#clean: Remove old build artifacts and installed packages
clean:
rm -rf build
rm -rf dist
rm -rf src/tranql.egg-info
${PYTHON} -m pip uninstall -y tranql
${PYTHON} -m pip uninstall -y -r requirements.txt
#install.python: Install python application along with required development packages
install.python:
${PYTHON} -m pip install --upgrade pip
${PYTHON} -m pip install -r requirements.txt
${PYTHON} -m pip install .
#install.npm: Builds the NPM modules
install.npm:
cd src/tranql/web; npm install; npm run build
install.npm_nobuild:
cd src/tranql/web; npm install;
#install: Install application
install: install.python install.npm
#test.python: Run all python tests
test.python:
#${PYTHON} -m pytest --doctest-modules src
PYTHONPATH=${PWD}/src ${PYTHON} -m pytest tests
#test.npm: Run all NPM tests
test.npm:
cd src/tranql/web; npm test -- --watchAll=false
#test: Run all tests
test: test.python test.npm
#build: Build Docker image
build:
echo "Building docker image: ${DOCKER_IMAGE}"
docker build -t ${DOCKER_IMAGE} -f Dockerfile .
echo "Successfully built: ${DOCKER_IMAGE}"
#publish: Build and push docker image
publish:
docker tag ${DOCKER_IMAGE} ${DOCKER_REPO}/${DOCKER_IMAGE}
docker push ${DOCKER_REPO}/${DOCKER_IMAGE}
#download: Downloads example dataset for redis
download:
mkdir -p redis_data/
if [ ! -f "./redis_data/dump.rdb" ] ; then \
wget ${TEST_REDIS_DUMP_FILE} -O redis_data/dump.rdb; \
fi
#run.local: seeds redis with data, builds web page and runs tranql docker container
run.local: download
docker-compose up -d
cd src/tranql/web; npm start;
run.web:
cd src/tranql/web; npm start;