forked from kkrt-labs/ef-tests
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
56 lines (44 loc) · 1.93 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
# Heavily inspired by Reth: https://github.com/paradigmxyz/reth/blob/main/Makefile
# Include .env file to get GITHUB_TOKEN
ifneq ("$(wildcard .env)","")
include .env
endif
# The release tag of https://github.com/ethereum/tests to use for EF tests
EF_TESTS_TAG := v12.4
EF_TESTS_URL := https://github.com/ethereum/tests/archive/refs/tags/$(EF_TESTS_TAG).tar.gz
EF_TESTS_DIR := ./crates/ef-testing/ethereum-tests
# Kakarot artifacts
KKRT_ARTIFACTS_URL = $(shell curl -sL -H "Authorization: token $(GITHUB_TOKEN)" "https://api.github.com/repos/kkrt-labs/kakarot/actions/workflows/ci.yml/runs?per_page=1&branch=main&event=push&status=success" | jq -r '.workflow_runs[0].artifacts_url')
KKRT_BUILD_ARTIFACT_URL = $(shell curl -sL -H "Authorization: token $(GITHUB_TOKEN)" "$(KKRT_ARTIFACTS_URL)" | jq -r '.artifacts[] | select(.name=="kakarot-build").url')/zip
# Downloads and unpacks Ethereum Foundation tests in the `$(EF_TESTS_DIR)` directory.
# Requires `wget` and `tar`
$(EF_TESTS_DIR):
mkdir -p $(EF_TESTS_DIR)
wget $(EF_TESTS_URL) -O ethereum-tests.tar.gz
tar -xzf ethereum-tests.tar.gz --strip-components=1 -C $(EF_TESTS_DIR)
rm ethereum-tests.tar.gz
# Ensures the commands for $(EF_TESTS_DIR) always run on `make setup`, regardless if the directory exists
.PHONY: $(EF_TESTS_DIR) build
setup: $(EF_TESTS_DIR)
setup-kakarot: clean-kakarot
@curl -sL -o kakarot-build.zip -H "Authorization: token $(GITHUB_TOKEN)" "$(KKRT_BUILD_ARTIFACT_URL)"
unzip -o kakarot-build.zip -d lib/kakarot/build
rm -f kakarot-build.zip
clean-kakarot:
rm -rf lib/kakarot
mkdir -p lib/kakarot/build
# Runs all tests but integration tests
unit:
cargo test --lib
# Runs the repo tests
tests: build-ci
cargo test --test tests --lib --no-fail-fast --quiet
# Runs ef tests only
ef-test: build-ci
cargo test --test tests --no-fail-fast --quiet
# Build the rust crates
build:
cargo build --release
# Build the rust crates for ci
build-ci:
cargo build --release --features ci