-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
90 lines (70 loc) · 2.34 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
PYTHON = python
CNT_NAME := scimma/tns2hop
TAG := $(shell git log -1 --pretty=%H || echo MISSING )
CNT_IMG := $(CNT_NAME):$(TAG)
CNT_LTST := $(CNT_NAME):latest
REGION := us-west-2
AWSREG := 585193511743.dkr.ecr.us-west-2.amazonaws.com
MAJOR := 0
MINOR := 0
RELEASE := 4
DOCKERFILE := dockerfile
RELEASE_TAG := $(MAJOR).$(MINOR).$(RELEASE)
.PHONY: all install test set-release-tags docker_push clean tns_container
.PHONY: help
help :
@echo
@echo 'Commands:'
@echo
@echo ' make test run unit tests'
@echo ' make lint run linter'
@echo ' make format run code formatter, giving a diff for recommended changes'
@echo ' make doc make documentation'
@echo ' make install install module
@echo
all:
@echo No default make command. To install run "make install"
install:
$(PYTHON) setup.py install
print-% : ; @echo $* = $($*)
.PHONY: test
test :
cd tests && pytest -v
.PHONY: clean
clean :
rm -f *~
rm -rf __pycache__
.PHONY: lint
lint :
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=100 --statistics
.PHONY: format
format :
autopep8 --recursive --in-place .
print-% : ; @echo $* = $($*)
.PHONY: tns_container
tns_container:
@if [ ! -z "$$(git status --porcelain)" ]; then echo "Directory is not clean. Commit your changes."; exit 1; fi
docker build -f Dockerfile_TNS -t $(CNT_IMG) .
docker tag $(CNT_IMG) $(CNT_LTST)
.PHONY: set-release-tags
set-release-tags:
@$(eval RELEASE_TAG := $(shell echo $(GITHUB_REF) | awk -F- '{print $$2}'))
@echo RELEASE_TAG = $(RELEASE_TAG)
@$(eval MAJOR_TAG := $(shell echo $(RELEASE_TAG) | awk -F. '{print $$1}'))
@echo MAJOR_TAG = $(MAJOR_TAG)
@$(eval MINOR_TAG := $(shell echo $(RELEASE_TAG) | awk -F. '{print $$2}'))
@echo MINOR_TAG = $(MINOR_TAG)
.PHONY: docker_push
docker_push:
./scripts/awsDockerLogin $(REGION) $(AWSREG) >/dev/null
docker tag $(CNT_IMG) $(AWSREG)/$(CNT_NAME):$(RELEASE_TAG)
docker tag $(CNT_IMG) $(AWSREG)/$(CNT_NAME):$(MAJOR)
docker tag $(CNT_IMG) $(AWSREG)/$(CNT_NAME):$(MAJOR).$(MINOR)
.PHONY: clean
clean:
rm -f *~
rm -f downloads/*
if [ -d downloads ]; then rmdir downloads else /bin/true; fi