Skip to content

Commit 6cd4bc5

Browse files
jstarryt-nelsonCriesofCarrots
authored
Speed up net.sh builds (solana-labs#16360)
* Speed up net.sh builds * feedback * Update net/net.sh Co-authored-by: Tyera Eulberg <[email protected]> * feedback * fix Co-authored-by: Trent Nelson <[email protected]> Co-authored-by: Tyera Eulberg <[email protected]>
1 parent 02197b1 commit 6cd4bc5

File tree

5 files changed

+38
-31
lines changed

5 files changed

+38
-31
lines changed

cargo

+3-6
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,22 @@
33
# shellcheck source=ci/rust-version.sh
44
here=$(dirname "$0")
55

6-
source "${here}"/ci/rust-version.sh all
7-
86
toolchain=
97
case "$1" in
108
stable)
9+
source "${here}"/ci/rust-version.sh stable
1110
# shellcheck disable=SC2054 # rust_stable is sourced from rust-version.sh
1211
toolchain="$rust_stable"
1312
shift
1413
;;
1514
nightly)
15+
source "${here}"/ci/rust-version.sh nightly
1616
# shellcheck disable=SC2054 # rust_nightly is sourced from rust-version.sh
1717
toolchain="$rust_nightly"
1818
shift
1919
;;
20-
+*)
21-
toolchain="${1#+}"
22-
shift
23-
;;
2420
*)
21+
source "${here}"/ci/rust-version.sh stable
2522
# shellcheck disable=SC2054 # rust_stable is sourced from rust-version.sh
2623
toolchain="$rust_stable"
2724
;;

ci/do-audit.sh

+1-3
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ src_root="$(readlink -f "${here}/..")"
77

88
cd "${src_root}"
99

10-
source ci/rust-version.sh stable
11-
1210
cargo_audit_ignores=(
1311
# failure is officially deprecated/unmaintained
1412
#
@@ -42,4 +40,4 @@ cargo_audit_ignores=(
4240
--ignore RUSTSEC-2020-0146
4341

4442
)
45-
scripts/cargo-for-all-lock-files.sh +"$rust_stable" audit "${cargo_audit_ignores[@]}"
43+
scripts/cargo-for-all-lock-files.sh stable audit "${cargo_audit_ignores[@]}"

ci/test-checks.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export RUSTFLAGS="-D warnings -A incomplete_features"
4545
# Only force up-to-date lock files on edge
4646
if [[ $CI_BASE_BRANCH = "$EDGE_CHANNEL" ]]; then
4747
# Exclude --benches as it's not available in rust stable yet
48-
if _ scripts/cargo-for-all-lock-files.sh +"$rust_stable" check --locked --tests --bins --examples; then
48+
if _ scripts/cargo-for-all-lock-files.sh stable check --locked --tests --bins --examples; then
4949
true
5050
else
5151
check_status=$?
@@ -56,7 +56,7 @@ if [[ $CI_BASE_BRANCH = "$EDGE_CHANNEL" ]]; then
5656
fi
5757

5858
# Ensure nightly and --benches
59-
_ scripts/cargo-for-all-lock-files.sh +"$rust_nightly" check --locked --all-targets
59+
_ scripts/cargo-for-all-lock-files.sh nightly check --locked --all-targets
6060
else
6161
echo "Note: cargo-for-all-lock-files.sh skipped because $CI_BASE_BRANCH != $EDGE_CHANNEL"
6262
fi

net/net.sh

+6-2
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ Operate a configured testnet
4242
startnode - Start an individual node (previously stopped with stopNode)
4343
stopnode - Stop an individual node
4444
startclients - Start client nodes only
45+
prepare - Prepare software deployment. (Build/download the software release)
4546
update - Deploy a new software update to the cluster
4647
upgrade - Upgrade software on bootstrap validator. (Restart bootstrap validator manually to run it)
4748
@@ -185,12 +186,12 @@ build() {
185186

186187
buildVariant=
187188
if $debugBuild; then
188-
buildVariant=debug
189+
buildVariant=--debug
189190
fi
190191

191192
$MAYBE_DOCKER bash -c "
192193
set -ex
193-
scripts/cargo-install-all.sh farf \"$buildVariant\"
194+
scripts/cargo-install-all.sh farf $buildVariant --validator-only
194195
"
195196
)
196197

@@ -1055,6 +1056,9 @@ start)
10551056
prepareDeploy
10561057
deploy
10571058
;;
1059+
prepare)
1060+
prepareDeploy
1061+
;;
10581062
sanity)
10591063
sanity
10601064
;;

