forked from dvilelaf/meme-ooorr
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
241 lines (203 loc) · 7.83 KB
/
Makefile
File metadata and controls
241 lines (203 loc) · 7.83 KB
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
.PHONY: clean
clean: clean-test clean-build clean-pyc clean-docs
.PHONY: clean-build
clean-build:
rm -fr build/
rm -fr dist/
rm -fr .eggs/
rm -fr pip-wheel-metadata
find . -name '*.egg-info' -exec rm -fr {} +
find . -name '*.egg' -exec rm -fr {} +
find . -type d -name __pycache__ -exec rm -rv {} +
rm -fr Pipfile.lock
rm -rf plugins/*/build
rm -rf plugins/*/dist
.PHONY: clean-docs
clean-docs:
rm -fr site/
.PHONY: clean-pyc
clean-pyc:
find . -name '*.pyc' -exec rm -f {} +
find . -name '*.pyo' -exec rm -f {} +
find . -name '*~' -exec rm -f {} +
find . -name '__pycache__' -exec rm -fr {} +
find . -name '.DS_Store' -exec rm -fr {} +
.PHONY: clean-test
clean-test:
rm -fr .tox/
rm -f .coverage
find . -name ".coverage*" -not -name ".coveragerc" -exec rm -fr "{}" \;
rm -fr coverage.xml
rm -fr htmlcov/
rm -fr .hypothesis
rm -fr .pytest_cache
rm -fr .mypy_cache/
rm -fr .hypothesis/
find . -name 'log.txt' -exec rm -fr {} +
find . -name 'log.*.txt' -exec rm -fr {} +
# isort: fix import orders
# black: format files according to the pep standards
.PHONY: formatters
formatters:
tomte format-code
# black-check: check code style
# isort-check: check for import order
# flake8: wrapper around various code checks, https://flake8.pycqa.org/en/latest/user/error-codes.html
# mypy: static type checker
# pylint: code analysis for code smells and refactoring suggestions
# darglint: docstring linter
.PHONY: code-checks
code-checks:
tomte check-code
# safety: checks dependencies for known security vulnerabilities
# bandit: security linter
.PHONY: security
security:
tomte check-security
gitleaks detect --report-format json --report-path leak_report
# generate latest hashes for updated packages
# generate docs for updated packages
# update copyright headers
.PHONY: generators
generators:
tox -e abci-docstrings
tomte format-copyright --author author_name
autonomy packages lock
.PHONY: common-checks-1
common-checks-1:
tomte check-copyright --author author_name
tomte check-doc-links --url-skips https://soft-sly-slug.base-mainnet.quiknode.pro/f13d998d9d68685faeee903499e15b4b386a8b1c/ --url-skips https://tenderly.co/ --url-skips https://developer.x.com/en/portal/dashboard --url-skips https://github.com/olas-operate-app
tox -p -e check-hash -e check-packages -e check-doc-hashes
.PHONY: fix-abci-app-specs
fix-abci-app-specs:
export PYTHONPATH=${PYTHONPATH}:${PWD}
autonomy analyse fsm-specs --update --app-class MemeooorrAbciApp --package packages/dvilela/skills/memeooorr_abci/ || (echo "Failed to check memeooorr_abci abci consistency" && exit 1)
autonomy analyse fsm-specs --update --app-class MemeooorrChainedSkillAbciApp --package packages/dvilela/skills/memeooorr_chained_abci/ || (echo "Failed to check memeooorr_chained_abci abci consistency" && exit 1)
autonomy analyse fsm-specs --update --app-class AgentDBAbciApp --package packages/valory/skills/agent_db_abci/ || (echo "Failed to check agent_db_abci abci consistency" && exit 1)
.PHONY: tm
tm:
rm -r ~/.tendermint
tendermint init
tendermint node --proxy_app=tcp://127.0.0.1:26658 --rpc.laddr=tcp://127.0.0.1:26657 --p2p.laddr=tcp://0.0.0.0:26656 --p2p.seeds= --consensus.create_empty_blocks=true
.PHONY: all-linters
all-linters:
gitleaks detect --report-format json --report-path leak_report
tox -e spell-check
tox -e liccheck
tox -e check-doc-hashes
tox -e bandit
tox -e safety
tox -e check-packages
tox -e check-abciapp-specs
tox -e check-hash
tox -e black-check
tox -e isort-check
tox -e flake8
tox -e darglint
tox -e pylint
tox -e mypy
.PHONY: push-image
push-image:
@AGENT_HASH=$$(jq -r ".dev[\"agent/dvilela/memeooorr/0.1.0\"]" packages/packages.json) && \
SERVICE_HASH=$$(jq -r ".dev[\"service/dvilela/memeooorr/0.1.0\"]" packages/packages.json) && \
IMAGE_ID=$$(docker image ls | awk -v tag="$$AGENT_HASH" '$$2 == tag {print $$3}' | head -n 1) && \
echo "Tagging image $$IMAGE_ID -> dvilela/oar-memeooorr:$$AGENT_HASH" && \
docker tag $$IMAGE_ID dvilela/oar-memeooorr:$$AGENT_HASH && \
docker push dvilela/oar-memeooorr:$$AGENT_HASH
.PHONY: push-packages
push-packages:
make clean && \
autonomy push-all
.PHONY: publish
publish:
make push-packages && \
bash build_image.sh && \
make push-image
.PHONY: deploy-contracts
deploy-contracts:
npx hardhat run scripts/deployment/deploy_01_meme_base.js --network base
.PHONY: bump-packages
bump-packages:
@AUTONOMY_VERSION=$$(poetry show open-autonomy | grep version | cut -d':' -f2 | xargs) && \
AEA_VERSION=$$(poetry show open-aea | grep version | cut -d':' -f2 | xargs) && \
echo "Bumping packages to open-autonomy $${AUTONOMY_VERSION}" && \
echo "Bumping packages to open-aea $${AEA_VERSION}" && \
autonomy packages sync --source valory-xyz/open-autonomy:v$${AUTONOMY_VERSION} --source valory-xyz/open-aea:v$${AEA_VERSION} --update-packages
.PHONY: run-agent
run-agent:
mkdir -p ./logs && \
bash -c 'TIMESTAMP=$$(date +%d-%m-%y_%H-%M); \
LOG_FILE="./logs/agent_log_$$TIMESTAMP.log"; \
echo "Running agent and logging to $$LOG_FILE"; \
bash run_agent.sh 2>&1 | tee $$LOG_FILE'
v := $(shell pip -V | grep virtualenvs)
.PHONY: poetry-install
poetry-install:
PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring poetry install
PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring poetry run pip install --upgrade --force-reinstall setuptools==59.5.0 # fix for KeyError: 'setuptools._distutils.compilers'
./agent: poetry-install ./hash_id
@if [ ! -d "agent" ]; then \
poetry run autonomy -s fetch --remote `cat ./hash_id` --alias agent; \
fi \
.PHONY: build-agent-runner
build-agent-runner: poetry-install agent
poetry run pyinstaller \
--collect-data eth_account \
--collect-all aea \
--collect-all autonomy \
--collect-all aea_ledger_ethereum \
--collect-all aea_ledger_cosmos \
--collect-all aea_ledger_ethereum_flashbots \
--hidden-import aea_ledger_ethereum \
--hidden-import aea_ledger_cosmos \
--hidden-import aea_ledger_ethereum_flashbots \
$(shell poetry run python get_pyinstaller_dependencies.py) \
--onefile pyinstaller/memeooorr_bin.py \
--name agent_runner_bin
./dist/agent_runner_bin --version
.PHONY: build-agent-runner-mac
build-agent-runner-mac: poetry-install agent
poetry run pyinstaller \
--collect-data eth_account \
--collect-all aea \
--collect-all autonomy \
--collect-all aea_ledger_ethereum \
--collect-all aea_ledger_cosmos \
--collect-all aea_ledger_ethereum_flashbots \
--hidden-import aea_ledger_ethereum \
--hidden-import aea_ledger_cosmos \
--hidden-import aea_ledger_ethereum_flashbots \
$(shell poetry run python get_pyinstaller_dependencies.py) \
--onefile pyinstaller/memeooorr_bin.py \
--codesign-identity "${SIGN_ID}" \
--name agent_runner_bin
./dist/agent_runner_bin --version
./hash_id: ./packages/packages.json
cat ./packages/packages.json | jq -r '.dev | to_entries[] | select(.key | startswith("agent/")) | .value' > ./hash_id
./agent_id: ./packages/packages.json
cat ./packages/packages.json | jq -r '.dev | to_entries[] | select(.key | startswith("agent/")) | .key | sub("^agent/"; "")' > ./agent_id
./agent.zip: ./agent
zip -r ./agent.zip ./agent
./agent.tar.gz: ./agent
tar czf ./agent.tar.gz ./agent
./agent/ethereum_private_key.txt: ./agent
poetry run bash -c "cd ./agent; autonomy -s generate-key ethereum; autonomy -s add-key ethereum ethereum_private_key.txt; autonomy -s issue-certificates;"
# Configuration
TIMEOUT := 20
COMMAND := cd ./agent && SKILL_TRADER_ABCI_MODELS_PARAMS_ARGS_STORE_PATH=/tmp ../dist/agent_runner_bin -s run
SEARCH_STRING := Starting AEA
# Determine OS and set appropriate options
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Darwin)
# macOS specific settings
MKTEMP = mktemp -t tmp
else ifeq ($(OS),Windows_NT)
# Windows specific settings
MKTEMP = echo $$(cygpath -m "$$(mktemp -t tmp.XXXXXX)")
else
# Linux and other Unix-like systems
MKTEMP = mktemp
endif
.PHONY: check-agent-runner
check-agent-runner:
python check_agent_runner.py