-
Notifications
You must be signed in to change notification settings - Fork 91
/
Copy pathjustfile
213 lines (174 loc) · 5.88 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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
####################################################
## NOTE: Minimum supported just version is 1.37.0 ##
####################################################
import 'charts/just/mod.just'
# Kubetail usage. 'just --list kubetail' for more...
mod kubetail 'dev/just/kubetail.just'
# ArgoCD usage. 'just --list argo' for more...
mod argo 'dev/just/argo.just'
# Helm usage. 'just --list helm' for more...
mod helm 'dev/just/helm.just'
_default:
@just --list
default_docker_tag := 'local'
default_repo_name := 'ghcr.io/astriaorg'
# Docker Build
###############
[doc("
Builds docker image for the crate. Defaults to 'local' tag.
NOTE: `_crate_short_name` is invoked as dependency of this command so that failure to pass a valid
binary will produce a meaningful error message.
Usage:
just docker-build [crate] <tag> <repo_name> (defaults: 'local', 'ghcr.io/astriaorg')
Example:
just docker-build astria-sequencer
")]
docker-build crate tag=default_docker_tag repo_name=default_repo_name: (_crate_short_name crate "quiet")
#!/usr/bin/env sh
set -eu
short_name=$(just _crate_short_name {{crate}})
set -x
docker buildx build --load --build-arg TARGETBINARY={{crate}} -f containerfiles/Dockerfile -t {{repo_name}}/$short_name:{{tag}} .
# Docker Build and Load
########################
[doc("
Builds and loads docker image for the crate. Defaults to 'local' tag.
NOTE: `_crate_short_name` is invoked as dependency of this command so that failure to pass a valid
binary will produce a meaningful error message.
Usage:
just docker-build-and-load [crate] <tag> <repo_name> (defaults: 'local', 'ghcr.io/astriaorg')
Example:
just docker-build-and-load astria-sequencer
")]
docker-build-and-load crate tag=default_docker_tag repo_name=default_repo_name: (_crate_short_name crate "quiet")
#!/usr/bin/env sh
set -eu
short_name=$(just _crate_short_name {{crate}})
set -x
just docker-build {{crate}} {{tag}} {{repo_name}}
just load-image $short_name {{tag}} {{repo_name}}
# Maps a crate name to the shortened name used in the docker tag.
# If `quiet` is an empty string the shortened name will be echoed. If `quiet` is a non-empty string,
# the only output will be in the case of an error, where the input `crate` is not a valid one.
_crate_short_name crate quiet="":
#!/usr/bin/env sh
set -eu
case {{crate}} in
astria-auctioneer) short_name=auctioneer ;;
astria-bridge-withdrawer) short_name=evm-bridge-withdrawer ;;
astria-cli) short_name=astria-cli ;;
astria-composer) short_name=composer ;;
astria-conductor) short_name=conductor ;;
astria-sequencer) short_name=sequencer ;;
astria-sequencer-relayer) short_name=sequencer-relayer ;;
*) echo "{{crate}} is not a supported binary" && exit 2
esac
[ -z {{quiet}} ] && echo $short_name || true
# Install CLI
##############
[doc("
Installs the Astria Rust CLI from local codebase.
")]
install-cli:
cargo install --path ./crates/astria-cli --locked
# Compile Protos
#################
[doc("
Generates rust code from protos into 'crates/astria-core/generated' to be used
throughout the codebase.
")]
compile-protos:
cargo run --manifest-path tools/protobuf-compiler/Cargo.toml
# Compile Solidity Contracts
#############################
[doc("
Compiles Solidity contracts for bridging.
")]
compile-solidity-contracts:
cargo run --manifest-path tools/solidity-compiler/Cargo.toml
####################################################
## Scripts related to formatting code and linting ##
####################################################
default_lang := 'all'
# Format
#########
[doc("
Can format 'rust', 'toml', 'proto', or 'all'. Defaults to all.
")]
fmt lang=default_lang:
@just _fmt-{{lang}}
# Lint
#######
[doc("
Can lint 'rust', 'toml', 'proto', 'md' or 'all'. Defaults to all.
Sub-lints for rust include: 'rust-fmt', 'rust-clippy', 'rust-clippy-custom', 'rust-clippy-tools', 'rust-dylint'
")]
lint lang=default_lang:
@just _lint-{{lang}}
#####################
## Private Recipes ##
#####################
_fmt-all:
@just _fmt-rust
@just _fmt-toml
@just _fmt-proto
@_lint-all:
-just _lint-rust
-just _lint-toml
-just _lint-proto
-just _lint-md
[no-exit-message]
_fmt-rust:
cargo +nightly-2024-10-03 fmt --all
[no-exit-message]
_lint-rust:
just _lint-rust-fmt
just _lint-rust-clippy
just _lint-rust-clippy-custom
just _lint-rust-clippy-tools
just _lint-rust-dylint
[no-exit-message]
_lint-rust-fmt:
cargo +nightly-2024-10-03 fmt --all -- --check
[no-exit-message]
_lint-rust-clippy:
cargo clippy --version
cargo clippy --all-targets --all-features \
-- --warn clippy::pedantic --warn clippy::arithmetic-side-effects \
--warn clippy::allow_attributes --warn clippy::allow_attributes_without_reason \
--deny warnings
[no-exit-message]
_lint-rust-clippy-custom:
cargo +nightly-2024-10-03 clippy --all-targets --all-features \
-p tracing_debug_field \
-- --warn clippy::pedantic --deny warnings
[no-exit-message]
_lint-rust-clippy-tools:
cargo clippy --manifest-path tools/protobuf-compiler/Cargo.toml \
--all-targets --all-features \
-- --warn clippy::pedantic --deny warnings
[no-exit-message]
_lint-rust-dylint:
cargo dylint --all --workspace
[no-exit-message]
_fmt-toml:
taplo format
[no-exit-message]
_lint-toml:
taplo format --check
[no-exit-message]
_lint-md:
markdownlint-cli2
[no-exit-message]
_fmt-proto:
buf format -w
[no-exit-message]
_lint-proto:
buf lint
buf format -d --exit-code
buf breaking proto/primitives --against 'buf.build/astria/primitives'
buf breaking proto/executionapis --against 'buf.build/astria/execution-apis'
buf breaking proto/sequencerblockapis --against 'buf.build/astria/sequencerblock-apis'
buf breaking proto/protocolapis --against 'buf.build/astria/protocol-apis'
buf breaking proto/composerapis --against 'buf.build/astria/composer-apis'
buf breaking proto/upgrades --against 'buf.build/astria/upgrades'