ci: add default branch checks and codspeed benchmark

Merged
MA
5mo ago
+587-92

What changed

  • Add an always-run Core CI workflow for PRs targeting personal/local-clients.
  • Add a CodSpeed workflow and a small Rust normalization benchmark for initial advisory performance reporting.
  • Include personal/local-clients in existing CI workflow branch filters and replace hardcoded main coverage badge conditions with the repository default branch.
  • Make pricing command tests use fixture pricing caches instead of leaking to live network/cache state.

Why

This prepares the self-maintained fork default branch for ruleset protection and CodSpeed without blocking normal solo-maintainer direct pushes. The core required check can be enabled after this workflow lands on the default branch.

Validation

  • cargo fmt --all -- --check
  • cargo clippy --locked --workspace --all-features -- -D warnings
  • cargo test --locked --workspace --all-features
  • cargo bench --locked -p tokscale-core --bench normalization -- --test

Summary by cubic

Add Core CI for PRs targeting personal/local-clients, add CodSpeed benchmarks (simulation) for normalization and JSON/JSONL parsing, and restrict coverage to default-branch, non-PR runs with artifacts only. Actions are pinned to SHAs, pricing CLI tests are stabilized, and core dev-dependencies are centralized.

  • New Features

    • Core CI for PRs to personal/local-clients.
    • CodSpeed workflow with codspeed-criterion-compat benches for normalization and JSON/JSONL parsing; bench profile optimized for CI; CodSpeed badge in README.
    • CI workflows include personal/local-clients in branch filters; Actions pinned to SHAs; core dev-dependencies centralized.
  • Bug Fixes

    • Pricing command tests use local fixture caches and a temp HOME to avoid flakiness.
    • Fixed cargo cache/install conflict in the CodSpeed job.
    • Coverage: only on non-PR runs on the repository default branch with read-only permissions; removed badge generation/extraction and commits; artifacts only.

Summary by CodeRabbit

  • Chores
    • 新增 CodSpeed 性能测试工作流,并完善 Core CI 与代码覆盖率流程
    • 扩展多套 CI 工作流的触发分支范围,且将关键构建步骤固定到可复现的版本
    • 调整基准构建与运行配置(如 bench 构建选项与相关依赖)
  • Tests
    • 新增核心归一化/解析相关基准测试
    • 改进定价相关 CLI 测试:统一使用隔离的临时 HOME 与定价夹具环境
  • Documentation
    • README 增加 CodSpeed 指标徽标展示