forked from oisinmulvihill/nozama-cloudsearch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
85 lines (69 loc) · 1.98 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
81
82
83
84
85
# nozama-cloudsearch developer, build and release helpers
#
# Oisin mulvihill
# 2019-06-22
#
GIT_COMMIT?=$(shell git rev-parse HEAD)
DOCKER_NAME=nozama-cloudsearch
DOCKER_IMAGE=${DOCKER_NAME}:${GIT_COMMIT}
DOCKER_REPO=oisinmulvihill/${DOCKER_NAME}
clean:
rm -rf dist/ build/
find . -iname '*.pyc' -exec rm {} \; -print
install:
pip install -r requirements.txt
python setup.py develop
test_install: install
pip install -r test-requirements.txt
docker_build: clean
docker build \
-t ${DOCKER_IMAGE}-test \
--target test \
.
docker build \
-t ${DOCKER_IMAGE} \
--target service \
.
up:
docker-compose --project-name ${DOCKER_NAME} up --remove-orphans -d
ps:
docker-compose --project-name ${DOCKER_NAME} ps
logs:
docker-compose --project-name ${DOCKER_NAME} logs
tail:
docker-compose --project-name ${DOCKER_NAME} logs -f
down:
docker-compose --project-name ${DOCKER_NAME} logs -t
docker-compose --project-name ${DOCKER_NAME} down --remove-orphans
docker_test: docker_build
# Hostnames for mongo and elastic search are set in the "docker-compose.yaml".
# The test container joins the docker compose created network so that the
# hostnames
docker run \
-u 0 \
--rm \
-e MONGO_HOST=mongo \
-e ELASTICSEARCH_HOST=elasticsearch \
--network=${DOCKER_NAME}_default \
${DOCKER_IMAGE}-test \
make test
lint:
flake8 nozama
test: test_install lint
coverage run -m py.test -s --cov=nozama-cloudsearch --junitxml=tests/report.xml tests
run:
pserve development.ini
test_pypi_release:
pip install twine
python3 setup.py sdist bdist_wheel
twine upload --repository-url https://test.pypi.org/legacy/ dist/*
release_to_pypi:
twine upload dist/*
docker_release:
# Push the latest container version which is tagged with the git commit. Then
# Tag the latest build and push this as well.
docker login
docker tag ${DOCKER_IMAGE} ${DOCKER_REPO}:${GIT_COMMIT}
docker push ${DOCKER_REPO}:${GIT_COMMIT}
docker tag ${DOCKER_IMAGE} ${DOCKER_REPO}:latest
docker push ${DOCKER_REPO}:latest