-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
93 lines (78 loc) · 3.08 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
t:
TEST_MODE=true python3 -m pytest --cov=lib test/ -s
# (TEST_MODE=true python3 -m pytest --cov=lib test/ -s && python scripts/tests_pass.py) || python scripts/tests_fail.py
f:
TEST_MODE=true python3 -m pytest test/ -s -m focus
# (TEST_MODE=true python3 -m pytest test/ -s -m focus && python scripts/tests_pass.py) || python scripts/tests_fail.py
l:
black deploy/*.py && black lib/ && black test/ && black *.py && black deploy/ --exclude venv && black deploy/modules && black glm/generic_lambda_handler/*.py
# (black deploy/*.py && black lib/ && black test/ && black *.py && black deploy/ --exclude venv && black deploy/modules) || scripts/tests_fail.py
set_env_vars:
cd deploy; pulumi stack output --json | jq '.lambda_env_vars' | tee ../.env
dependencies:
rm -rf build/python
rm build/dependencies.zip
rsync -av venv/lib/python3.7/site-packages build \
--exclude awscli* \
--exclude boto3* \
--exclude botocore* \
--exclude pip* \
--exclude pip* \
--exclude setuptools* \
--exclude faker* \
--exclude s3transfer* \
--exclude sixx* \
--exclude websockets* \
--exclude _pytest*
mv build/site-packages build/python
cd /Users/begin/code/morguebot/build/; zip -r9 dependencies.zip python
# We needs this to take a random thang
# make artifact ARTIFACT_NAME=handler422.zip
dependencies_2:
rm -rf build/python
rm build/dependencies.zip
rsync -av venv/lib/python3.7/site-packages build \
--exclude awscli* \
--exclude boto3* \
--exclude botocore* \
--exclude pip* \
--exclude pip* \
--exclude setuptools* \
--exclude faker* \
--exclude s3transfer* \
--exclude werkzeug* \
--exclude sixx* \
--exclude Jinja2* \
--exclude jinja2* \
--exclude itsdangerous* \
--exclude markupsafe* \
--exclude click* \
--exclude websockets* \
--exclude _pytest*
mv build/site-packages build/python
cd /Users/begin/code/morguebot/build/; zip -r9 dependencies.zip python
# save_deps: dependencies
save_deps:
aws s3 cp build/dependencies.zip s3://morgue-artifacts/dependencies.zip
ARTIFACT_NAME := handler_$(shell date +%s).zip
# artifact: dependencies
artifact:
zip -r build/$(ARTIFACT_NAME) lib/
zip -rg build/$(ARTIFACT_NAME) commands/
zip -rg build/$(ARTIFACT_NAME) glm/
zip -g build/$(ARTIFACT_NAME) lambda_handler.py
zip -g build/$(ARTIFACT_NAME) lambda_commands.json
zip -g build/$(ARTIFACT_NAME) handler.py
zip -g build/$(ARTIFACT_NAME) flask_app.py
zip -g build/$(ARTIFACT_NAME) dungeon_gossiper.py
zip -g build/$(ARTIFACT_NAME) xl_bot.py
# make artifact_deploy
deploy: l artifact
aws s3 cp build/$(ARTIFACT_NAME) s3://morgue-artifacts/$(ARTIFACT_NAME)
cd deploy; source venv/bin/activate; echo $(ARTIFACT_NAME) | pulumi config set artifact_name; pulumi up --yes
# cd deploy; source venv/bin/activate; echo $(ARTIFACT_NAME) | pulumi config set artifact_name; (pulumi up --yes && python ../scripts/deploy_done.py) || ../scripts/tests_fail.py
invoke:
aws lambda invoke --function-name bot --payload '{"command":"${COMMAND}", "character":"${CHARACTER}"}' logs/lambda.txt
run_bot:
# cd deploy; pulumi stack output --json
python bot.py -c artmatt