This file provides guidance to AI coding agents when working with code in this repository.
CodSpeed Runner is a Rust CLI application for gathering performance data and uploading reports to CodSpeed. The binary is named codspeed and supports local and CI environments including GitHub Actions, GitLab CI, and Buildkite.
# Build the project
cargo build
# Build in release mode
cargo build --release
# Run tests
cargo test
# Run specific test
cargo test <test_name>
# Run tests with output
cargo test -- -nocapture# Build and run
cargo run -- <subcommand> <args>
# Examples:
cargo run -- auth login
cargo run -- run "cargo bench"
cargo run -- setup# Check code without building
cargo check
# Format code
cargo fmt
# Run linter
cargo clippyThe application follows a modular structure:
main.rs: Entry point with error handling and logging setupapp.rs: CLI definition using clap with subcommands (Run, Auth, Setup)api_client.rs: CodSpeed GraphQL API clientauth.rs: Authentication managementconfig.rs: Configuration loading and management
The core functionality for running benchmarks:
run_environment/: CI provider implementations (GitHub Actions, GitLab CI, Buildkite, local)runner/: Execution modes:valgrind/: Instrumentation mode using custom Valgrindwall_time/perf/: Walltime mode with perf integration
uploader/: Results upload to CodSpeed
clap: CLI framework with derive macrostokio: Async runtime (current_thread flavor)reqwest: HTTP client with middleware/retryserde/serde_json: Serializationgql_client: Custom GraphQL clienttabled: Table formatting for CLI output (https://docs.rs/tabled/latest/tabled/index.html)- Platform-specific:
procfs(Linux),linux-perf-data
CODSPEED_LOG: Set logging level (debug, info, warn, error)CODSPEED_API_URL: Override API endpoint (default: https://gql.codspeed.io/)CODSPEED_OAUTH_TOKEN: Authentication token
The project uses:
cargo testinstafor snapshot testingrstestfor parameterized teststemp-envfor environment variable testing
Test files include snapshots in snapshots/ directories for various run environment providers.
Important:
- Some tests require
sudoaccess. They are skipped by default unless theGITHUB_ACTIONSenv var is set.