-
Notifications
You must be signed in to change notification settings - Fork 47
/
justfile
159 lines (129 loc) · 5.5 KB
/
justfile
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
set positional-arguments
alias t := tests
alias la := lint-all
alias l := lint-native
alias lint := lint-native
alias f := fmt-native-fix
alias b := build
alias h := hack
# default recipe to display help information
default:
@just --list
# Run all tests (excluding online tests)
tests: test test-docs
# Test for the native target with all features. By default, excludes online tests.
test *args="-E '!test(test_online)'":
cargo nextest run --workspace --all --all-features {{args}}
# Run all online tests
test-online:
just test "-E 'test(test_online)'"
# Run action tests for the client program on the native target
action-tests test_name='Test_ProgramAction' *args='':
#!/bin/bash
just monorepo
if [ ! -d "monorepo/.devnet" ]; then
echo "Building devnet allocs for the monorepo"
(cd monorepo && make devnet-allocs)
fi
echo "Building host program for the native target"
just build-native --bin kona-host --release
echo "Running action tests for the client program on the native target"
export KONA_HOST_PATH="{{justfile_directory()}}/target/release/kona-host"
export KONA_CLIENT_PATH="{{justfile_directory()}}/target/release-client-lto/kona"
cd monorepo/op-e2e/actions/proofs && \
gotestsum --format=short-verbose -- -run "{{test_name}}" {{args}} -count=1 ./...
# Clean the action tests directory
clean-actions:
rm -rf monorepo/
# Lint the workspace for all available targets
lint-all: lint-native lint-cannon lint-asterisc lint-docs
# Runs `cargo hack check` against the workspace
hack:
cargo hack check --feature-powerset --no-dev-deps
# Fixes the formatting of the workspace
fmt-native-fix:
cargo +nightly fmt --all
# Check the formatting of the workspace
fmt-native-check:
cargo +nightly fmt --all -- --check
# Lint the workspace
lint-native: fmt-native-check lint-docs
cargo +nightly clippy --workspace --all --all-features --all-targets -- -D warnings
# Lint the workspace (mips arch). Currently, only the `kona-std-fpvm` crate is linted for the `cannon` target, as it is the only crate with architecture-specific code.
lint-cannon:
docker run \
--rm \
--platform linux/amd64 \
-v `pwd`/:/workdir \
-w="/workdir" \
ghcr.io/anton-rs/kona/cannon-builder:main cargo +nightly clippy -p kona-std-fpvm --all-features --target /mips-unknown-none.json -Zbuild-std=core,alloc -- -D warnings
# Lint the workspace (risc-v arch). Currently, only the `kona-std-fpvm` crate is linted for the `asterisc` target, as it is the only crate with architecture-specific code.
lint-asterisc:
docker run \
--rm \
--platform linux/amd64 \
-v `pwd`/:/workdir \
-w="/workdir" \
ghcr.io/anton-rs/kona/asterisc-builder:main cargo +nightly clippy -p kona-std-fpvm --all-features --target riscv64gc-unknown-linux-gnu -Zbuild-std=core,alloc -- -D warnings
# Lint the Rust documentation
lint-docs:
RUSTDOCFLAGS="-D warnings" cargo doc --all --no-deps --document-private-items
# Test the Rust documentation
test-docs:
cargo test --doc --all --locked
# Build the workspace for all available targets
build: build-native build-cannon build-asterisc
# Build for the native target
build-native *args='':
cargo build --workspace $@
# Build for the `cannon` target. Any crates that require the stdlib are excluded from the build for this target.
build-cannon *args='':
docker run \
--rm \
--platform linux/amd64 \
-v `pwd`/:/workdir \
-w="/workdir" \
ghcr.io/anton-rs/kona/cannon-builder:main cargo build --workspace -Zbuild-std=core,alloc $@ --exclude kona-host
# Build for the `asterisc` target. Any crates that require the stdlib are excluded from the build for this target.
build-asterisc *args='':
docker run \
--rm \
--platform linux/amd64 \
-v `pwd`/:/workdir \
-w="/workdir" \
ghcr.io/anton-rs/kona/asterisc-builder:main cargo build --workspace -Zbuild-std=core,alloc $@ --exclude kona-host
# Build the `kona-client` prestate artifacts for the latest release.
build-client-prestate-asterisc-artifacts kona_tag asterisc_tag out='./prestate-artifacts-asterisc':
#!/bin/bash
PATH_TO_REPRO_BUILDER=./build/asterisc/asterisc-repro.dockerfile
OUTPUT_DIR={{out}}
echo "Building kona-client prestate artifacts for the asterisc target. 🐚 Kona Tag: {{kona_tag}} | 🎇 Asterisc Tag: {{asterisc_tag}}"
docker build \
-f $PATH_TO_REPRO_BUILDER \
--output $OUTPUT_DIR \
--build-arg CLIENT_TAG={{kona_tag}} \
--build-arg ASTERISC_TAG={{asterisc_tag}} \
--platform linux/amd64 \
.
# Build the `kona-client` prestate artifacts for the latest release, with an image containing the resulting
# binaries.
build-client-prestate-asterisc-image kona_tag asterisc_tag out='./prestate-artifacts-asterisc':
#!/bin/bash
PATH_TO_REPRO_BUILDER=./build/asterisc/asterisc-repro.dockerfile
OUTPUT_DIR={{out}}
echo "Building kona-client prestate artifacts for the asterisc target. 🐚 Kona Tag: {{kona_tag}} | 🎇 Asterisc Tag: {{asterisc_tag}}"
docker build \
-f $PATH_TO_REPRO_BUILDER \
-t kona-fpp-asterisc:latest \
--build-arg CLIENT_TAG={{kona_tag}} \
--build-arg ASTERISC_TAG={{asterisc_tag}} \
--platform linux/amd64 \
.
# Clones and checks out the monorepo at the commit present in `.monorepo`
monorepo:
([ ! -d monorepo ] && git clone https://github.com/ethereum-optimism/monorepo) || exit 0
cd monorepo && git checkout $(cat ../.monorepo)
# Updates the pinned version of the monorepo
update-monorepo:
[ ! -d monorepo ] && git clone https://github.com/ethereum-optimism/monorepo
cd monorepo && git rev-parse HEAD > ../.monorepo