forked from ethereum-optimism/optimism
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathjustfile
More file actions
160 lines (129 loc) · 5.03 KB
/
Copy pathjustfile
File metadata and controls
160 lines (129 loc) · 5.03 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
# E2e integration tests for kona.
import "./tests/justfile"
# Builds docker images for kona
import "./docker/apps/justfile"
KONA_ROOT := source_directory()
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-native
alias h := hack
# default recipe to display help information
default:
@just --list
# Build the rollup node in a single command.
build-node:
cargo build --release --bin kona-node
# 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 --release --workspace --all-features {{args}}
just test-custom-embeds
# Run all online tests
test-online:
just test "-E 'test(test_online)'"
# Test custom embedded chain configuration functionality
test-custom-embeds:
cargo test --release --package kona-registry custom_chain_is_loaded_when_enabled \
--config 'env.KONA_CUSTOM_CONFIGS="true"' \
--config "env.KONA_CUSTOM_CONFIGS_DIR=\"{{justfile_directory()}}/crates/protocol/registry/tests/fixtures/custom\"" \
--config 'env.KONA_CUSTOM_CONFIGS_TEST="true"'
# Runs the tests with llvm-cov
llvm-cov-tests:
#!/usr/bin/env bash
# collect coverage of `just test` and `just test-custom-embeds`
cargo llvm-cov nextest --no-report --locked --workspace \
--all-features \
--exclude kona-node --exclude kona-p2p --exclude kona-sources \
--ignore-run-fail -E '!test(test_online)'
cargo llvm-cov nextest --no-report --locked \
--all-features \
--ignore-run-fail \
--package kona-registry \
-E 'test(custom_chain_is_loaded_when_enabled)' \
--config 'env.KONA_CUSTOM_CONFIGS="true"' \
--config "env.KONA_CUSTOM_CONFIGS_DIR=\"{{justfile_directory()}}/crates/protocol/registry/tests/fixtures/custom\"" \
--config 'env.KONA_CUSTOM_CONFIGS_TEST="true"'
cargo llvm-cov report --lcov --output-path lcov.info
# Runs benchmarks
benches:
cargo bench --no-run --workspace --features test-utils --exclude example-gossip --exclude example-discovery
# Lint the workspace for all available targets
lint-all: lint-native lint-cannon lint-docs lint-typos
# Check spelling with typos (`cargo install typos-cli`)
lint-typos:
typos
# 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 clippy --workspace --all-features --all-targets -- -D warnings
# Build the kona reproducible build environment as a local Docker image.
# Reused by lint-cannon and build-cannon-client.
build-kona-env:
#!/usr/bin/env bash
set -euo pipefail
MONOREPO_ROOT="{{KONA_ROOT}}/../.."
# The Dockerfile unconditionally COPYs from the `kona-custom-configs`
# named context. Lint and build-cannon-client never bake custom configs,
# so point it at an empty temp dir.
EMPTY_CONFIGS_DIR=$(mktemp -d)
trap 'rm -rf "${EMPTY_CONFIGS_DIR}"' EXIT
docker build \
--platform linux/amd64 \
--target kona-build-env \
--build-context kona-custom-configs="${EMPTY_CONFIGS_DIR}" \
-t kona-cannon-env:local \
-f "{{KONA_ROOT}}/docker/fpvm-prestates/cannon-repro.dockerfile" \
"$MONOREPO_ROOT"
# Lint the workspace (mips arch) inside the reproducible build environment.
# Uses the same Docker environment as the prestate build to validate against the release toolchain.
# Runs `just lint-kona-cannon` inside the container, which sets up the MIPS64 cross-compilation env.
lint-cannon: build-kona-env
docker run --rm \
-v {{KONA_ROOT}}/../..:/workdir \
-w /workdir/rust \
kona-cannon-env:local \
just lint-kona-cannon
# Lint the Rust documentation
lint-docs:
RUSTDOCFLAGS="-D warnings" cargo doc --workspace --no-deps --document-private-items
# Test the Rust documentation
test-docs:
cargo test --doc --workspace --locked
# Build for the native target
build-native *args='':
#!/usr/bin/env bash
cargo build --workspace $@
# Build the `kona-client` ELFs for the `cannon` target using the reproducible
# build environment. The bind mount of {{KONA_ROOT}}/../.. exposes the monorepo
# at /workdir, so the kona-hardforks build script's ancestor walk for
# op-core/nuts/bundles succeeds.
build-cannon-client: build-kona-env
#!/usr/bin/env bash
set -euo pipefail
docker run --rm \
-v {{KONA_ROOT}}/../..:/workdir \
-w /workdir/rust \
kona-cannon-env:local \
just build-kona-client-elfs
# Check for unused dependencies in the crate graph.
check-udeps:
cargo +nightly udeps --release --workspace --all-features --all-targets
# Updates the `superchain-registry` git submodule source
source-registry:
@just --justfile ./crates/protocol/registry/justfile source
# Generate file bindings for super-registry
bind-registry:
@just --justfile ./crates/protocol/registry/justfile bind