#!/usr/bin/env bash # ============================================================================== # nx9-wg Development Verification Gate # ============================================================================== # PURPOSE: # Executes the full development and release quality gate suite in sequence: # 1. Formatting verification (cargo fmt --all -- --check) # 2. Workspace compilation (cargo check --workspace --all-targets) # 3. Strict Clippy linting (cargo clippy --workspace --all-targets --all-features -- -D warnings) # 4. Complete workspace unit & integration tests (cargo test --workspace --all-targets) # 5. Comprehensive CLI verification (scripts/test-cli-comprehensive.sh) # # PREREQUISITES: # - Rust toolchain (cargo, rustc, rustfmt, clippy) # # BEHAVIOR: # - 100% Non-destructive. # - Returns exit code 0 if all checks pass. # - Returns non-zero exit code immediately on any failure. # # USAGE: # bash scripts/verify.sh # ./scripts/verify.sh # ============================================================================== set -euo pipefail SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" ROOT_DIR="$(cd "${SCRIPT_DIR}/.." && pwd)" log() { echo -e "\n\033[1;34m[VERIFY]\033[0m \033[1;37m$*\033[0m" } success() { echo -e "\033[1;32m[PASS]\033[0m $*" } error() { echo -e "\033[1;31m[FAIL]\033[0m $*" >&2 exit 1 } cd "${ROOT_DIR}" log "1/5 Checking code formatting..." if cargo fmt --all -- --check; then success "Code formatting is clean." else error "Formatting check failed. Run 'cargo fmt --all' to fix." fi log "2/5 Compiling workspace targets..." if cargo check --workspace --all-targets; then success "Workspace compilation check passed." else error "Compilation check failed." fi log "3/5 Running Clippy with -D warnings..." if cargo clippy --workspace --all-targets --all-features -- -D warnings; then success "Clippy linting passed with 0 warnings." else error "Clippy check failed." fi log "4/5 Running complete workspace test suite..." if cargo test --workspace --all-targets; then success "All workspace unit and integration tests passed." else error "Workspace test suite failed." fi log "5/5 Running comprehensive CLI verification..." if bash "${SCRIPT_DIR}/test-cli-comprehensive.sh"; then success "CLI comprehensive verification suite passed." else error "CLI verification failed." fi echo -e "\n=================================================================" echo -e "\033[1;32m ALL VERIFICATION QUALITY GATES PASSED SUCCESSFULLY!\033[0m" echo -e "=================================================================\n"