forked from novasamatech/nova-utils
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakefile
More file actions
206 lines (158 loc) · 6.37 KB
/
makefile
File metadata and controls
206 lines (158 loc) · 6.37 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
# =============================================================================
# Variables
# =============================================================================
# Python environment
PYTHON := python
PYTHON_VERSION := 3.11
VENV ?= .venv
# Test configuration
RE_RUNS := 2
RE_RUN_DELAY := 5
ALLURE_DIR := allure-results
# Test commands
TEST_RUN := PYTHONPATH=. $(VENV)/bin/python -m pytest --rootdir . --alluredir=$(ALLURE_DIR) -n auto -v --reruns $(RE_RUNS) --reruns-delay $(RE_RUN_DELAY)
TEST_RUN_JUNIT := PYTHONPATH=. $(VENV)/bin/python -m pytest --rootdir . --junit-xml=test-results.xml -n auto -v --reruns $(RE_RUNS) --reruns-delay $(RE_RUN_DELAY)
# Chain configuration
CHAINS_FILES := chains
# Python script runner
PYTHON_SCRIPT := PYTHONPATH=. $(VENV)/bin/python
# =============================================================================
# Help
# =============================================================================
.PHONY: help
help: ## Display this help message
@echo 'Usage:'
@echo ' make <target>'
@echo ''
@echo 'Targets:'
@awk '/^[a-zA-Z\-_0-9]+:/ { \
helpMessage = match(lastLine, /^## (.*)/); \
if (helpMessage) { \
helpCommand = substr($$1, 0, index($$1, ":")-1); \
helpMessage = substr(lastLine, RSTART + 3, RLENGTH); \
printf " %-20s %s\n", helpCommand, helpMessage; \
} \
} \
{ lastLine = $$0 }' $(MAKEFILE_LIST)
@echo ''
# =============================================================================
# Main targets
# =============================================================================
.PHONY: test clean lint init venv requirements generate_network_list test-all
## Clean build artifacts
clean:
rm -rf *.pyc __pycache__/ **/__pycache__/
## Initialize development environment
init: venv .create-venv requirements .install-pre-commit
# =============================================================================
# Generation targets
# =============================================================================
## Generate type files
generate_type_files:
$(PYTHON_SCRIPT) ./scripts/create_type_file.py
## Generate network list
generate_network_list:
$(PYTHON_SCRIPT) ./scripts/generate_network_list.py
## Generate dapp list
generate_dapp_list:
$(PYTHON_SCRIPT) ./scripts/generate_dapps_list.py
## Generate test file
generate_test_file:
$(PYTHON_SCRIPT) ./scripts/update_test_data.py
# =============================================================================
# Environment setup targets
# =============================================================================
## Create virtual environment
venv:
$(PYTHON) -m venv .venv
## Create and setup virtual environment
.create-venv:
test -d $(VENV) || python$(PYTHON_VERSION) -m venv $(VENV)
$(VENV)/bin/python -m pip install --upgrade pip
$(VENV)/bin/python -m pip install poetry
## Install pre-commit hooks
.install-pre-commit:
$(VENV)/bin/poetry run pre-commit install
## Install project dependencies
requirements:
$(VENV)/bin/poetry install
. .venv/bin/activate
# =============================================================================
# Test targets
# =============================================================================
## Run all tests
test-all: test-nodes-availability test-networks-precision test-network-chain-id \
test-network-prefix test-eth-availability test-new-assets test-nodes-synced \
test-calls-availability test-subquery-synced
## Run core tests
test-core:
CHAINS_JSON_PATH=$(CHAINS_JSON_PATH) $(TEST_RUN_JUNIT) -m core
## Test nodes availability
test-nodes-availability:
$(TEST_RUN) "./tests/test_nodes_availability.py"
## Test networks precision
test-networks-precision:
$(TEST_RUN) "./tests/test_network_parameters.py::TestPrecision"
## Test network chain ID
test-network-chain-id:
$(TEST_RUN) "./tests/test_network_parameters.py::TestChainId"
## Test network prefix
test-network-prefix:
$(TEST_RUN) "./tests/test_network_parameters.py::TestNetworkPrefix"
## Test ETH nodes availability
test-eth-availability:
$(TEST_RUN) "./tests/test_eth_nodes_availability.py"
## Test new assets
test-new-assets:
$(TEST_RUN) "./tests/test_check_new_assets.py"
## Test nodes sync status
test-nodes-synced:
$(TEST_RUN) "./tests/test_substrate_node_is_synced.py"
## Test RPC methods availability
test-calls-availability:
$(TEST_RUN) "./tests/test_rpc_methods_availability.py"
## Test subquery sync status
test-subquery-synced:
$(TEST_RUN) "./tests/test_subquery_is_synced.py"
# =============================================================================
# Reporting and documentation targets
# =============================================================================
## Serve Allure test reports
allure:
allure serve $(ALLURE_DIR)
## Create PR comment with changes
pr-comment-creation:
echo "## Changes for $(PR_ENV)" >> $(PR_FILE_NAME)
XCM_PATH=$(XCM_PATH) CHAINS_PATH=$(CHAINS_PATH) $(VENV)/bin/python scripts/print_xcm_changes.py $(PR_ENV) >> $(PR_FILE_NAME)
# =============================================================================
# Chain management targets
# =============================================================================
## Check chains file format
check-chains-file:
$(VENV)/bin/pre-commit run --files chains/**/*.json
## Update XCM configuration to production
update-xcm-to-prod:
$(PYTHON_SCRIPT) xcm/update_to_prod.py
## Update Ledger networks
update-ledger-networks:
$(PYTHON_SCRIPT) scripts/update_generic_ledger_app_networks.py
## Update chains preconfigured settings
update-chains-preconfigured:
$(PYTHON_SCRIPT) scripts/polkadotjs_endpoints_to_preconfigured.py
## Check legacyAddressPrefix
check-legacy-address-prefix:
CHAIN_ADDRESS_PREFIX_FILE_PATH=$(JSON_PATH) $(PYTHON_SCRIPT) scripts/update_chain_address_prefixes.py
# =============================================================================
# XCM configuration targets
# =============================================================================
## Update all XCM configurations
update-xcm-config: update-xcm-preliminary-data update-xcm-dynamic-config update-xcm-clean-up-legacy-config
## Update XCM preliminary data
update-xcm-preliminary-data:
$(PYTHON_SCRIPT) scripts/xcm_transfers/sync_xcm_preliminary_data.py
## Update XCM dynamic configuration
update-xcm-dynamic-config:
$(PYTHON_SCRIPT) scripts/xcm_transfers/find_working_directions.py
## Clean up legacy XCM configuration
update-xcm-clean-up-legacy-config:
$(PYTHON_SCRIPT) scripts/xcm_transfers/clean_up_legacy_directions.py