scripts/cargo-install-all.sh

+26-18
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ usage() {
1414
echo "Error: $*"
1515
fi
1616
cat <<EOF
17-
usage: $0 [+<cargo version>] [--debug] <install directory>
17+
usage: $0 [+<cargo version>] [--debug] [--validator-only] <install directory>
1818
EOF
1919
exit $exitcode
2020
}
@@ -23,13 +23,17 @@ maybeRustVersion=
2323
installDir=
2424
buildVariant=release
2525
maybeReleaseFlag=--release
26+
validatorOnly=
2627

2728
while [[ -n $1 ]]; do
2829
if [[ ${1:0:1} = - ]]; then
2930
if [[ $1 = --debug ]]; then
3031
maybeReleaseFlag=
3132
buildVariant=debug
3233
shift
34+
elif [[ $1 = --validator-only ]]; then
35+
validatorOnly=true
36+
shift
3337
else
3438
usage "Unknown option: $1"
3539
fi
@@ -71,37 +75,37 @@ if [[ $CI_OS_NAME = windows ]]; then
7175
)
7276
else
7377
./fetch-perf-libs.sh
74-
(
75-
set -x
76-
# shellcheck disable=SC2086 # Don't want to double quote $rust_version
77-
$cargo $maybeRustVersion build $maybeReleaseFlag
78-
)
79-
8078

8179
BINS=(
82-
cargo-build-bpf
83-
cargo-test-bpf
8480
solana
8581
solana-bench-exchange
8682
solana-bench-tps
87-
solana-dos
8883
solana-faucet
8984
solana-gossip
9085
solana-install
91-
solana-install-init
9286
solana-keygen
9387
solana-ledger-tool
9488
solana-log-analyzer
9589
solana-net-shaper
96-
solana-stake-accounts
97-
solana-stake-monitor
9890
solana-sys-tuner
99-
solana-test-validator
100-
solana-tokens
10191
solana-validator
102-
solana-watchtower
10392
)
10493

94+
# Speed up net.sh deploys by excluding unused binaries
95+
if [[ -z "$validatorOnly" ]]; then
96+
BINS+=(
97+
cargo-build-bpf
98+
cargo-test-bpf
99+
solana-dos
100+
solana-install-init
101+
solana-stake-accounts
102+
solana-stake-monitor
103+
solana-test-validator
104+
solana-tokens
105+
solana-watchtower
106+
)
107+
fi
108+
105109
#XXX: Ensure `solana-genesis` is built LAST!
106110
# See https://github.com/solana-labs/solana/issues/5826
107111
BINS+=(solana-genesis)
@@ -118,8 +122,12 @@ mkdir -p "$installDir/bin"
118122
set -x
119123
# shellcheck disable=SC2086 # Don't want to double quote $rust_version
120124
"$cargo" $maybeRustVersion build $maybeReleaseFlag "${binArgs[@]}"
121-
# shellcheck disable=SC2086 # Don't want to double quote $rust_version
122-
"$cargo" $maybeRustVersion install spl-token-cli --root "$installDir"
125+
126+
# Exclude `spl-token` binary for net.sh builds
127+
if [[ -z "$validatorOnly" ]]; then
128+
# shellcheck disable=SC2086 # Don't want to double quote $rust_version
129+
"$cargo" $maybeRustVersion install spl-token-cli --root "$installDir"
130+
fi
123131
)
124132

125133
for bin in "${BINS[@]}"; do

0 commit comments

Comments
 (0)