Skip to content

Commit a4d1cb9

Browse files
authored
Merge pull request #3 from chennest/feature/monitoring-dashboard
GPU 风扇控制台 + 部署手册 + CI/打包
2 parents 8bb2f48 + 5aff6a8 commit a4d1cb9

79 files changed

Lines changed: 12754 additions & 404 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.claude/settings.local.json‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"permissions": {
3+
"allow": [
4+
"Bash(python:*)",
5+
"Bash(pip install:*)"
6+
],
7+
"deny": [],
8+
"ask": []
9+
}
10+
}

‎.github/workflows/ci.yml‎

Lines changed: 166 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,166 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
tags: ["v*"]
7+
pull_request:
8+
9+
# 同一分支的新推送取消还在跑的旧流水线(tag 推送各占一个 group,互不影响)
10+
concurrency:
11+
group: ci-${{ github.ref }}
12+
cancel-in-progress: true
13+
14+
permissions:
15+
contents: read
16+
17+
jobs:
18+
# ---------- ① 测试 + 前端构建 + 部署包(每次推送/PR 都跑) ----------
19+
test-and-build:
20+
runs-on: ubuntu-latest
21+
steps:
22+
- uses: actions/checkout@v4
23+
24+
- uses: actions/setup-python@v5
25+
with:
26+
python-version: "3.13" # 对齐 pve02 线上版本
27+
28+
- name: 后端单元测试
29+
run: |
30+
pip install -r app/requirements.txt
31+
python -m unittest discover -s app/tests -t . -v
32+
33+
- uses: actions/setup-node@v4
34+
with:
35+
node-version: 22
36+
cache: npm
37+
cache-dependency-path: frontend/package-lock.json
38+
39+
- name: 前端构建(含 vue-tsc 全量类型检查)
40+
working-directory: frontend
41+
run: |
42+
npm ci
43+
npm run build
44+
45+
- name: 确认前端产物就位
46+
run: test -f app/static/index.html
47+
48+
# 成员路径必须是 app/...(对齐 DEPLOY.md 坑①),排除运行时数据
49+
- name: 打部署包
50+
run: >
51+
tar czf gpu-fan-console-app.tgz
52+
--exclude='__pycache__' --exclude='*.pyc' --exclude='app/data'
53+
-C . app
54+
55+
- uses: actions/upload-artifact@v4
56+
with:
57+
name: gpu-fan-console-app
58+
path: gpu-fan-console-app.tgz
59+
60+
# ---------- ② 控制台双平台可执行(PR 不跑,省 Windows 时长) ----------
61+
build-console:
62+
if: github.event_name != 'pull_request'
63+
needs: test-and-build
64+
timeout-minutes: 30
65+
strategy:
66+
fail-fast: false
67+
matrix:
68+
include:
69+
- os: ubuntu-latest
70+
- os: windows-latest
71+
runs-on: ${{ matrix.os }}
72+
steps:
73+
- uses: actions/checkout@v4
74+
75+
# 前端产物在 ubuntu 上构建,这里从部署包里解开复用(静态资源与平台无关)
76+
- uses: actions/download-artifact@v4
77+
with:
78+
name: gpu-fan-console-app
79+
- run: tar xzf gpu-fan-console-app.tgz
80+
81+
- uses: actions/setup-python@v5
82+
with:
83+
python-version: "3.13"
84+
85+
- name: 构建控制台可执行
86+
run: |
87+
pip install -r app/requirements.txt pyinstaller
88+
python packaging/build_console.py
89+
90+
- name: 打包分发(Windows → zip / Linux → tar.gz)
91+
shell: bash
92+
run: |
93+
cd dist
94+
if [ "$RUNNER_OS" = "Windows" ]; then
95+
tar -a -cf gpu-fan-console-windows-x64.zip gpu-fan-console
96+
else
97+
tar czf gpu-fan-console-linux-x64.tar.gz gpu-fan-console
98+
fi
99+
100+
- uses: actions/upload-artifact@v4
101+
with:
102+
name: gpu-fan-console-${{ matrix.os }}
103+
path: dist/gpu-fan-console-*
104+
105+
# ---------- ③ 旧版脚本单文件可执行(PR 不跑) ----------
106+
build-legacy:
107+
if: github.event_name != 'pull_request'
108+
timeout-minutes: 30
109+
strategy:
110+
fail-fast: false
111+
matrix:
112+
include:
113+
- os: ubuntu-latest
114+
- os: windows-latest
115+
runs-on: ${{ matrix.os }}
116+
steps:
117+
- uses: actions/checkout@v4
118+
119+
- uses: actions/setup-python@v5
120+
with:
121+
python-version: "3.13"
122+
123+
- name: 构建旧脚本单文件可执行
124+
run: |
125+
pip install pyinstaller
126+
python packaging/build_legacy.py
127+
128+
- name: 按平台重命名产物
129+
shell: bash
130+
run: |
131+
cd dist
132+
for f in fancontroller fancontroller_once; do
133+
if [ "$RUNNER_OS" = "Windows" ]; then
134+
mv "$f.exe" "$f-windows-x64.exe"
135+
else
136+
mv "$f" "$f-linux-x64"
137+
fi
138+
done
139+
140+
- uses: actions/upload-artifact@v4
141+
with:
142+
name: legacy-${{ matrix.os }}
143+
path: dist/fancontroller*
144+
145+
# ---------- ④ 打 tag(v*)自动发 Release ----------
146+
release:
147+
if: startsWith(github.ref, 'refs/tags/v')
148+
needs: [test-and-build, build-console, build-legacy]
149+
runs-on: ubuntu-latest
150+
permissions:
151+
contents: write # 发 Release 需要
152+
steps:
153+
- uses: actions/download-artifact@v4
154+
with:
155+
path: artifacts
156+
merge-multiple: true
157+
158+
- name: 创建 Release 并上传全部产物
159+
env:
160+
GH_TOKEN: ${{ github.token }}
161+
run: |
162+
ls -l artifacts
163+
gh release create "$GITHUB_REF_NAME" artifacts/* \
164+
--title "gpu-fan-console $GITHUB_REF_NAME" \
165+
--generate-notes \
166+
|| gh release upload "$GITHUB_REF_NAME" artifacts/* --clobber

‎.gitignore‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
# 本地工作数据(WorkBuddy 记忆目录与 agent-ssh-cli 锁文件),不进版本库
2+
.workbuddy/
3+
agent-ssh-cli-*.lock
4+
5+
# 运行时数据:SQLite 库(绑定 + 审计)、心跳文件等,属于机器本地状态
6+
app/data/
7+
8+
# 前端构建产物:由 frontend/ 构建生成(npm run build),不进版本库
9+
app/static/
10+
111
# Byte-compiled / optimized / DLL files
212
__pycache__/
313
*.py[cod]
@@ -164,4 +174,5 @@ cython_debug/
164174
# Custom ignores
165175
fan_settings.json
166176
fancontroller.log
177+
fan_settings.yaml
167178
logs/

0 commit comments

Comments
 (0)