forked from ethereum-optimism/optimism
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjustfile
More file actions
150 lines (121 loc) · 4.36 KB
/
justfile
File metadata and controls
150 lines (121 loc) · 4.36 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
REPO_ROOT := `realpath ..` # path to the root of the optimism monorepo
KURTOSIS_DIR := REPO_ROOT + "/kurtosis-devnet"
ACCEPTOR_VERSION := env_var_or_default("ACCEPTOR_VERSION", "v3.10.2")
DOCKER_REGISTRY := env_var_or_default("DOCKER_REGISTRY", "us-docker.pkg.dev/oplabs-tools-artifacts/images")
ACCEPTOR_IMAGE := env_var_or_default("ACCEPTOR_IMAGE", DOCKER_REGISTRY + "/op-acceptor:" + ACCEPTOR_VERSION)
# Default recipe - runs acceptance tests
default:
@just acceptance-test base
jovian:
@just acceptance-test jovian
interop:
@just acceptance-test interop
cgt:
@just acceptance-test cgt
acceptance-test-all:
@just _acceptance-test base all
# Run acceptance tests with mise-managed binary
# Usage: just acceptance-test [gate]
# Examples:
# just acceptance-test base # In-process with specific gate
# just acceptance-test-all # In-process all-tests mode
acceptance-test gate="base":
@just _acceptance-test "{{gate}}" gate
_acceptance-test gate mode:
#!/usr/bin/env bash
set -euo pipefail
MODE="{{mode}}"
if [[ "$MODE" != "gate" && "$MODE" != "all" ]]; then
echo "error: invalid mode '$MODE' (expected gate|all)." >&2
exit 1
fi
if [[ "$MODE" == "gate" && "{{gate}}" == "" ]]; then
echo "error: gate must be non-empty for gate mode; use 'just acceptance-test-all' for all tests." >&2
exit 1
fi
if [[ "$MODE" == "all" ]]; then
echo -e "DEVNET: in-memory, MODE: all tests\n"
else
echo -e "DEVNET: in-memory, GATE: {{gate}}\n"
fi
# Build dependencies for in-process mode if not in CI.
# In CI jobs already take care of this, so we skip it.
if [[ -z "${CIRCLECI:-}" ]]; then
echo "Building contracts (local build)..."
cd {{REPO_ROOT}}
echo " - Updating submodules..."
git submodule update --init --recursive --single-branch -j 8
echo " - Installing mise..."
mise install
cd packages/contracts-bedrock
echo " - Installing contracts..."
just install
echo " - Forge build..."
just build-no-tests
cd {{REPO_ROOT}}
echo "Checking cannon dependencies..."
if [ ! -e {{REPO_ROOT}}/cannon/bin/cannon ] || [ ! -e {{REPO_ROOT}}/op-program/bin/prestate-mt64.bin.gz ]; then
echo "Building cannon dependencies..."
cd {{REPO_ROOT}}
make cannon-prestates
fi
echo "Building Rust binaries (kona-node, op-rbuilder, rollup-boost)..."
cd {{REPO_ROOT}}
just build-rust-release
fi
cd {{REPO_ROOT}}/op-acceptance-tests
if ! command -v mise >/dev/null; then
echo "error: mise is required for acceptance-test runs." >&2
exit 1
fi
if ! mise install op-acceptor; then
echo "error: failed to install op-acceptor with mise." >&2
exit 1
fi
BINARY_PATH=$(mise which op-acceptor)
echo "Using mise-managed binary: $BINARY_PATH"
LOG_LEVEL="$(echo "${LOG_LEVEL:-info}" | grep -E '^(debug|info|warn|error)$' || echo 'info')"
echo "LOG_LEVEL: $LOG_LEVEL"
if [[ "$MODE" == "all" ]]; then
CMD_ARGS=(
"$BINARY_PATH"
"--orchestrator" "sysgo"
"--testdir" "{{REPO_ROOT}}/op-acceptance-tests/..."
"--validators" "./acceptance-tests.yaml"
"--log.level" "${LOG_LEVEL}"
"--exclude-gates" "flake-shake"
"--allow-skips"
"--timeout" "120m"
"--show-progress"
)
else
CMD_ARGS=(
"$BINARY_PATH"
"--orchestrator" "sysgo"
"--gate" "{{gate}}"
"--testdir" "{{REPO_ROOT}}"
"--validators" "./acceptance-tests.yaml"
"--log.level" "${LOG_LEVEL}"
"--allow-skips"
"--show-progress"
)
if [[ "{{gate}}" != "flake-shake" ]]; then
CMD_ARGS+=("--exclude-gates" "flake-shake")
fi
fi
"${CMD_ARGS[@]}"
clean:
rm -rf tests/interop/loadtest/artifacts
# Build, vet, lint and test Go code in ./cmd
cmd-check:
#!/usr/bin/env bash
set -euo pipefail
cd {{REPO_ROOT}}/op-acceptance-tests
echo "Downloading Go modules..."
go mod download
echo "Building ./cmd/..."
go build ./cmd/...
echo "Running go vet on ./cmd/..."
go vet ./cmd/...
echo "Running unit tests for ./cmd/..."
go test -v ./cmd/...