This directory contains scripts for validating the codebase in both local development and CI/CD environments.
The main validation script that runs a comprehensive pipeline to ensure code quality, correctness, and readiness for deployment.
# Local development mode (default)
./scripts/validate.sh
# CI/CD mode (stricter validation)
./scripts/validate.sh ci
# With custom coverage threshold
COVERAGE_THRESHOLD=85 ./scripts/validate.sh ci
# With custom test timeout
TEST_TIMEOUT=15m ./scripts/validate.sh| Variable | Default | Description |
|---|---|---|
COVERAGE_THRESHOLD |
80 |
Minimum test coverage percentage required |
TEST_TIMEOUT |
10m |
Maximum time allowed for test execution |
INTEGRATION_TAG |
integration |
Build tag for integration tests |
The script runs the following validation steps in order:
- 🔍 Environment Check - Verifies Go version, git, and repository status
- 🎨 Code Formatting - Ensures code is properly formatted with
go fmt - 🔍 Comprehensive Linting - Runs
golangci-lintwith security scan, TODO detection, and style checks - 🔬 Static Analysis - Performs static analysis with
go vet - 🏗️ Build Validation - Validates clean builds and dependency management
- 🧪 Unit Tests - Runs all unit tests with race detection
- 🔗 Integration Tests - Executes integration test suite
- 📊 Coverage Check - Validates test coverage meets threshold
- 📚 Documentation - Checks for missing README files
- 🎯 TODO Check - Validates outstanding TODO items in Claude_TODO.md
- 🧹 Final Validation - Ensures clean git status (CI mode)
- 🌈 Colorful Output - Beautiful, emoji-rich terminal output
- ⚡ Fast Feedback - Fails fast on first error for quick iteration
- 🔄 Mode Awareness - Different behavior for local vs CI environments
- 📊 Detailed Reporting - Comprehensive summary with timing and statistics
- 🐧 Linux Compatible - Fully compatible with Linux, macOS, and CI environments
- 🛠️ Tool Installation - Auto-installs missing tools in CI mode
0- All validations passed ✅1- One or more validations failed ❌
Required:
- Go 1.19+
- Git
- Linux/macOS/WSL environment
Optional (auto-installed in CI):
golangci-lint- For comprehensive lintinggosec- For security scanningbc- For coverage calculations
- name: Run Validation Pipeline
run: ./scripts/validate.sh ci
env:
COVERAGE_THRESHOLD: 85validate:
script:
- ./scripts/validate.sh ci
variables:
COVERAGE_THRESHOLD: "85"For local development, the script is more forgiving:
- Missing tools show warnings instead of failures
- Documentation issues are non-blocking
- TODO items don't fail the pipeline
# Make sure you're in the project root
cd /path/to/tvzr
# Run the validation
./scripts/validate.sh
# If everything passes, you'll see:
# 🎉 ALL VALIDATIONS PASSED! 🎉
# ✨ Your code is ready to ship! ✨When adding new validation steps:
- Create a new function following the naming pattern
validate_*orrun_* - Add proper error handling and informative output
- Include emojis for visual consistency 🎨
- Test in both local and CI modes
- Update this README with the new step
Common Issues:
- Go version too old: Upgrade to Go 1.19+
- golangci-lint not found: Install from https://golangci-lint.run/usage/install/
- Coverage below threshold: Write more tests or lower
COVERAGE_THRESHOLD - Integration tests failing: Check test setup and database connections
- Git status dirty: Commit or stash your changes before running in CI mode