Author SHA1 Message Date
yuysh 26d0ed496c Merge branch 'Addition_Docs' of http://192.168.1.198:3000/yuysh/Manlink_Doc into Addition_Docs
Build Sphinx Documentation / Build Documentation from PR Branch (pull_request) Successful in 2m2s
2025-08-29 11:23:14 +08:00
yuysh 5bba2ee808 Change index to markdown 2025-08-29 11:22:43 +08:00
yuysh 8657ca3a4c Merge branch 'master' into Addition_Docs
Build Sphinx Documentation / Build Documentation from PR Branch (pull_request) Successful in 2m2s
2025-08-29 11:15:49 +08:00
yuysh e2389b813e Mod Index
Build Sphinx Documentation / Build Documentation from PR Branch (pull_request) Successful in 2m2s
2025-08-29 11:14:03 +08:00
yuysh 899a5fb55e Add Additional Docs
Build Sphinx Documentation / Build Documentation from PR Branch (pull_request) Successful in 2m22s
2025-08-29 11:09:38 +08:00
14 changed files with 96 additions and 150 deletions
+49 -87
View File
@@ -11,118 +11,80 @@ jobs:
runs-on: linux runs-on: linux
steps: steps:
# 第一步: 设置主工作树和虚拟环境 # 第一步:更新主工作树
- name: Setup main worktree and virtual environment - name: Update main worktree
run: | run: |
echo "=== Setting up main worktree ===" echo "=== Updating main worktree ==="
# 如果主目录不存在,克隆仓库
if [ ! -d "/home/ly0kos/work/test_env" ]; then
echo "Cloning repository to main worktree..."
git clone http://localhost:3000/yuysh/Manlink_Doc.git /home/ly0kos/work/test_env
cd /home/ly0kos/work/test_env cd /home/ly0kos/work/test_env
# 创建共享虚拟环境
python3 -m venv .venv-shared
source .venv-shared/bin/activate
pip install --upgrade pip
pip install sphinx sphinx-rtd-theme
# 记录初始依赖状态
if [ -f "requirements.txt" ]; then
pip install -r requirements.txt
stat -c %Y requirements.txt > .venv-shared/last_update.txt
fi
else
cd /home/ly0kos/work/test_env
git fetch --all --prune git fetch --all --prune
git checkout master git checkout master
git pull origin master git pull origin master
fi
echo "✓ Main worktree ready" echo "✓ Main worktree updated"
# 第二步: 为PR分支创建工作树 # 第二步:复用共享虚拟环境
- name: Create worktree for PR branch
run: |
echo "=== Creating worktree for PR branch: ${{ github.head_ref }} ==="
cd /home/ly0kos/work/test_env
# 清理可能存在的旧工作树
WORKTREE_DIR="/home/ly0kos/work/test_env/worktrees/${{ github.head_ref }}"
if [ -d "$WORKTREE_DIR" ]; then
echo "Removing existing worktree..."
git worktree remove "$WORKTREE_DIR" --force 2>/dev/null || true
rm -rf "$WORKTREE_DIR" 2>/dev/null || true
fi
# 创建新的工作树
mkdir -p "/home/ly0kos/work/test_env/worktrees"
git fetch origin ${{ github.head_ref }}:${{ github.head_ref }} --force
git worktree add "/home/ly0kos/work/test_env/worktrees/${{ github.head_ref }}" ${{ github.head_ref }} --force
echo "✓ Worktree created at: /home/ly0kos/work/test_env/worktrees/${{ github.head_ref }}"
# 第三步: 复用共享虚拟环境并检查依赖更新
- name: Reuse shared virtual environment - name: Reuse shared virtual environment
run: | run: |
echo "=== Reusing shared virtual environment ===" echo "=== Using shared virtual environment ==="
cd /home/ly0kos/work/test_env cd /home/ly0kos/work/test_env
WORKTREE_DIR="/home/ly0kos/work/test_env/worktrees/${{ github.head_ref }}"
# 使用主工作树的共享虚拟环境
source .venv-shared/bin/activate source .venv-shared/bin/activate
# 检查PR分支的requirements.txt是否有更新 # 检查分支的requirements.txt是否有更新
if [ -f "$WORKTREE_DIR/requirements.txt" ]; then if [ -f "requirements.txt" ]; then
echo "Checking for dependency updates in PR branch..." REQ_MOD_TIME=$(stat -c %Y requirements.txt 2>/dev/null || echo 0)
REQ_MOD_TIME=$(stat -c %Y "$WORKTREE_DIR/requirements.txt" 2>/dev/null || echo 0)
VENV_MOD_TIME=$(cat .venv-shared/last_update.txt 2>/dev/null || echo 0) VENV_MOD_TIME=$(cat .venv-shared/last_update.txt 2>/dev/null || echo 0)
if [ $REQ_MOD_TIME -gt $VENV_MOD_TIME ]; then if [ $REQ_MOD_TIME -gt $VENV_MOD_TIME ]; then
echo "PR branch requirements updated, installing new dependencies..." echo "Master branch requirements updated, installing new dependencies..."
pip install -r "$WORKTREE_DIR/requirements.txt" pip install -r requirements.txt
echo $REQ_MOD_TIME > .venv-shared/last_update.txt echo $REQ_MOD_TIME > .venv-shared/last_update.txt
echo "Dependencies updated from PR branch"
else
echo "No changes in requirements, using existing packages"
fi fi
fi fi
echo "python3: $(python3 --version)" # 第三步:从主工作树构建文档
echo "Sphinx: $(sphinx-build --version 2>/dev/null || echo 'Not installed')" - name: Build documentation from master
# 第四步: 在工作树中构建文档
- name: Build documentation in worktree
run: | run: |
echo "=== Building documentation in worktree ===" echo "=== Building production documentation ==="
cd /home/ly0kos/work/test_env cd /home/ly0kos/work/test_env
WORKTREE_DIR="/home/ly0kos/work/test_env/worktrees/${{ github.head_ref }}"
source .venv-shared/bin/activate source .venv-shared/bin/activate
# 构建文档 rm -rf build/
cd "$WORKTREE_DIR" sphinx-build -b html source build -v -j 4
sphinx-build -b html source "$WORKTREE_DIR/build" -v -j 4 echo "✓ Production build completed"
# 复制到预览位置 # 第四步:部署到Web服务器
mkdir -p /home/ly0kos/work/test_env/pr-builds/ - name: Deploy to web server
rm -rf /home/ly0kos/work/test_env/pr-builds/${{ github.head_ref }}
cp -r "$WORKTREE_DIR/build" /home/ly0kos/work/test_env/pr-builds/${{ github.head_ref }}
echo "✓ Build completed for PR branch: ${{ github.head_ref }}"
# 第五步: 验证构建结果
- name: Verify build
run: | run: |
echo "Build output for PR ${{ github.head_ref }}:" echo "=== Deploying to production ==="
ls -la /home/ly0kos/work/test_env/pr-builds/${{ github.head_ref }}/ | head -10 cd /home/ly0kos/work/test_env
# 第六步: 复制至测试目录 rm -rf /var/www/docs_dev/*
- name: Copy to dev folder cp -r build/* /var/www/docs_dev/
echo "✓ Documentation deployed"
# 第五步:清理PR工作树
- name: Cleanup PR worktree
run: | run: |
echo "Now clear dev folder" echo "=== Cleaning up PR worktree ==="
rm -rf /var/www/docs/* cd /home/ly0kos/work/test_env
echo "Copy build to dev folder"
cp -r /home/ly0kos/work/test_env/pr-builds/${{ github.head_ref }}/* /var/www/docs/ WORKTREE_DIR="/home/ly0kos/work/test_env/worktrees/${{ github.head_ref }}"
echo "✓ Documentation in Product folder now!" if [ -d "$WORKTREE_DIR" ]; then
echo "Please check http://mkb.local to See Changes" git worktree remove "$WORKTREE_DIR" --force
echo "✓ Removed worktree for ${{ github.head_ref }}"
fi
# 清理预览文件
PREVIEW_DIR="/home/ly0kos/work/test_env/pr-builds/${{ github.head_ref }}"
if [ -d "$PREVIEW_DIR" ]; then
rm -rf "$PREVIEW_DIR"
echo "✓ Removed preview for ${{ github.head_ref }}"
fi
# 第六步:验证部署
- name: Verify deployment
run: |
echo "Production deployment completed!"
ls -la /var/www/docs_dev/ | head -10
+8 -9
View File
@@ -11,7 +11,7 @@ jobs:
runs-on: linux runs-on: linux
steps: steps:
# 第一步: 设置主工作树和虚拟环境 # 第一步设置主工作树和虚拟环境
- name: Setup main worktree and virtual environment - name: Setup main worktree and virtual environment
run: | run: |
echo "=== Setting up main worktree ===" echo "=== Setting up main worktree ==="
@@ -23,7 +23,7 @@ jobs:
cd /home/ly0kos/work/test_env cd /home/ly0kos/work/test_env
# 创建共享虚拟环境 # 创建共享虚拟环境
python3 -m venv .venv-shared python -m venv .venv-shared
source .venv-shared/bin/activate source .venv-shared/bin/activate
pip install --upgrade pip pip install --upgrade pip
pip install sphinx sphinx-rtd-theme pip install sphinx sphinx-rtd-theme
@@ -42,7 +42,7 @@ jobs:
echo "✓ Main worktree ready" echo "✓ Main worktree ready"
# 第二步: 为PR分支创建工作树 # 第二步为PR分支创建工作树
- name: Create worktree for PR branch - name: Create worktree for PR branch
run: | run: |
echo "=== Creating worktree for PR branch: ${{ github.head_ref }} ===" echo "=== Creating worktree for PR branch: ${{ github.head_ref }} ==="
@@ -63,7 +63,7 @@ jobs:
echo "✓ Worktree created at: /home/ly0kos/work/test_env/worktrees/${{ github.head_ref }}" echo "✓ Worktree created at: /home/ly0kos/work/test_env/worktrees/${{ github.head_ref }}"
# 第三步: 复用共享虚拟环境并检查依赖更新 # 第三步复用共享虚拟环境并检查依赖更新
- name: Reuse shared virtual environment - name: Reuse shared virtual environment
run: | run: |
echo "=== Reusing shared virtual environment ===" echo "=== Reusing shared virtual environment ==="
@@ -89,10 +89,10 @@ jobs:
fi fi
fi fi
echo "python3: $(python3 --version)" echo "Python: $(python --version)"
echo "Sphinx: $(sphinx-build --version 2>/dev/null || echo 'Not installed')" echo "Sphinx: $(sphinx-build --version 2>/dev/null || echo 'Not installed')"
# 第四步: 在工作树中构建文档 # 第四步在工作树中构建文档
- name: Build documentation in worktree - name: Build documentation in worktree
run: | run: |
echo "=== Building documentation in worktree ===" echo "=== Building documentation in worktree ==="
@@ -111,13 +111,13 @@ jobs:
echo "✓ Build completed for PR branch: ${{ github.head_ref }}" echo "✓ Build completed for PR branch: ${{ github.head_ref }}"
# 第五步: 验证构建结果 # 第五步验证构建结果
- name: Verify build - name: Verify build
run: | run: |
echo "Build output for PR ${{ github.head_ref }}:" echo "Build output for PR ${{ github.head_ref }}:"
ls -la /home/ly0kos/work/test_env/pr-builds/${{ github.head_ref }}/ | head -10 ls -la /home/ly0kos/work/test_env/pr-builds/${{ github.head_ref }}/ | head -10
# 第六步: 复制至测试目录 # 第六步复制至测试目录
- name: Copy to dev folder - name: Copy to dev folder
run: | run: |
echo "Now clear dev folder" echo "Now clear dev folder"
@@ -126,4 +126,3 @@ jobs:
cp -r /home/ly0kos/work/test_env/pr-builds/${{ github.head_ref }}/* /var/www/docs_dev/ cp -r /home/ly0kos/work/test_env/pr-builds/${{ github.head_ref }}/* /var/www/docs_dev/
echo "✓ Documentation in DEV folder now!" echo "✓ Documentation in DEV folder now!"
echo "Please check http://mkb.local:880 to Verify Changes" echo "Please check http://mkb.local:880 to Verify Changes"
-1
View File
@@ -7,4 +7,3 @@ M060 Specifications
:glob: :glob:
* *
VI/index
-17
View File
@@ -1,17 +0,0 @@
document.addEventListener('DOMContentLoaded', function() {
// 禁用右键菜单
document.addEventListener('contextmenu', function(e) {
e.preventDefault();
});
// 禁用文本选择
document.styleSheets[0].addRule('body', '-webkit-user-select: none!important;');
document.styleSheets[0].addRule('body', '-moz-user-select: none!important;');
document.styleSheets[0].addRule('body', '-ms-user-select: none!important;');
document.styleSheets[0].addRule('body', 'user-select: none!important;');
// 禁用拖拽
document.addEventListener('dragstart', function(e) {
e.preventDefault();
});
});
+1 -4
View File
@@ -59,10 +59,6 @@ html_theme_options = {
# ================= 高级功能 ================= # ================= 高级功能 =================
html_js_files = [
'custom.js'
]
# ================== Mermaid 配置 ================== # ================== Mermaid 配置 ==================
def find_system_chrome(): def find_system_chrome():
"""自动检测系统 Chrome/Chromium 可执行路径""" """自动检测系统 Chrome/Chromium 可执行路径"""
@@ -121,6 +117,7 @@ try:
except Exception as e: except Exception as e:
print(f"⚠️ Mermaid 初始化失败: {e}") print(f"⚠️ Mermaid 初始化失败: {e}")
print("⚠️ 图表将显示为代码块,请安装 Chrome 和 mermaid-cli") print("⚠️ 图表将显示为代码块,请安装 Chrome 和 mermaid-cli")
extensions.discard('sphinxcontrib.mermaid')
# ================= CHM特化配置 ================= # ================= CHM特化配置 =================
if is_chm_build: if is_chm_build:
+32
View File
@@ -0,0 +1,32 @@
---
title: ManLin 硬件产品知识库
---
# ManLin 硬件产品知识库
```{toctree}
:maxdepth: 1
:caption: 目录
Mars_1KS/index
Calibration/index
Lab_Report/index
```
## 附加文档
1. [AD5522](_static/data/add_docs/AD5522.pdf)
2. :::{dropdown} Power DataSheets
- [LTM4655](_static/data/add_docs/Pwr_DataSheet/ltm4655.pdf)
- [MIC29502](_static/data/add_docs/Pwr_DataSheet/MIC29502.pdf)
- [LMR51450](_static/data/add_docs/Pwr_DataSheet/LMR51450.pdf)
- [TPS54627](_static/data/add_docs/Pwr_DataSheet/tps54627.pdf)
- [TPS54821](_static/data/add_docs/Pwr_DataSheet/tps54821.pdf)
- [TPS563209](_static/data/add_docs/Pwr_DataSheet/tps563209.pdf)
- [LT3091](_static/data/add_docs/Pwr_DataSheet/lt3091.pdf)
:::
3.
-26
View File
@@ -1,26 +0,0 @@
.. ManLin_KnowledgeBase documentation master file, created by
sphinx-quickstart on Tue Aug 12 05:35:46 2025.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
.. ManLin 硬件知识库主索引文件
.. 注意:此文件使用 reStructuredText 语法,但支持包含 Markdown 文件
##############################
ManLin 硬件产品知识库
##############################
.. toctree::
:maxdepth: 1
:caption: Contents:
Mars_1KS/index
Calibration/index
Lab_Report/index
*Additional Docs:*
1. `AD5522 <_static/data/add_docs/AD5522.pdf>`_