52 lines
1.5 KiB
YAML
52 lines
1.5 KiB
YAML
# 织忆 MemoryWeave — CI/CD Pipeline (简化版)
|
|
# 可在 GitHub Actions / Gitee CI / cron 中使用
|
|
|
|
name: 织忆 CI/CD 自动评估
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
schedule:
|
|
- cron: '0 9 * * *' # 每天 9:00 UTC
|
|
|
|
jobs:
|
|
eval:
|
|
runs-on: self-hosted
|
|
steps:
|
|
- name: 健康检查
|
|
run: |
|
|
curl -sf http://localhost:7821/health || exit 1
|
|
|
|
- name: 运行评估
|
|
run: |
|
|
RESULT=$(curl -s -X POST http://localhost:7821/api/v1/eval/run \
|
|
-H "Content-Type: application/json" \
|
|
-H "X-API-Key: ${{ secrets.ZHIYI_API_KEY }}" \
|
|
-d '{"queries":[]}')
|
|
echo "$RESULT" | jq .
|
|
|
|
- name: 退化检测
|
|
run: |
|
|
TREND=$(curl -s http://localhost:7821/api/v1/eval/history \
|
|
-H "X-API-Key: ${{ secrets.ZHIYI_API_KEY }}" | jq -r '.trend')
|
|
if [ "$TREND" = "degrading" ]; then
|
|
echo "⚠️ Eval degradation detected! Check eval history."
|
|
exit 1
|
|
fi
|
|
echo "✅ Eval trend: $TREND"
|
|
|
|
- name: 统计
|
|
run: |
|
|
curl -s http://localhost:7821/api/v1/stats \
|
|
-H "X-API-Key: ${{ secrets.ZHIYI_API_KEY }}" | jq '{total_memories, total_episodes, conflicts_pending}'
|
|
|
|
backup:
|
|
runs-on: self-hosted
|
|
needs: eval
|
|
if: github.event_name == 'schedule'
|
|
steps:
|
|
- name: 触发备份
|
|
run: |
|
|
curl -s -X POST http://localhost:7821/api/v1/admin/backup \
|
|
-H "X-API-Key: ${{ secrets.ZHIYI_API_KEY }}"
|