CI: Use branch-versioned cargo throughout
This commit is contained in:
parent
dd54ea78ac
commit
66c3c6c2b3
|
@ -4,6 +4,8 @@ cd "$(dirname "$0")/.."
|
||||||
source ci/semver_bash/semver.sh
|
source ci/semver_bash/semver.sh
|
||||||
source ci/rust-version.sh stable
|
source ci/rust-version.sh stable
|
||||||
|
|
||||||
|
cargo="$(readlink -f ./cargo)"
|
||||||
|
|
||||||
# shellcheck disable=SC2086
|
# shellcheck disable=SC2086
|
||||||
is_crate_version_uploaded() {
|
is_crate_version_uploaded() {
|
||||||
name=$1
|
name=$1
|
||||||
|
@ -66,11 +68,11 @@ for Cargo_toml in $Cargo_tomls; do
|
||||||
(
|
(
|
||||||
set -x
|
set -x
|
||||||
rm -rf crate-test
|
rm -rf crate-test
|
||||||
cargo +"$rust_stable" init crate-test
|
"$cargo" stable init crate-test
|
||||||
cd crate-test/
|
cd crate-test/
|
||||||
echo "${crate_name} = \"${expectedCrateVersion}\"" >> Cargo.toml
|
echo "${crate_name} = \"${expectedCrateVersion}\"" >> Cargo.toml
|
||||||
echo "[workspace]" >> Cargo.toml
|
echo "[workspace]" >> Cargo.toml
|
||||||
cargo +"$rust_stable" check
|
"$cargo" stable check
|
||||||
) && really_uploaded=1
|
) && really_uploaded=1
|
||||||
if ((really_uploaded)); then
|
if ((really_uploaded)); then
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -6,7 +6,8 @@ source ci/_
|
||||||
source ci/upload-ci-artifact.sh
|
source ci/upload-ci-artifact.sh
|
||||||
|
|
||||||
eval "$(ci/channel-info.sh)"
|
eval "$(ci/channel-info.sh)"
|
||||||
source ci/rust-version.sh all
|
|
||||||
|
cargo="$(readlink -f "./cargo")"
|
||||||
|
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
export RUST_BACKTRACE=1
|
export RUST_BACKTRACE=1
|
||||||
|
@ -27,35 +28,35 @@ test -d target/debug/bpf && find target/debug/bpf -name '*.d' -delete
|
||||||
test -d target/release/bpf && find target/release/bpf -name '*.d' -delete
|
test -d target/release/bpf && find target/release/bpf -name '*.d' -delete
|
||||||
|
|
||||||
# Ensure all dependencies are built
|
# Ensure all dependencies are built
|
||||||
_ cargo +$rust_nightly build --release
|
_ "$cargo" nightly build --release
|
||||||
|
|
||||||
# Remove "BENCH_FILE", if it exists so that the following commands can append
|
# Remove "BENCH_FILE", if it exists so that the following commands can append
|
||||||
rm -f "$BENCH_FILE"
|
rm -f "$BENCH_FILE"
|
||||||
|
|
||||||
# Run sdk benches
|
# Run sdk benches
|
||||||
_ cargo +$rust_nightly bench --manifest-path sdk/Cargo.toml ${V:+--verbose} \
|
_ "$cargo" nightly bench --manifest-path sdk/Cargo.toml ${V:+--verbose} \
|
||||||
-- -Z unstable-options --format=json | tee -a "$BENCH_FILE"
|
-- -Z unstable-options --format=json | tee -a "$BENCH_FILE"
|
||||||
|
|
||||||
# Run runtime benches
|
# Run runtime benches
|
||||||
_ cargo +$rust_nightly bench --manifest-path runtime/Cargo.toml ${V:+--verbose} \
|
_ "$cargo" nightly bench --manifest-path runtime/Cargo.toml ${V:+--verbose} \
|
||||||
-- -Z unstable-options --format=json | tee -a "$BENCH_FILE"
|
-- -Z unstable-options --format=json | tee -a "$BENCH_FILE"
|
||||||
|
|
||||||
# Run core benches
|
# Run core benches
|
||||||
_ cargo +$rust_nightly bench --manifest-path core/Cargo.toml ${V:+--verbose} \
|
_ "$cargo" nightly bench --manifest-path core/Cargo.toml ${V:+--verbose} \
|
||||||
-- -Z unstable-options --format=json | tee -a "$BENCH_FILE"
|
-- -Z unstable-options --format=json | tee -a "$BENCH_FILE"
|
||||||
|
|
||||||
# Run bpf benches
|
# Run bpf benches
|
||||||
_ cargo +$rust_nightly bench --manifest-path programs/bpf/Cargo.toml ${V:+--verbose} --features=bpf_c \
|
_ "$cargo" nightly bench --manifest-path programs/bpf/Cargo.toml ${V:+--verbose} --features=bpf_c \
|
||||||
-- -Z unstable-options --format=json --nocapture | tee -a "$BENCH_FILE"
|
-- -Z unstable-options --format=json --nocapture | tee -a "$BENCH_FILE"
|
||||||
|
|
||||||
# Run banking/accounts bench. Doesn't require nightly, but use since it is already built.
|
# Run banking/accounts bench. Doesn't require nightly, but use since it is already built.
|
||||||
_ cargo +$rust_nightly run --release --manifest-path banking-bench/Cargo.toml ${V:+--verbose} | tee -a "$BENCH_FILE"
|
_ "$cargo" nightly run --release --manifest-path banking-bench/Cargo.toml ${V:+--verbose} | tee -a "$BENCH_FILE"
|
||||||
_ cargo +$rust_nightly run --release --manifest-path accounts-bench/Cargo.toml ${V:+--verbose} -- --num_accounts 10000 --num_slots 4 | tee -a "$BENCH_FILE"
|
_ "$cargo" nightly run --release --manifest-path accounts-bench/Cargo.toml ${V:+--verbose} -- --num_accounts 10000 --num_slots 4 | tee -a "$BENCH_FILE"
|
||||||
|
|
||||||
# `solana-upload-perf` disabled as it can take over 30 minutes to complete for some
|
# `solana-upload-perf` disabled as it can take over 30 minutes to complete for some
|
||||||
# reason
|
# reason
|
||||||
exit 0
|
exit 0
|
||||||
_ cargo +$rust_nightly run --release --package solana-upload-perf \
|
_ "$cargo" nightly run --release --package solana-upload-perf \
|
||||||
-- "$BENCH_FILE" "$TARGET_BRANCH" "$UPLOAD_METRICS" | tee "$BENCH_ARTIFACT"
|
-- "$BENCH_FILE" "$TARGET_BRANCH" "$UPLOAD_METRICS" | tee "$BENCH_ARTIFACT"
|
||||||
|
|
||||||
upload-ci-artifact "$BENCH_FILE"
|
upload-ci-artifact "$BENCH_FILE"
|
||||||
|
|
|
@ -8,6 +8,7 @@ source ci/_
|
||||||
source ci/rust-version.sh stable
|
source ci/rust-version.sh stable
|
||||||
source ci/rust-version.sh nightly
|
source ci/rust-version.sh nightly
|
||||||
eval "$(ci/channel-info.sh)"
|
eval "$(ci/channel-info.sh)"
|
||||||
|
cargo="$(readlink -f "./cargo")"
|
||||||
|
|
||||||
echo --- build environment
|
echo --- build environment
|
||||||
(
|
(
|
||||||
|
@ -16,14 +17,14 @@ echo --- build environment
|
||||||
rustup run "$rust_stable" rustc --version --verbose
|
rustup run "$rust_stable" rustc --version --verbose
|
||||||
rustup run "$rust_nightly" rustc --version --verbose
|
rustup run "$rust_nightly" rustc --version --verbose
|
||||||
|
|
||||||
cargo +"$rust_stable" --version --verbose
|
"$cargo" stable --version --verbose
|
||||||
cargo +"$rust_nightly" --version --verbose
|
"$cargo" nightly --version --verbose
|
||||||
|
|
||||||
cargo +"$rust_stable" clippy --version --verbose
|
"$cargo" stable clippy --version --verbose
|
||||||
cargo +"$rust_nightly" clippy --version --verbose
|
"$cargo" nightly clippy --version --verbose
|
||||||
|
|
||||||
# audit is done only with stable
|
# audit is done only with stable
|
||||||
cargo +"$rust_stable" audit --version
|
"$cargo" stable audit --version
|
||||||
)
|
)
|
||||||
|
|
||||||
export RUST_BACKTRACE=1
|
export RUST_BACKTRACE=1
|
||||||
|
@ -49,11 +50,11 @@ else
|
||||||
fi
|
fi
|
||||||
|
|
||||||
_ ci/order-crates-for-publishing.py
|
_ ci/order-crates-for-publishing.py
|
||||||
_ cargo +"$rust_stable" fmt --all -- --check
|
_ "$cargo" stable fmt --all -- --check
|
||||||
|
|
||||||
# -Z... is needed because of clippy bug: https://github.com/rust-lang/rust-clippy/issues/4612
|
# -Z... is needed because of clippy bug: https://github.com/rust-lang/rust-clippy/issues/4612
|
||||||
# run nightly clippy for `sdk/` as there's a moderate amount of nightly-only code there
|
# run nightly clippy for `sdk/` as there's a moderate amount of nightly-only code there
|
||||||
_ cargo +"$rust_nightly" clippy \
|
_ "$cargo" nightly clippy \
|
||||||
-Zunstable-options --workspace --all-targets \
|
-Zunstable-options --workspace --all-targets \
|
||||||
-- --deny=warnings --allow=clippy::stable_sort_primitive
|
-- --deny=warnings --allow=clippy::stable_sort_primitive
|
||||||
|
|
||||||
|
@ -77,14 +78,14 @@ _ scripts/cargo-for-all-lock-files.sh +"$rust_stable" audit "${cargo_audit_ignor
|
||||||
|
|
||||||
{
|
{
|
||||||
cd programs/bpf
|
cd programs/bpf
|
||||||
_ cargo +"$rust_stable" audit
|
_ "$cargo" stable audit
|
||||||
for project in rust/*/ ; do
|
for project in rust/*/ ; do
|
||||||
echo "+++ do_bpf_checks $project"
|
echo "+++ do_bpf_checks $project"
|
||||||
(
|
(
|
||||||
cd "$project"
|
cd "$project"
|
||||||
_ cargo +"$rust_stable" fmt -- --check
|
_ "$cargo" stable fmt -- --check
|
||||||
_ cargo +"$rust_nightly" test
|
_ "$cargo" nightly test
|
||||||
_ cargo +"$rust_nightly" clippy -- --deny=warnings \
|
_ "$cargo" nightly clippy -- --deny=warnings \
|
||||||
--allow=clippy::missing_safety_doc \
|
--allow=clippy::missing_safety_doc \
|
||||||
--allow=clippy::stable_sort_primitive
|
--allow=clippy::stable_sort_primitive
|
||||||
)
|
)
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
set -e
|
set -e
|
||||||
cd "$(dirname "$0")/.."
|
cd "$(dirname "$0")/.."
|
||||||
|
|
||||||
|
cargo="$(readlink -f "./cargo")"
|
||||||
|
|
||||||
source ci/_
|
source ci/_
|
||||||
|
|
||||||
annotate() {
|
annotate() {
|
||||||
|
@ -34,7 +36,7 @@ NPROC=$((NPROC>14 ? 14 : NPROC))
|
||||||
echo "Executing $testName"
|
echo "Executing $testName"
|
||||||
case $testName in
|
case $testName in
|
||||||
test-stable)
|
test-stable)
|
||||||
_ cargo +"$rust_stable" test --jobs "$NPROC" --all --exclude solana-local-cluster ${V:+--verbose} -- --nocapture
|
_ "$cargo" stable test --jobs "$NPROC" --all --exclude solana-local-cluster ${V:+--verbose} -- --nocapture
|
||||||
;;
|
;;
|
||||||
test-stable-perf)
|
test-stable-perf)
|
||||||
# BPF solana-sdk legacy compile test
|
# BPF solana-sdk legacy compile test
|
||||||
|
@ -42,7 +44,7 @@ test-stable-perf)
|
||||||
|
|
||||||
# BPF program tests
|
# BPF program tests
|
||||||
_ make -C programs/bpf/c tests
|
_ make -C programs/bpf/c tests
|
||||||
_ cargo +"$rust_stable" test \
|
_ "$cargo" stable test \
|
||||||
--manifest-path programs/bpf/Cargo.toml \
|
--manifest-path programs/bpf/Cargo.toml \
|
||||||
--no-default-features --features=bpf_c,bpf_rust -- --nocapture
|
--no-default-features --features=bpf_c,bpf_rust -- --nocapture
|
||||||
|
|
||||||
|
@ -62,13 +64,13 @@ test-stable-perf)
|
||||||
export SOLANA_CUDA=1
|
export SOLANA_CUDA=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
_ cargo +"$rust_stable" build --bins ${V:+--verbose}
|
_ "$cargo" stable build --bins ${V:+--verbose}
|
||||||
_ cargo +"$rust_stable" test --package solana-perf --package solana-ledger --package solana-core --lib ${V:+--verbose} -- --nocapture
|
_ "$cargo" stable test --package solana-perf --package solana-ledger --package solana-core --lib ${V:+--verbose} -- --nocapture
|
||||||
_ cargo +"$rust_stable" run --manifest-path poh-bench/Cargo.toml ${V:+--verbose} -- --hashes-per-tick 10
|
_ "$cargo" stable run --manifest-path poh-bench/Cargo.toml ${V:+--verbose} -- --hashes-per-tick 10
|
||||||
;;
|
;;
|
||||||
test-local-cluster)
|
test-local-cluster)
|
||||||
_ cargo +"$rust_stable" build --release --bins ${V:+--verbose}
|
_ "$cargo" stable build --release --bins ${V:+--verbose}
|
||||||
_ cargo +"$rust_stable" test --release --package solana-local-cluster ${V:+--verbose} -- --nocapture --test-threads=1
|
_ "$cargo" stable test --release --package solana-local-cluster ${V:+--verbose} -- --nocapture --test-threads=1
|
||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
|
|
|
@ -2,13 +2,14 @@
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
cd "$(dirname "$0")"
|
cd "$(dirname "$0")"
|
||||||
|
cargo="$(readlink -f "./cargo")"
|
||||||
|
|
||||||
# shellcheck source=ci/rust-version.sh
|
# shellcheck source=ci/rust-version.sh
|
||||||
source ../ci/rust-version.sh stable
|
source ../ci/rust-version.sh stable
|
||||||
|
|
||||||
: "${rust_stable:=}" # Pacify shellcheck
|
: "${rust_stable:=}" # Pacify shellcheck
|
||||||
|
|
||||||
usage=$(cargo +"$rust_stable" -q run -p solana-cli -- -C ~/.foo --help | sed -e 's|'"$HOME"'|~|g' -e 's/[[:space:]]\+$//')
|
usage=$("$cargo" stable -q run -p solana-cli -- -C ~/.foo --help | sed -e 's|'"$HOME"'|~|g' -e 's/[[:space:]]\+$//')
|
||||||
|
|
||||||
out=${1:-src/cli/usage.md}
|
out=${1:-src/cli/usage.md}
|
||||||
|
|
||||||
|
@ -36,6 +37,6 @@ in_subcommands=0
|
||||||
while read -r subcommand rest; do
|
while read -r subcommand rest; do
|
||||||
[[ $subcommand == "SUBCOMMANDS:" ]] && in_subcommands=1 && continue
|
[[ $subcommand == "SUBCOMMANDS:" ]] && in_subcommands=1 && continue
|
||||||
if ((in_subcommands)); then
|
if ((in_subcommands)); then
|
||||||
section "$(cargo +"$rust_stable" -q run -p solana-cli -- help "$subcommand" | sed -e 's|'"$HOME"'|~|g' -e 's/[[:space:]]\+$//')" "####" >> "$out"
|
section "$("$cargo" stable -q run -p solana-cli -- help "$subcommand" | sed -e 's|'"$HOME"'|~|g' -e 's/[[:space:]]\+$//')" "####" >> "$out"
|
||||||
fi
|
fi
|
||||||
done <<<"$usage">>"$out"
|
done <<<"$usage">>"$out"
|
||||||
|
|
|
@ -2,8 +2,9 @@
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
cd "$(dirname "$0")"/..
|
cd "$(dirname "$0")"/..
|
||||||
|
cargo="$(readlink -f "./cargo")"
|
||||||
|
|
||||||
cargo build --package solana-install
|
"$cargo" build --package solana-install
|
||||||
export PATH=$PWD/target/debug:$PATH
|
export PATH=$PWD/target/debug:$PATH
|
||||||
|
|
||||||
echo "\`\`\`manpage"
|
echo "\`\`\`manpage"
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
here="$(dirname "$0")"
|
||||||
|
cargo="$(readlink -f "${here}/../cargo")"
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
shifted_args=()
|
shifted_args=()
|
||||||
|
@ -37,7 +40,7 @@ for lock_file in $files; do
|
||||||
echo "--- [$lock_file]: cargo " "${shifted_args[@]}" "$@"
|
echo "--- [$lock_file]: cargo " "${shifted_args[@]}" "$@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if (set -x && cd "$(dirname "$lock_file")" && cargo "${shifted_args[@]}" "$@"); then
|
if (set -x && cd "$(dirname "$lock_file")" && "$cargo" "${shifted_args[@]}" "$@"); then
|
||||||
# noop
|
# noop
|
||||||
true
|
true
|
||||||
else
|
else
|
||||||
|
|
|
@ -2,6 +2,9 @@
|
||||||
#
|
#
|
||||||
# |cargo install| of the top-level crate will not install binaries for
|
# |cargo install| of the top-level crate will not install binaries for
|
||||||
# other workspace crates or native program crates.
|
# other workspace crates or native program crates.
|
||||||
|
here="$(dirname "$0")"
|
||||||
|
cargo="$(readlink -f "${here}../cargo")"
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
|
@ -46,7 +49,6 @@ fi
|
||||||
|
|
||||||
installDir="$(mkdir -p "$installDir"; cd "$installDir"; pwd)"
|
installDir="$(mkdir -p "$installDir"; cd "$installDir"; pwd)"
|
||||||
mkdir -p "$installDir/bin/deps"
|
mkdir -p "$installDir/bin/deps"
|
||||||
cargo=cargo
|
|
||||||
|
|
||||||
echo "Install location: $installDir ($buildVariant)"
|
echo "Install location: $installDir ($buildVariant)"
|
||||||
|
|
||||||
|
@ -112,9 +114,9 @@ mkdir -p "$installDir/bin"
|
||||||
(
|
(
|
||||||
set -x
|
set -x
|
||||||
# shellcheck disable=SC2086 # Don't want to double quote $rust_version
|
# shellcheck disable=SC2086 # Don't want to double quote $rust_version
|
||||||
$cargo $maybeRustVersion build $maybeReleaseFlag "${binArgs[@]}"
|
"$cargo" $maybeRustVersion build $maybeReleaseFlag "${binArgs[@]}"
|
||||||
# shellcheck disable=SC2086 # Don't want to double quote $rust_version
|
# shellcheck disable=SC2086 # Don't want to double quote $rust_version
|
||||||
$cargo $maybeRustVersion install spl-token-cli --root "$installDir"
|
"$cargo" $maybeRustVersion install spl-token-cli --root "$installDir"
|
||||||
)
|
)
|
||||||
|
|
||||||
for bin in "${BINS[@]}"; do
|
for bin in "${BINS[@]}"; do
|
||||||
|
|
|
@ -9,6 +9,8 @@ set -e
|
||||||
cd "$(dirname "$0")/.."
|
cd "$(dirname "$0")/.."
|
||||||
source ci/_
|
source ci/_
|
||||||
|
|
||||||
|
cargo="$(readlink -f "./cargo")"
|
||||||
|
|
||||||
: "${CI_COMMIT:=local}"
|
: "${CI_COMMIT:=local}"
|
||||||
reportName="lcov-${CI_COMMIT:0:9}"
|
reportName="lcov-${CI_COMMIT:0:9}"
|
||||||
|
|
||||||
|
@ -40,8 +42,6 @@ mkdir -p target/cov
|
||||||
# Mark the base time for a clean room dir
|
# Mark the base time for a clean room dir
|
||||||
touch target/cov/before-test
|
touch target/cov/before-test
|
||||||
|
|
||||||
source ci/rust-version.sh nightly
|
|
||||||
|
|
||||||
# Force rebuild of possibly-cached proc macro crates and build.rs because
|
# Force rebuild of possibly-cached proc macro crates and build.rs because
|
||||||
# we always want stable coverage for them
|
# we always want stable coverage for them
|
||||||
# Don't support odd file names in our repo ever
|
# Don't support odd file names in our repo ever
|
||||||
|
@ -52,8 +52,8 @@ if [[ -n $CI || -z $1 ]]; then
|
||||||
$(git grep -l "proc-macro.*true" :**/Cargo.toml | sed 's|Cargo.toml|src/lib.rs|')
|
$(git grep -l "proc-macro.*true" :**/Cargo.toml | sed 's|Cargo.toml|src/lib.rs|')
|
||||||
fi
|
fi
|
||||||
|
|
||||||
RUST_LOG=solana=trace _ cargo +$rust_nightly test --target-dir target/cov --no-run "${packages[@]}"
|
RUST_LOG=solana=trace _ "$cargo" nightly test --target-dir target/cov --no-run "${packages[@]}"
|
||||||
if RUST_LOG=solana=trace _ cargo +$rust_nightly test --target-dir target/cov "${packages[@]}" 2> target/cov/coverage-stderr.log; then
|
if RUST_LOG=solana=trace _ "$cargo" nightly test --target-dir target/cov "${packages[@]}" 2> target/cov/coverage-stderr.log; then
|
||||||
test_status=0
|
test_status=0
|
||||||
else
|
else
|
||||||
test_status=$?
|
test_status=$?
|
||||||
|
|
|
@ -3,8 +3,10 @@
|
||||||
set -ex
|
set -ex
|
||||||
cd "$(dirname "$0")"
|
cd "$(dirname "$0")"
|
||||||
|
|
||||||
|
cargo="$(readlink -f "../../cargo")"
|
||||||
|
|
||||||
if [[ ! -d googleapis ]]; then
|
if [[ ! -d googleapis ]]; then
|
||||||
git clone https://github.com/googleapis/googleapis.git
|
git clone https://github.com/googleapis/googleapis.git
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exec cargo run
|
exec "$cargo" run
|
||||||
|
|
Loading…
Reference in New Issue