2018-11-21 12:16:16 -08:00
|
|
|
#!/usr/bin/env bash
|
2023-01-17 11:55:41 -08:00
|
|
|
# To prevent usange of `./cargo` without `nightly`
|
|
|
|
# Introduce cargoNighlty and disable warning to use word splitting
|
|
|
|
# shellcheck disable=SC2086
|
2020-06-15 21:40:53 -07:00
|
|
|
|
2018-11-21 12:16:16 -08:00
|
|
|
set -e
|
|
|
|
|
|
|
|
cd "$(dirname "$0")/.."
|
|
|
|
|
2018-12-18 14:25:10 -08:00
|
|
|
source ci/_
|
2019-03-14 19:41:05 -07:00
|
|
|
source ci/rust-version.sh stable
|
2019-06-20 07:43:31 -07:00
|
|
|
source ci/rust-version.sh nightly
|
2020-06-18 10:04:37 -07:00
|
|
|
eval "$(ci/channel-info.sh)"
|
2023-01-17 11:55:41 -08:00
|
|
|
cargoNightly="$(readlink -f "./cargo") nightly"
|
2018-12-18 14:25:10 -08:00
|
|
|
|
2023-10-10 12:08:14 -07:00
|
|
|
# check that cargo-hack has been installed
|
|
|
|
if ! $cargoNightly hack --version >/dev/null 2>&1; then
|
|
|
|
cat >&2 <<EOF
|
|
|
|
ERROR: cargo hack failed.
|
|
|
|
install 'cargo hack' with 'cargo install cargo-hack'
|
|
|
|
EOF
|
|
|
|
fi
|
|
|
|
|
2020-06-15 21:40:53 -07:00
|
|
|
echo --- build environment
|
|
|
|
(
|
|
|
|
set -x
|
|
|
|
|
|
|
|
rustup run "$rust_stable" rustc --version --verbose
|
|
|
|
rustup run "$rust_nightly" rustc --version --verbose
|
|
|
|
|
2023-01-17 11:55:41 -08:00
|
|
|
cargo --version --verbose
|
|
|
|
$cargoNightly --version --verbose
|
2020-06-15 21:40:53 -07:00
|
|
|
|
2023-01-17 11:55:41 -08:00
|
|
|
cargo clippy --version --verbose
|
|
|
|
$cargoNightly clippy --version --verbose
|
2020-06-15 21:40:53 -07:00
|
|
|
|
2023-07-06 17:30:20 -07:00
|
|
|
$cargoNightly hack --version --verbose
|
|
|
|
|
2021-07-09 03:49:07 -07:00
|
|
|
# audit is done only with "$cargo stable"
|
2023-01-17 11:55:41 -08:00
|
|
|
cargo audit --version
|
2021-07-09 03:49:07 -07:00
|
|
|
|
|
|
|
grcov --version
|
2023-04-24 21:11:58 -07:00
|
|
|
|
|
|
|
sccache --version
|
2023-04-25 07:08:01 -07:00
|
|
|
|
|
|
|
wasm-pack --version
|
2020-06-15 21:40:53 -07:00
|
|
|
)
|
|
|
|
|
2018-11-21 12:16:16 -08:00
|
|
|
export RUST_BACKTRACE=1
|
2020-07-10 11:06:10 -07:00
|
|
|
export RUSTFLAGS="-D warnings -A incomplete_features"
|
2018-11-21 12:16:16 -08:00
|
|
|
|
2023-03-12 22:28:34 -07:00
|
|
|
# run cargo check for all rust files in this monorepo for faster turnaround in
|
|
|
|
# case of any compilation/build error for nightly
|
|
|
|
|
2020-06-18 10:04:37 -07:00
|
|
|
# Only force up-to-date lock files on edge
|
|
|
|
if [[ $CI_BASE_BRANCH = "$EDGE_CHANNEL" ]]; then
|
2023-03-12 22:28:34 -07:00
|
|
|
if _ scripts/cargo-for-all-lock-files.sh "+${rust_nightly}" check --locked --workspace --all-targets --features dummy-for-ci-check; then
|
2020-06-18 10:04:37 -07:00
|
|
|
true
|
|
|
|
else
|
|
|
|
check_status=$?
|
2020-07-03 02:08:12 -07:00
|
|
|
echo "$0: Some Cargo.lock might be outdated; sync them (or just be a compilation error?)" >&2
|
|
|
|
echo "$0: protip: $ ./scripts/cargo-for-all-lock-files.sh [--ignore-exit-code] ... \\" >&2
|
|
|
|
echo "$0: [tree (for outdated Cargo.lock sync)|check (for compilation error)|update -p foo --precise x.y.z (for your Cargo.toml update)] ..." >&2
|
2020-06-18 10:04:37 -07:00
|
|
|
exit "$check_status"
|
|
|
|
fi
|
2020-04-20 18:07:29 -07:00
|
|
|
else
|
2020-06-18 10:04:37 -07:00
|
|
|
echo "Note: cargo-for-all-lock-files.sh skipped because $CI_BASE_BRANCH != $EDGE_CHANNEL"
|
2020-04-20 18:07:29 -07:00
|
|
|
fi
|
2020-06-18 10:04:37 -07:00
|
|
|
|
2023-05-25 23:22:03 -07:00
|
|
|
_ ci/order-crates-for-publishing.py
|
2019-08-12 15:41:17 -07:00
|
|
|
|
2023-11-08 02:50:38 -08:00
|
|
|
_ scripts/cargo-clippy.sh
|
2023-05-17 14:09:23 -07:00
|
|
|
|
2023-02-16 21:21:11 -08:00
|
|
|
if [[ -n $CI ]]; then
|
|
|
|
# exclude from printing "Checking xxx ..."
|
|
|
|
_ scripts/cargo-for-all-lock-files.sh -- "+${rust_nightly}" sort --workspace --check > /dev/null
|
|
|
|
else
|
|
|
|
_ scripts/cargo-for-all-lock-files.sh -- "+${rust_nightly}" sort --workspace --check
|
|
|
|
fi
|
|
|
|
|
2023-07-06 17:30:20 -07:00
|
|
|
_ scripts/check-dev-context-only-utils.sh tree
|
|
|
|
|
2023-01-17 11:55:41 -08:00
|
|
|
_ scripts/cargo-for-all-lock-files.sh -- "+${rust_nightly}" fmt --all -- --check
|
2021-02-28 11:54:04 -08:00
|
|
|
|
2023-05-25 23:22:03 -07:00
|
|
|
_ ci/do-audit.sh
|
2019-07-28 22:19:03 -07:00
|
|
|
|
2023-12-14 09:18:34 -08:00
|
|
|
if [[ -n $CI ]] && [[ $CHANNEL = "stable" ]]; then
|
|
|
|
_ ci/check-install-all.sh
|
|
|
|
fi
|
|
|
|
|
2018-12-18 18:32:45 -08:00
|
|
|
echo --- ok
|