Skip to content

Commit 8f66e7d

Browse files
committed
修复Qoder目录删除权限问题和MCP配置写入
- 修复进程管理逻辑,确保彻底终止所有Qoder相关进程 - 修正MCP配置写入逻辑,确保正确写入mcpServers键 - 修复dry-run参数传递错误 - 优化目录删除和重建流程 - 添加完整的错误处理和日志输出
1 parent 3668e2c commit 8f66e7d

32 files changed

+6707
-227
lines changed

.github/workflows/ci.yml

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main, develop ]
6+
pull_request:
7+
branches: [ main, develop ]
8+
9+
jobs:
10+
test:
11+
runs-on: ${{ matrix.os }}
12+
strategy:
13+
matrix:
14+
os: [ubuntu-latest, macos-latest, windows-latest]
15+
go-version: ['1.23.2']
16+
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v4
20+
21+
- name: Set up Go
22+
uses: actions/setup-go@v4
23+
with:
24+
go-version: ${{ matrix.go-version }}
25+
26+
- name: Install dependencies (Ubuntu)
27+
if: matrix.os == 'ubuntu-latest'
28+
run: |
29+
sudo apt-get update
30+
sudo apt-get install -y gcc-multilib
31+
32+
- name: Install dependencies (macOS)
33+
if: matrix.os == 'macos-latest'
34+
run: |
35+
# macOS 已包含必要的构建工具
36+
echo "macOS dependencies ready"
37+
38+
- name: Install dependencies (Windows)
39+
if: matrix.os == 'windows-latest'
40+
run: |
41+
# Windows 需要 gcc 来编译 SQLite
42+
choco install mingw -y
43+
44+
- name: Download dependencies
45+
run: |
46+
go mod download
47+
go mod verify
48+
49+
- name: Build
50+
run: |
51+
go build -v ./...
52+
53+
- name: Test
54+
env:
55+
CGO_ENABLED: 1
56+
run: |
57+
go test -v -race -coverprofile=coverage.out ./...
58+
59+
- name: Upload coverage to Codecov
60+
if: matrix.os == 'ubuntu-latest'
61+
uses: codecov/codecov-action@v3
62+
with:
63+
file: ./coverage.out
64+
flags: unittests
65+
name: codecov-umbrella
66+
fail_ci_if_error: false
67+
68+
lint:
69+
runs-on: ubuntu-latest
70+
steps:
71+
- name: Checkout
72+
uses: actions/checkout@v4
73+
74+
- name: Set up Go
75+
uses: actions/setup-go@v4
76+
with:
77+
go-version: '1.23.2'
78+
79+
- name: golangci-lint
80+
uses: golangci/golangci-lint-action@v3
81+
with:
82+
version: latest
83+
args: --timeout=5m
84+
85+
build-snapshot:
86+
runs-on: ubuntu-latest
87+
if: github.ref != 'refs/heads/main' # 非主分支构建快照
88+
steps:
89+
- name: Checkout
90+
uses: actions/checkout@v4
91+
with:
92+
fetch-depth: 0
93+
94+
- name: Set up Go
95+
uses: actions/setup-go@v4
96+
with:
97+
go-version: '1.23.2'
98+
99+
- name: Install dependencies
100+
run: |
101+
sudo apt-get update
102+
sudo apt-get install -y gcc-multilib gcc-mingw-w64
103+
104+
- name: Run GoReleaser (Snapshot)
105+
uses: goreleaser/goreleaser-action@v5
106+
with:
107+
distribution: goreleaser
108+
version: latest
109+
args: release --snapshot --clean
110+
env:
111+
CGO_ENABLED: 1
112+
113+
- name: Upload artifacts
114+
uses: actions/upload-artifact@v3
115+
with:
116+
name: snapshot-binaries
117+
path: dist/

.github/workflows/release.yml

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
name: Release
2+
3+
# 当推送 tag 时触发工作流
4+
on:
5+
push:
6+
tags:
7+
- 'v*'
8+
# 允许手动触发
9+
workflow_dispatch:
10+
inputs:
11+
tag:
12+
description: 'Tag to release'
13+
required: true
14+
default: 'v0.1.0'
15+
16+
# 设置权限,允许写入 contents 和 packages
17+
permissions:
18+
contents: write
19+
packages: write
20+
21+
jobs:
22+
goreleaser:
23+
runs-on: ubuntu-latest
24+
25+
steps:
26+
# 检出代码
27+
- name: 检出代码
28+
uses: actions/checkout@v4
29+
with:
30+
# 获取完整的 git 历史,GoReleaser 需要用于生成 changelog
31+
fetch-depth: 0
32+
33+
# 设置 Go 环境
34+
- name: 设置 Go 环境
35+
uses: actions/setup-go@v5
36+
with:
37+
go-version: '1.23'
38+
cache: true
39+
40+
# 安装依赖
41+
- name: 安装依赖
42+
run: |
43+
sudo apt-get update
44+
sudo apt-get install -y gcc-multilib
45+
go mod download
46+
go mod tidy
47+
48+
# 运行测试
49+
- name: 运行测试
50+
run: |
51+
go test -v ./...
52+
53+
# 验证 GoReleaser 配置
54+
- name: 验证 GoReleaser 配置
55+
uses: goreleaser/goreleaser-action@v5
56+
with:
57+
distribution: goreleaser
58+
version: latest
59+
args: check
60+
61+
# 运行 GoReleaser
62+
- name: 运行 GoReleaser
63+
uses: goreleaser/goreleaser-action@v5
64+
with:
65+
distribution: goreleaser
66+
version: latest
67+
args: release --clean
68+
env:
69+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
70+
# 如果使用私有仓库或需要特殊权限,可以使用 PAT
71+
# GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
72+
73+
# 上传构建产物作为 artifact(可选)
74+
- name: 上传构建产物
75+
uses: actions/upload-artifact@v4
76+
if: always()
77+
with:
78+
name: dist
79+
path: dist/
80+
retention-days: 30
81+
82+
# 可选:构建快照版本(用于测试)
83+
snapshot:
84+
runs-on: ubuntu-latest
85+
if: github.event_name == 'workflow_dispatch'
86+
87+
steps:
88+
- name: 检出代码
89+
uses: actions/checkout@v4
90+
with:
91+
fetch-depth: 0
92+
93+
- name: 设置 Go 环境
94+
uses: actions/setup-go@v5
95+
with:
96+
go-version: '1.23'
97+
cache: true
98+
99+
- name: 安装依赖
100+
run: |
101+
sudo apt-get update
102+
sudo apt-get install -y gcc-multilib
103+
go mod download
104+
go mod tidy
105+
106+
- name: 构建快照版本
107+
uses: goreleaser/goreleaser-action@v5
108+
with:
109+
distribution: goreleaser
110+
version: latest
111+
args: release --snapshot --clean
112+
113+
- name: 上传快照构建产物
114+
uses: actions/upload-artifact@v4
115+
with:
116+
name: snapshot-dist
117+
path: dist/
118+
retention-days: 7

0 commit comments

Comments
 (0)