mirror of
https://hubproxy.babadafafafafa.cn/https://github.com/Mapleawaa/PVE-Tools-9.git
synced 2026-09-20 08:03:35 +08:00
PVE-Tools.sh 从 ~14,700 行单文件重构为 150 行入口点, 所有函数按职责拆分到独立文件,通过 source 机制加载。 lib/ — 基础设施层(零业务逻辑) config.sh: 全局变量与常量 core.sh: 日志、UI、确认、备份、GRUB、进度条 network.sh: 网络检测、镜像选择 runtime.sh: 运行时守卫、main() 入口 src/modules/ — 功能模块(10 个目录) 01-optimization 02-sources 03-boot-kernel 04-gpu-passthrough 05-vm-container 06-networking 07-storage-disk 08-tools-about 09-security 10-third-party 新增 build.sh(合并编译)和 dev.sh(开发 source 入口), release.yml 新增构建步骤,CI 适配模块化结构。
44 lines
1.4 KiB
YAML
44 lines
1.4 KiB
YAML
name: PR Validation
|
|
on:
|
|
pull_request:
|
|
branches: [ main, beta ]
|
|
|
|
jobs:
|
|
validate:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Shellcheck
|
|
run: |
|
|
shellcheck -f gcc PVE-Tools.sh > shellcheck_results.txt || true
|
|
cat shellcheck_results.txt || true
|
|
if grep -q "error\|warning" shellcheck_results.txt; then
|
|
echo "Shellcheck found issues. Please fix them before merging."
|
|
exit 1
|
|
fi
|
|
|
|
- name: Shell syntax check
|
|
run: |
|
|
bash -n PVE-Tools.sh
|
|
bash -n dev.sh
|
|
bash build.sh
|
|
bash -n dist/PVE-Tools.sh
|
|
|
|
- name: Version consistency check
|
|
run: |
|
|
SCRIPT_VERSION=$(grep "CURRENT_VERSION=" lib/config.sh | cut -d'"' -f2)
|
|
VERSION_FILE_VERSION=$(cat VERSION 2>/dev/null)
|
|
if [ "$SCRIPT_VERSION" != "$VERSION_FILE_VERSION" ]; then
|
|
echo "Version inconsistency: script($SCRIPT_VERSION) != version file($VERSION_FILE_VERSION)"
|
|
exit 1
|
|
fi
|
|
|
|
- name: Security scan
|
|
run: |
|
|
# 检查是否有潜在的安全问题
|
|
if grep -q "eval\|source" PVE-Tools.sh; then
|
|
echo "Potential security issues found: eval or source commands detected"
|
|
else
|
|
echo "No security issues detected"
|
|
fi |