From 4ed2dc9a370834502e30edd124f2d876219a3278 Mon Sep 17 00:00:00 2001 From: cheng874 Date: Thu, 2 Jul 2026 15:53:48 +0800 Subject: [PATCH 1/4] Test preview --- .github/workflows/deploy.yml | 115 +++++++++++++++++++-- docs/flaggems_vllm_en/overview/overview.md | 2 +- requirements.txt | 30 ++++-- 3 files changed, 129 insertions(+), 18 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index fffa7e65f..fba7e540e 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -1,11 +1,15 @@ name: Deploy Docs Preview on: - # 当推送到 main 分支时自动触发 + # 推送到 fork 的任意分支时触发(自动检测改动的子项目) push: - branches: ["main"] - # 允许手动触发工作流 + # 允许手动触发,并可指定要预览的子项目 workflow_dispatch: + inputs: + projects: + description: "要构建预览的子项目(空格分隔,如:flaggems_en flagcx_en)" + required: false + default: "flaggems_en" # 设置 GITHUB_TOKEN 的权限,允许写入 GitHub Pages permissions: @@ -27,6 +31,9 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v4 + with: + # 需要前一次提交以便 git diff 检测改动的子项目 + fetch-depth: 2 - name: Set up Python uses: actions/setup-python@v5 @@ -38,9 +45,105 @@ jobs: python -m pip install --upgrade pip pip install -r requirements.txt - - name: Build documentation + - name: Determine which subprojects to build + id: select run: | - sphinx-build -b html docs docs/_build/html + set -euo pipefail + + # conf.py 中定义的全部子项目(作为白名单,避免构建无效目录) + mapfile -t ALL < <(python - <<'PY' + import ast, pathlib + src = pathlib.Path("docs/conf.py").read_text(encoding="utf-8") + tree = ast.parse(src) + for node in ast.walk(tree): + if isinstance(node, ast.Assign): + for t in node.targets: + if isinstance(t, ast.Name) and t.id == "multiproject_projects": + for k in node.value.keys: + print(k.value) + PY + ) + + declare -A VALID=() + for p in "${ALL[@]}"; do VALID["$p"]=1; done + + SELECTED="" + if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then + # 手动指定 + for p in ${{ github.event.inputs.projects }}; do + if [ -n "${VALID[$p]:-}" ]; then SELECTED="$SELECTED $p"; fi + done + else + # push:从 git diff 中提取改动的顶层子项目目录 + BEFORE="${{ github.event.before }}" + if [ -z "$BEFORE" ] || ! git cat-file -e "$BEFORE^{commit}" 2>/dev/null; then + BEFORE="HEAD~1" + fi + CHANGED=$(git diff --name-only "$BEFORE" "${{ github.sha }}" -- 'docs/*' || true) + declare -A SEEN=() + while IFS= read -r f; do + # docs//... + proj=$(echo "$f" | sed -n 's#^docs/\([^/]*\)/.*#\1#p') + if [ -n "$proj" ] && [ -n "${VALID[$proj]:-}" ] && [ -z "${SEEN[$proj]:-}" ]; then + SEEN[$proj]=1 + SELECTED="$SELECTED $proj" + fi + done <<< "$CHANGED" + fi + + # 回退:未检测到改动的子项目时构建首页 + SELECTED=$(echo "$SELECTED" | xargs || true) + if [ -z "$SELECTED" ]; then SELECTED="flagos_homepage"; fi + + echo "Selected subprojects: $SELECTED" + echo "projects=$SELECTED" >> "$GITHUB_OUTPUT" + + - name: Build selected subprojects + run: | + set -uo pipefail + OUT="docs/_build/html" + rm -rf "$OUT" + mkdir -p "$OUT" + + OK="" + FAIL="" + for p in ${{ steps.select.outputs.projects }}; do + echo "::group::Building $p" + if PROJECT="$p" sphinx-build -b html docs "$OUT/$p"; then + OK="$OK $p" + else + FAIL="$FAIL $p" + echo "::warning::Build failed for subproject: $p" + fi + echo "::endgroup::" + done + + # 生成预览着陆页 + { + echo '' + echo 'Docs Preview' + echo '' + echo '

FlagOS Docs Preview

' + echo '

本页仅包含本次改动构建的子项目预览。

' + if [ -n "$FAIL" ]; then + echo "

构建失败

