This document describes the CI/CD pipeline and code quality tools used in the vtcode project.
The project uses several GitHub Actions workflows to ensure code quality and automate testing:
Triggers:
- Push to
main/masterbranches - Pull requests to
main/masterbranches
Jobs:
- Format Check (rustfmt): Ensures code is properly formatted
- Lint Check (clippy): Runs comprehensive linting
- Test: Runs tests on Ubuntu, macOS, and Windows
- Benchmarks: Performance regression testing
- Security Audit: Checks for vulnerable dependencies
- Documentation: Builds and tests documentation
Triggers:
- Push to
main/masterbranches - Pull requests to
main/masterbranches
Jobs:
- Format Check: Comprehensive rustfmt checking
- Lint Check: Research-preview clippy linting with all targets and features
- Unused Dependencies: Checks for unused dependencies
- Outdated Dependencies: Identifies outdated dependencies
- MSRV: Minimum Supported Rust Version verification
- License Check: Dependency license compliance
Triggers:
- Push to
develop/devbranches and feature branches - Pull requests to
develop/devbranches
Jobs:
- Development Check: Full development workflow
- Performance Check: Benchmark comparisons for PRs
- Code Coverage: Test coverage reporting
Triggers:
- Scheduled nightly at 3 AM UTC
- Manual trigger with reason
Jobs:
- Nightly Test: Tests against latest Rust nightly
- MSRV Test: Minimum supported version testing
- Feature Matrix: Tests different feature combinations
Installation:
rustup component add rustfmtUsage:
# Check formatting
cargo fmt --all -- --check
# Auto-format code
cargo fmt --all
# Print current configuration
cargo fmt --print-config default rustfmt.tomlConfiguration:
Create a rustfmt.toml or .rustfmt.toml file in your project root:
edition = "2021"
max_width = 100
tab_spaces = 4Installation:
rustup component add clippyUsage:
# Run clippy with warnings as errors
cargo clippy -- -D warnings
# Run on specific target
cargo clippy --lib
# Fix clippy suggestions automatically
cargo clippy --fixCommon clippy lints:
clippy::all: Enable all lintsclippy::pedantic: More strict lintsclippy::nursery: Experimental lintsclippy::cargo: Cargo.toml specific lints
Use the provided development check script to run the same checks locally:
# Run all checks
./scripts/check.sh
# Run specific checks
./scripts/check.sh fmt # Format check
./scripts/check.sh clippy # Clippy check
./scripts/check.sh test # Run tests
./scripts/check.sh build # Build project
./scripts/check.sh docs # Generate docsTo set up the development environment manually:
# Install required components
rustup component add rustfmt clippy
# Install additional tools
cargo install cargo-audit # Security auditing
cargo install cargo-outdated # Dependency checking
cargo install cargo-udeps # Unused dependencies
cargo install cargo-msrv # MSRV checking
cargo install cargo-license # License checking
cargo install cargo-tarpaulin # Code coverageSet up pre-commit hooks to run checks before committing:
# Install pre-commit (if using)
pre-commit install
# Or create .git/hooks/pre-commit manually:
#!/bin/bash
./scripts/check.shAdd to .vscode/settings.json:
{
"rust-analyzer.checkOnSave.command": "clippy",
"editor.formatOnSave": true,
"rust-analyzer.rustfmt.enableRangeFormatting": true
}autocmd BufWritePre *.rs :silent! !cargo fmt -- %:pMost Rust IDEs support rustfmt and clippy:
- IntelliJ/CLion: Built-in Rust plugin
- VS Code: rust-analyzer extension
- Vim: rust.vim plugin
- Emacs: rustic-mode
Configure branch protection rules in GitHub:
- Go to repository Settings → Branches
- Add rule for
main/masterbranch - Require status checks to pass:
fmtclippytestsecurity-audit
Add these badges to your README:
[](https://github.com/yourusername/vtcode/actions/workflows/ci.yml)
[](https://github.com/yourusername/vtcode/actions/workflows/code-quality.yml)rustup component add rustfmt
rustup updatecargo clippy -- -W clippy::allcargo msrv --workspace
cargo msrv --workspace set 1.93.0 # Set specific versioncargo update
cargo outdated
cargo udeps# In workflow
- uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]# Install cargo-audit
cargo install cargo-audit
# Run audit
cargo audit
# Fix vulnerabilities
cargo audit fix# Check licenses
cargo install cargo-license
cargo license --workspace