-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
82 lines (67 loc) · 2.35 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
AWS_REGION := $(shell aws configure get region || echo "us-east-2")
AWS_ACCOUNT_ID := $(shell aws sts get-caller-identity --query 'Account' --output text)
install:
python -m pip install --upgrade pip &&\
pip install -r lambda_requirements.txt &&\
pip install -r dev_requirements.txt &&\
pip install -r tests/test_requirements.txt &&\
pip install -e . --use-pep517
update-conda-env:
conda remove --name esg-env --all -y || true
conda create --name esg-env python=3.9 -y
conda init bash
# You may need to run the following command manually in terminal
conda activate esg-env
make install
format:
black tba_invest_etl tests
isort tba_invest_etl tests
lint:
pylint tba_invest_etl tests --rcfile=.pylintrc
black --check --diff tba_invest_etl tests
isort --check-only tba_invest_etl tests
test:
python -m pytest -v
pre_pr: format lint test
build-package:
@echo "Building tba_invest_etl package..."
rm -rf dist
mkdir -p dist
python setup.py sdist
mv dist/*.tar.gz dist/tba_invest_etl.tar.gz
publish-package:
@echo "Publishing package to AWS CodeArtifact..."
python -m pip install --upgrade twine
aws codeartifact login --tool twine --domain tba-investments --domain-owner $(AWS_ACCOUNT_ID) --repository tba-investments-etl --region $(AWS_REGION)
python -m twine upload --repository codeartifact dist/*
build-sam:
@echo "Cleaning previous build..."
rm -rf .aws-sam/build
@echo "Building SAM application..."
sam build --debug
@echo "Creating Lambda layer..."
mkdir -p .aws-sam/build/PythonDependenciesLayer/python
docker run --rm --platform linux/amd64 --entrypoint /bin/bash \
-v $(PWD):/var/task \
public.ecr.aws/lambda/python:3.9 \
-c "pip install -r lambda_requirements.txt -t /var/task/.aws-sam/build/PythonDependenciesLayer/python"
@echo "Installing package..."
pip install -e . --use-pep517
@echo "Checking build size..."
du -sh .aws-sam/build/* 2>/dev/null | sort -hr
@echo "Size of entire .aws-sam directory:"
du -sh .aws-sam
deploy-local:
@echo "Deploying from local samconfig file..."
sam deploy --config-file samconfig.toml
deploy-sam:
@echo "Deploying..."
sam deploy \
--stack-name sam-app \
--s3-bucket aws-sam-cli-managed-default-samclisourcebucket-rluxcxhrbn0v \
--s3-prefix sam-app \
--region us-east-2 \
--capabilities CAPABILITY_IAM \
--no-confirm-changeset \
--no-fail-on-empty-changeset \
--disable-rollback false