-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
71 lines (47 loc) · 1.18 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
# General
.PHONY: all list
all: list
list:
@grep '^\.PHONY' Makefile | cut -d' ' -f2- | tr ' ' '\n'
# Python
.PHONY: install lint release test version notebooks
PACKAGE := $(shell grep '^PACKAGE =' setup.py | cut -d "'" -f2)
VERSION := $(shell head -n 1 $(PACKAGE)/VERSION)
all: list
install:
pip install --upgrade -e .[develop]
lint:
pylama $(PACKAGE)
release:
bash -c '[[ -z `git status -s` ]]'
git tag -a -m release $(VERSION)
git push --tags
test:
tox
version:
@echo $(VERSION)
# Docker
.PHONY: ci-build ci-run ci-test ci-remove ci-push-tag ci-push-latest ci-login
NAME := os-dgp-backend
ORG := openspending
REPO := ${ORG}/${NAME}
TAG := $(shell git log -1 --pretty=format:"%h")
IMG := ${REPO}:${TAG}
LATEST := ${REPO}:latest
ci-build:
docker pull ${LATEST}
docker build --cache-from ${LATEST} -t ${IMG} -t ${LATEST} .
ci-run:
docker run ${RUN_ARGS} --name ${NAME} -d ${LATEST}
ci-test:
docker ps | grep latest
ci-remove:
docker rm -f ${NAME}
ci-push: ci-login
docker push ${IMG}
docker push ${LATEST}
ci-push-tag: ci-login
docker build -t ${REPO}:${TAG} .
docker push ${REPO}:${TAG}
ci-login:
docker login -u ${DOCKER_USERNAME} -p ${DOCKER_PASSWORD}