80 lines
2.4 KiB
Bash
Executable File
80 lines
2.4 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
if [ -f "${HOME}/.cargo/env" ]; then
|
|
# shellcheck disable=SC1091
|
|
source "${HOME}/.cargo/env"
|
|
fi
|
|
command -v cargo >/dev/null 2>&1 || {
|
|
echo "cargo is required to run strict gates" >&2
|
|
exit 1
|
|
}
|
|
|
|
# cargo-udeps injects sysroot crates on nightly; let udeps report real unused deps.
|
|
nightly_toolchain="${CARGO_NIGHTLY_TOOLCHAIN:-nightly}"
|
|
RUSTFLAGS="-A unused-crate-dependencies" cargo +"${nightly_toolchain}" udeps --workspace --all-targets --all-features --locked
|
|
|
|
deny_db_path="${CARGO_DENY_DB_PATH:-target/cargo-deny-advisory-dbs}"
|
|
deny_config="${CARGO_DENY_CONFIG:-deny.toml}"
|
|
mkdir -p "${deny_db_path}"
|
|
|
|
cargo_deny() {
|
|
case "$(uname -s 2>/dev/null || echo unknown)" in
|
|
MINGW* | MSYS* | CYGWIN*)
|
|
GIT_CONFIG_COUNT=1 \
|
|
GIT_CONFIG_KEY_0=http.sslbackend \
|
|
GIT_CONFIG_VALUE_0=openssl \
|
|
cargo deny "$@"
|
|
;;
|
|
*)
|
|
cargo deny "$@"
|
|
;;
|
|
esac
|
|
}
|
|
|
|
dump_deny_db_state() {
|
|
echo "cargo deny version: $(cargo deny --version 2>/dev/null || true)" >&2
|
|
echo "git version: $(git --version 2>/dev/null || true)" >&2
|
|
echo "cargo deny db path: ${deny_db_path}" >&2
|
|
if [ -d "${deny_db_path}" ]; then
|
|
find "${deny_db_path}" -maxdepth 2 -type d -print >&2
|
|
else
|
|
echo "cargo deny db path does not exist" >&2
|
|
fi
|
|
}
|
|
|
|
fetch_deny_db() {
|
|
cargo_deny fetch db --config "${deny_config}"
|
|
}
|
|
|
|
if ! fetch_deny_db; then
|
|
dump_deny_db_state
|
|
echo "retrying cargo deny advisory DB fetch after clearing ${deny_db_path}" >&2
|
|
rm -rf "${deny_db_path}"
|
|
mkdir -p "${deny_db_path}"
|
|
if ! fetch_deny_db; then
|
|
dump_deny_db_state
|
|
exit 1
|
|
fi
|
|
fi
|
|
if ! find "${deny_db_path}" -mindepth 1 -maxdepth 1 -type d -name 'advisory-db-*' | grep -q .; then
|
|
echo "cargo deny did not populate advisory DB under ${deny_db_path}" >&2
|
|
dump_deny_db_state
|
|
exit 1
|
|
fi
|
|
|
|
cargo_deny --locked check --disable-fetch --config "${deny_config}"
|
|
|
|
cargo run --manifest-path ./xtask/Cargo.toml -- release smoke-version --build
|
|
cargo run --manifest-path ./xtask/Cargo.toml -- docker smoke-local
|
|
command -v docker >/dev/null 2>&1 || {
|
|
echo "docker CLI is required for daemon-backed Docker smoke tests" >&2
|
|
exit 1
|
|
}
|
|
docker info >/dev/null 2>&1 || {
|
|
echo "docker daemon is required for daemon-backed Docker smoke tests" >&2
|
|
echo "attach a Docker-capable runner or split this gate to a Docker runner label" >&2
|
|
exit 1
|
|
}
|
|
cargo run --manifest-path ./xtask/Cargo.toml -- docker smoke --tag aria2-rust-pro:ci-smoke
|