ci-fix

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

CI Fix Skill

CI修复技能

Diagnose and fix GitHub Actions CI failures using patterns from past CI issues.
利用过往CI问题中的模式,诊断并修复GitHub Actions CI失败问题。

Quick Diagnosis Pattern

快速诊断流程

  1. Get CI status:
bash
gh run list --limit 5 --json status,conclusion,name,headBranch
  1. Get failed job logs:
bash
gh run view <run_id> --log --job <job_name>
  1. Categorize failure:
  • lint: fmt/clippy warnings
  • test: test failures or timeouts
  • build: compilation errors
  • security: cargo audit/deny failures
  • coverage: coverage threshold missed
  • deprecated: old action versions (common!)
  1. 获取CI状态:
bash
gh run list --limit 5 --json status,conclusion,name,headBranch
  1. 获取失败任务日志:
bash
gh run view <run_id> --log --job <job_name>
  1. 分类失败类型:
  • lint:fmt/clippy警告
  • test:测试失败或超时
  • build:编译错误
  • security:cargo audit/deny检查失败
  • coverage:未达覆盖率阈值
  • deprecated:旧版Action(常见问题!)

Common Fixes (From History)

常见修复方案(来自历史案例)

Deprecated GitHub Actions

已弃用的GitHub Actions

bash
undefined
bash
undefined

Detect

检测

grep -r "actions/checkout@v1" .github/workflows/ grep -r "actions-rs" .github/workflows/
grep -r "actions/checkout@v1" .github/workflows/ grep -r "actions-rs" .github/workflows/

Fix: Update to v2+

修复:升级到v2+版本

undefined
undefined

Optional Dependency Issues (libclang, wasmtime)

可选依赖问题(libclang, wasmtime)

bash
undefined
bash
undefined

Pattern: --all-features triggered optional dep issues

问题模式:--all-features触发可选依赖问题

Fix: Use workspace exclude

修复:使用工作区排除

cargo build --workspace --exclude memory-mcp
undefined
cargo build --workspace --exclude memory-mcp
undefined

Clippy Lint Allow-List

Clippy代码检查允许列表

bash
undefined
bash
undefined

See new warnings

查看新警告

cargo clippy --all -- -D warnings | grep "warning:"
cargo clippy --all -- -D warnings | grep "warning:"

Fix: Add #[allow(...)] comments

修复:添加#[allow(...)]注释

undefined
undefined

Coverage Threshold

覆盖率阈值

bash
undefined
bash
undefined

Generate coverage

生成覆盖率报告

cargo tarpaulin --workspace
cargo tarpaulin --workspace

Check threshold in .github/workflows/

检查工作流文件中的阈值设置

undefined
undefined

Benchmark Timeout

基准测试超时

bash
undefined
bash
undefined

Increase timeout-minutes in workflow YAML

在工作流YAML中增加timeout-minutes

undefined
undefined

Fix Commands

修复命令

bash
undefined
bash
undefined

Linting

代码检查

cargo fmt --all cargo clippy --workspace --fix --allow-dirty
cargo fmt --all cargo clippy --workspace --fix --allow-dirty

Testing

测试

cargo test --workspace -- --nocapture
cargo test --workspace -- --nocapture

Security

安全检查

cargo audit cargo deny check
cargo audit cargo deny check

Build

构建

cargo build --workspace
undefined
cargo build --workspace
undefined

Success Criteria

成功标准

  • All CI jobs pass
  • No new warnings introduced
  • Changes committed if needed
  • 所有CI任务通过
  • 未引入新警告
  • 必要时提交变更