|
| 1 | +#!/usr/bin/env bash |
| 2 | +set -euo pipefail |
| 3 | + |
| 4 | +repo_root="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." && pwd)" |
| 5 | +cd "$repo_root" |
| 6 | + |
| 7 | +skip_cuda="${WHISPERS_LOCAL_CI_SKIP_CUDA:-0}" |
| 8 | +skip_package="${WHISPERS_LOCAL_CI_SKIP_PACKAGE:-0}" |
| 9 | +skip_release_bundle="${WHISPERS_LOCAL_CI_SKIP_RELEASE_BUNDLE:-0}" |
| 10 | + |
| 11 | +run_step() { |
| 12 | + local label="$1" |
| 13 | + shift |
| 14 | + printf '\n==> %s\n' "$label" |
| 15 | + "$@" |
| 16 | +} |
| 17 | + |
| 18 | +run_step "Check formatting" cargo fmt --all -- --check |
| 19 | +run_step "Clippy (default features)" cargo clippy --all-targets -- -D warnings |
| 20 | +run_step "Test (default features)" cargo test |
| 21 | + |
| 22 | +run_step "Check no default features" cargo check --no-default-features |
| 23 | +run_step "Check osd feature only" cargo check --no-default-features --features osd |
| 24 | +run_step "Check local rewrite feature only" cargo check --no-default-features --features local-rewrite |
| 25 | + |
| 26 | +if [[ "$skip_package" != "1" ]]; then |
| 27 | + run_step "Package crate" cargo package --locked --allow-dirty |
| 28 | +else |
| 29 | + printf '\n==> Skipping cargo package (--allow-dirty) because WHISPERS_LOCAL_CI_SKIP_PACKAGE=1\n' |
| 30 | +fi |
| 31 | + |
| 32 | +if [[ "$skip_cuda" == "1" ]]; then |
| 33 | + printf '\n==> Skipping CUDA checks because WHISPERS_LOCAL_CI_SKIP_CUDA=1\n' |
| 34 | +elif command -v nvcc >/dev/null 2>&1; then |
| 35 | + run_step "Check cuda feature only" cargo check --no-default-features --features cuda |
| 36 | + run_step "Check cuda + local rewrite features" cargo check --no-default-features --features cuda,local-rewrite |
| 37 | +else |
| 38 | + printf '\n==> Skipping CUDA checks because nvcc is not available on PATH\n' |
| 39 | +fi |
| 40 | + |
| 41 | +if [[ "$skip_release_bundle" != "1" ]]; then |
| 42 | + run_step "Build release bundle" scripts/build-release-bundle.sh |
| 43 | +else |
| 44 | + printf '\n==> Skipping release bundle because WHISPERS_LOCAL_CI_SKIP_RELEASE_BUNDLE=1\n' |
| 45 | +fi |
| 46 | + |
| 47 | +printf '\nAll local CI checks passed.\n' |
0 commit comments