generated from MITLibraries/python-cli-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
95 lines (70 loc) · 2.95 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
ECR_NAME_DEV:=geo-harvester-dev
SHELL=/bin/bash
DATETIME:=$(shell date -u +%Y%m%dT%H%M%SZ)
### This is the Terraform-generated header for geo-harvester-dev. If ###
### this is a Lambda repo, uncomment the FUNCTION line below ###
### and review the other commented lines in the document. ###
ECR_NAME_DEV:=geo-harvester-dev
ECR_URL_DEV:=222053980223.dkr.ecr.us-east-1.amazonaws.com/geo-harvester-dev
### End of Terraform-generated header ###
help: ## Print this message
@awk 'BEGIN { FS = ":.*##"; print "Usage: make <target>\n\nTargets:" } \
/^[-_[:alpha:]]+:.?*##/ { printf " %-15s%s\n", $$1, $$2 }' $(MAKEFILE_LIST)
## ---- Dependency commands ---- ##
install: # install dependencies
pipenv install --dev
pipenv run pre-commit install
update: install # update all Python dependencies
pipenv clean
pipenv update --dev
## ---- Unit test commands ---- ##
test: # run tests and print a coverage report
pipenv run coverage run --source=harvester -m pytest -vv
pipenv run coverage report -m
coveralls: test
pipenv run coverage lcov -o ./coverage/lcov.info
## ---- Code quality and safety commands ---- ##
# linting commands
lint: black mypy ruff safety
black:
pipenv run black --check --diff .
mypy:
pipenv run mypy .
ruff:
pipenv run ruff check .
safety:
pipenv check
pipenv verify
# apply changes to resolve any linting errors
lint-apply: black-apply ruff-apply
black-apply:
pipenv run black .
ruff-apply:
pipenv run ruff check --fix .
## ---- Docker commands ---- ##
dist-local:
docker build -t $(ECR_NAME_DEV):latest .
### Terraform-generated Developer Deploy Commands for Dev environment ###
dist-dev: ## Build docker container (intended for developer-based manual build)
docker build --platform linux/amd64 \
-t $(ECR_URL_DEV):latest \
-t $(ECR_URL_DEV):`git describe --always` \
-t $(ECR_NAME_DEV):latest .
publish-dev: dist-dev ## Build, tag and push (intended for developer-based manual publish)
docker login -u AWS -p $$(aws ecr get-login-password --region us-east-1) $(ECR_URL_DEV)
docker push $(ECR_URL_DEV):latest
docker push $(ECR_URL_DEV):`git describe --always`
### Terraform-generated manual shortcuts for deploying to Stage. This requires ###
### that ECR_NAME_STAGE, ECR_URL_STAGE, and FUNCTION_STAGE environment ###
### variables are set locally by the developer and that the developer has ###
### authenticated to the correct AWS Account. The values for the environment ###
### variables can be found in the stage_build.yml caller workflow. ###
dist-stage: ## Only use in an emergency
docker build --platform linux/amd64 \
-t $(ECR_URL_STAGE):latest \
-t $(ECR_URL_STAGE):`git describe --always` \
-t $(ECR_NAME_STAGE):latest .
publish-stage: ## Only use in an emergency
docker login -u AWS -p $$(aws ecr get-login-password --region us-east-1) $(ECR_URL_STAGE)
docker push $(ECR_URL_STAGE):latest
docker push $(ECR_URL_STAGE):`git describe --always`