-
Notifications
You must be signed in to change notification settings - Fork 304
/
Makefile
104 lines (79 loc) · 2.78 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
96
97
98
99
100
101
102
103
104
# Include .env file to get GITHUB_TOKEN
ifneq ("$(wildcard .env)","")
include .env
export $(shell sed 's/=.*//' .env)
endif
.PHONY: build test coverage clean
# 176384150 corresponds to release v0.1.13 of Kakarot SSJ.
KKRT_SSJ_RELEASE_ID = 176384150
# Kakarot SSJ artifacts for precompiles.
KKRT_SSJ_BUILD_ARTIFACT_URL = $(shell curl -L https://api.github.com/repos/kkrt-labs/kakarot-ssj/releases/${KKRT_SSJ_RELEASE_ID} | jq -r '.assets[0].browser_download_url')
ROOT_DIR:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
BUILD_DIR = build
SSJ_DIR = $(BUILD_DIR)/ssj
SSJ_ZIP = dev-artifacts.zip
$(SSJ_DIR): $(SSJ_ZIP)
rm -rf $(SSJ_DIR)
mkdir -p $(SSJ_DIR)
unzip -o $(SSJ_ZIP) -d $(SSJ_DIR)
rm -f $(SSJ_ZIP)
$(SSJ_ZIP):
curl -sL -o $(SSJ_ZIP) "$(KKRT_SSJ_BUILD_ARTIFACT_URL)"
# Accepts "katana" as an argument to setup only Katana (for CI).
setup:
@python kakarot_scripts/setup/setup.py $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS))
uv sync --all-extras --dev
setup-ci:
cp .env.example .env
uv sync --all-extras --dev
katana: ;
build: $(SSJ_DIR)
uv run compile
declare: build build-sol
uv run declare
deploy: declare
uv run deploy
fetch-ef-tests:
uv run ef_tests
test-cairo-zero: deploy
uv run pytest cairo_zero/tests/src -m "not NoCI" -n logical --seed 42 --log-cli-level=INFO
uv run pytest tests/end_to_end --seed 42
test-unit-cairo-zero: build-sol
uv run pytest cairo_zero/tests/src -m "not NoCI" -n logical --seed 42
test-unit-cairo:
@PACKAGE="$(word 2,$(MAKECMDGOALS))" && \
FILTER="$(word 3,$(MAKECMDGOALS))" && cd cairo/kakarot-ssj && \
if [ -z "$$PACKAGE" ] && [ -z "$$FILTER" ]; then \
scarb test; \
elif [ -n "$$PACKAGE" ] && [ -z "$$FILTER" ]; then \
scarb test -p $$PACKAGE; \
elif [ -n "$$PACKAGE" ] && [ -n "$$FILTER" ]; then \
uv run scripts/run_filtered_tests.py scarb test -p $$PACKAGE $$FILTER; \
else \
echo "Usage: make test-unit-cairo [PACKAGE] [FILTER]"; \
exit 1; \
fi
test-end-to-end: deploy
uv run pytest tests/end_to_end --seed 42
format:
trunk check --fix
format-check:
trunk check --ci
clean:
rm -rf $(BUILD_DIR)/*.json
rm -rf $(BUILD_DIR)/fixtures/*.json
rm -rf $(SSJ_DIR)
mkdir -p $(BUILD_DIR)
check-resources:
uv run python kakarot_scripts/check_resources.py
build-sol:
git submodule update --init --recursive
forge build --names --force
run-katana:
katana --chain-id test --validate-max-steps 1000000 --invoke-max-steps 9000000 --eth-gas-price 0 --strk-gas-price 0 --disable-fee --seed 0
run-anvil:
anvil --block-base-fee-per-gas 1
run-nodes:
@echo "Starting Anvil and Katana in messaging mode"
@anvil --block-base-fee-per-gas 1 &
@katana --chain-id test --validate-max-steps 1000000 --invoke-max-steps 9000000 --eth-gas-price 0 --strk-gas-price 0 --disable-fee --messaging .katana/messaging_config.json --seed 0