" + fi + echo '' + } > "$OUT/index.html" + + echo "Built:$OK" + echo "Failed:$FAIL" + # 全部失败才让任务失败 + if [ -z "$OK" ]; then + echo "::error::No subproject built successfully." + exit 1 + fi - name: Setup Pages uses: actions/configure-pages@v4 @@ -52,4 +155,4 @@ jobs: - name: Deploy to GitHub Pages id: deployment - uses: actions/deploy-pages@v4 \ No newline at end of file + uses: actions/deploy-pages@v4 diff --git a/docs/flaggems_vllm_en/overview/overview.md b/docs/flaggems_vllm_en/overview/overview.md index 1ddd91247..02f5c5a18 100644 --- a/docs/flaggems_vllm_en/overview/overview.md +++ b/docs/flaggems_vllm_en/overview/overview.md @@ -1,4 +1,4 @@ -# FlagGems-vLLM Overview +# FlagGems-vLLM Overview 概览 FlagGems-vLLM is part of [FlagOS](https://flagos.io/Home). FlagGems-vLLM is a high-performance operator library designed for multiple hardware backends. It provides optimized implementations of common vLLM operators and supports high-performance inference and deployment for a variety of widely used models. diff --git a/requirements.txt b/requirements.txt index b47b1ad13..143a8aaa2 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,13 +1,21 @@ -modelscope>=1.11.0 -sphinx -sphinx-rtd-theme +# GitHub Pages 预览构建用依赖,与 docs/requirements.txt 对齐(RTD 用后者)。 +# 额外加 matplotlib 以生成 opengraph social cards(消除构建警告)。 +sphinx==8.2.3 +myst-parser +sphinx-multiproject==1.0.0 pydata-sphinx-theme -sphinx-book-theme -sphinx-multiproject -sphinx-tabs -sphinx-prompt +sphinx-rtd-theme +sphinx-book-theme~=1.1 +sunpy-sphinx-theme +sphinx-autodoc2~=0.5.0 sphinx-design -sphinxext-opengraph -sphinx-tippy -myst-parser -sphinx-copybutton \ No newline at end of file +sphinx-copybutton +sphinxext.rediraffe~=0.3.0 +sphinxcontrib.mermaid~=0.7.1 +sphinxext.opengraph~=0.13.0 +sphinx-pyscript +sphinx-tippy>=0.4.3 +sphinx-togglebutton +sphinx-tabs==3.4.7 +sphinx-prompt==1.10.2 +matplotlib From 480a2cda2332d9e21ce548e88523c21992a9b211 Mon Sep 17 00:00:00 2001 From: cheng874 Date: Thu, 2 Jul 2026 16:22:16 +0800 Subject: [PATCH 2/4] Add preview build test marker to features.md --- docs/flaggems_vllm_en/overview/features.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/flaggems_vllm_en/overview/features.md b/docs/flaggems_vllm_en/overview/features.md index 0bd96c9be..6df70091c 100644 --- a/docs/flaggems_vllm_en/overview/features.md +++ b/docs/flaggems_vllm_en/overview/features.md @@ -1,5 +1,8 @@ # Features + +> **Preview build test** — 本行用于验证 fork 上的 GitHub Pages 预览构建(可在测试后删除)。 + FlagGems-vLLM provides the following key features: - **Operators have undergone deep performance tuning** — Each operator is carefully optimized for throughput and latency across multiple hardware backends. From 7cae66d603bb0cba864532c6a6a859ac7ed32591 Mon Sep 17 00:00:00 2001 From: cheng874 Date: Thu, 2 Jul 2026 16:25:06 +0800 Subject: [PATCH 3/4] Updated preview --- docs/flaggems_vllm_en/overview/overview.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/docs/flaggems_vllm_en/overview/overview.md b/docs/flaggems_vllm_en/overview/overview.md index 02f5c5a18..bee558ce5 100644 --- a/docs/flaggems_vllm_en/overview/overview.md +++ b/docs/flaggems_vllm_en/overview/overview.md @@ -1,4 +1,4 @@ -# FlagGems-vLLM Overview 概览 +# FlagGems-vLLM Overview FlagGems-vLLM is part of [FlagOS](https://flagos.io/Home). FlagGems-vLLM is a high-performance operator library designed for multiple hardware backends. It provides optimized implementations of common vLLM operators and supports high-performance inference and deployment for a variety of widely used models. @@ -6,8 +6,7 @@ FlagGems-vLLM is a high-performance deep learning operator library implemented u By integrating with vLLM, FlagGems-vLLM accelerates inference workloads through optimized Triton kernels that replace default operator implementations, delivering significant performance gains across diverse hardware platforms. -```{toctree} - +```{toctre features.md ``` From 4779e5613cc3887483d60e6d68bc97b75d363245 Mon Sep 17 00:00:00 2001 From: cheng874 Date: Thu, 2 Jul 2026 16:30:56 +0800 Subject: [PATCH 4/4] Remove preview tag --- docs/flaggems_vllm_en/overview/features.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/docs/flaggems_vllm_en/overview/features.md b/docs/flaggems_vllm_en/overview/features.md index 6df70091c..0bd96c9be 100644 --- a/docs/flaggems_vllm_en/overview/features.md +++ b/docs/flaggems_vllm_en/overview/features.md @@ -1,8 +1,5 @@ # Features - -> **Preview build test** — 本行用于验证 fork 上的 GitHub Pages 预览构建(可在测试后删除)。 - FlagGems-vLLM provides the following key features: - **Operators have undergone deep performance tuning** — Each operator is carefully optimized for throughput and latency across multiple hardware backends.