-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
128 lines (99 loc) · 2.41 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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
REPO = aliquot-maf-tools
MODULE = aliquotmaf
# Redirect error when run in container
COMMIT_HASH:=$(shell git rev-parse HEAD 2>/dev/null)
GIT_DESCRIBE:=$(shell git describe --tags --always 2>/dev/null)
DOCKER_REGISTRY := docker.osdc.io
DOCKER_IMAGE_COMMIT := ${DOCKER_REGISTRY}/ncigdc/${REPO}:${COMMIT_HASH}
DOCKER_IMAGE_DESCRIBE := ${DOCKER_REGISTRY}/ncigdc/${REPO}:${GIT_DESCRIBE}
DOCKER_IMAGE_LATEST := ${DOCKER_REGISTRY}/ncigdc/${REPO}:latest
# Env args
PIP_EXTRA_INDEX_URL ?=
PROXY ?=
.PHONY: version version-*
version:
@python -m setuptools_scm
version-docker:
@echo ${DOCKER_IMAGE_DESCRIBE}
.PHONY: docker-login
docker-login:
docker login -u="${QUAY_USERNAME}" -p="${QUAY_PASSWORD}" quay.io
.PHONY: venv
venv:
@echo
rm -rf .venv/
tox -r -e dev --devenv .venv
.PHONY: init init-*
init: init-pip init-hooks
init-pip:
@echo
@echo -- Installing pip packages --
pip-sync requirements.txt dev-requirements.txt
python -m pip install -e .
init-hooks:
@echo
@echo -- Installing Precommit Hooks --
pre-commit install
init-venv:
@echo
PIP_REQUIRE_VIRTUALENV=true python -m pip install --upgrade pip pip-tools
.PHONY: clean clean-*
clean: clean-dirs
clean-dirs:
rm -rf ./build/
rm -rf ./dist/
rm -rf ./*.egg-info/
rm -rf ./test-reports/
rm -rf ./htmlcov/
clean-docker:
@echo
.PHONY: requirements requirements-*
requirements: init-venv requirements-prod requirements-dev
requirements-dev:
pip-compile -o dev-requirements.txt dev-requirements.in
requirements-prod:
pip-compile -o requirements.txt pyproject.toml
.PHONY: build build-*
build: build-docker
build-docker: clean
@echo
@echo -- Building docker --
docker build . \
--file ./Dockerfile \
--build-arg http_proxy="${PROXY}" \
--build-arg https_proxy="${PROXY}" \
--build-arg REGISTRY="${DOCKER_REGISTRY}" \
--build-arg PIP_EXTRA_INDEX_URL=${PIP_EXTRA_INDEX_URL} \
-t "${DOCKER_IMAGE_COMMIT}" \
-t "${DOCKER_IMAGE_DESCRIBE}" \
-t "${REPO}"
build-pypi: clean
@echo
tox -e check_dist
.PHONY: run run-*
run:
@echo
run-docker:
@echo
docker run --rm "${DOCKER_IMAGE_COMMIT}"
.PHONY: lint test test-* tox
test: tox
lint:
@echo
@echo -- Lint --
tox -p -e flake8
test-unit:
pytest tests/
test-docker:
@echo
tox:
@echo
TOX_PARALLEL_NO_SPINNER=1 tox -p --recreate
.PHONY: publish-*
publish-docker:
docker push ${DOCKER_IMAGE_COMMIT}
docker push ${DOCKER_IMAGE_DESCRIBE}
publish-pypi:
@echo
@echo Publishing wheel
python3 -m twine upload dist/*