W18: context cleanup + CLI fixes + loader audit + CI matrix (W18.1-W18.4)
- W18.1 (王测+林深): Remove g_max_tokens dead API, UTF-8 bounds protection, deduplicate token counting, 0xC0/0xC1 handling, add 13 test blocks (36 checks) - W18.2 (赵码+朱晴): Fix /context no-session error message, /status 3-state connection display - W18.3 (曹武+徐磊): plugin_loader security audit — 9 dimensions, rating C, 1 HIGH + 2 MEDIUM findings - W18.4 (马奔+胡桐): CI dual-platform matrix (Ubuntu clang-18 + Windows clang-cl), ccache, build timing baseline Build 0 error, ctest 5/5 pass, metadata check clean. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
90
.github/workflows/ci.yml
vendored
90
.github/workflows/ci.yml
vendored
@@ -6,6 +6,11 @@ on:
|
||||
pull_request:
|
||||
branches: [master]
|
||||
|
||||
env:
|
||||
CMAKE_BUILD_PARALLEL_LEVEL: 0
|
||||
CCACHE_DIR: ${{ github.workspace }}/.ccache
|
||||
CCACHE_MAXSIZE: 256M
|
||||
|
||||
jobs:
|
||||
# ── 动态矩阵 ──────────────────────────────────────────────
|
||||
# PR 仅跑 Ubuntu 节省 minutes;push master 跑全矩阵 Ubuntu + Windows
|
||||
@@ -36,11 +41,48 @@ jobs:
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
steps:
|
||||
# ── 1. 源码检出 ──────────────────────────────────────
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 1
|
||||
|
||||
# ── 2. 平台编译工具链 ─────────────────────────────────
|
||||
# Ubuntu: clang-18 + Ninja + ccache
|
||||
- name: Install toolchain (Ubuntu)
|
||||
if: runner.os == 'Linux'
|
||||
run: |
|
||||
sudo apt-get update -qq
|
||||
sudo apt-get install -y -qq clang-18 ninja-build ccache
|
||||
echo "CC=clang-18" >> $GITHUB_ENV
|
||||
echo "CXX=clang++-18" >> $GITHUB_ENV
|
||||
|
||||
# Windows: LLVM (clang-cl) + Ninja + ccache
|
||||
- name: Install toolchain (Windows)
|
||||
if: runner.os == 'Windows'
|
||||
shell: bash
|
||||
run: |
|
||||
choco install -y llvm ninja ccache --no-progress 2>/dev/null || true
|
||||
# Add clang-cl to PATH (both possible locations)
|
||||
if [ -d "/c/Program Files/LLVM/bin" ]; then
|
||||
echo "/c/Program Files/LLVM/bin" >> $GITHUB_PATH
|
||||
elif [ -d "/c/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Tools/Llvm/x64/bin" ]; then
|
||||
echo "/c/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Tools/Llvm/x64/bin" >> $GITHUB_PATH
|
||||
fi
|
||||
echo "CC=clang-cl" >> $GITHUB_ENV
|
||||
echo "CXX=clang-cl" >> $GITHUB_ENV
|
||||
|
||||
# ── 3. ccache 缓存恢复 ────────────────────────────────
|
||||
- name: Cache ccache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ${{ env.CCACHE_DIR }}
|
||||
key: ${{ runner.os }}-ccache-${{ matrix.build_type }}-${{ github.run_id }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-ccache-${{ matrix.build_type }}-
|
||||
${{ runner.os }}-ccache-
|
||||
|
||||
# ── 4. Python + Conan ─────────────────────────────────
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
@@ -49,6 +91,7 @@ jobs:
|
||||
- name: Install Conan
|
||||
run: pip install conan
|
||||
|
||||
# ── 5. Conan 依赖缓存 ─────────────────────────────────
|
||||
- name: Cache Conan
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
@@ -60,16 +103,57 @@ jobs:
|
||||
${{ runner.os }}-conan-${{ matrix.build_type }}-
|
||||
${{ runner.os }}-conan-
|
||||
|
||||
# ── 6. Conan 依赖安装 ─────────────────────────────────
|
||||
- name: Install Conan dependencies
|
||||
shell: bash
|
||||
run: |
|
||||
conan profile detect --force
|
||||
conan install deps --build=missing -s build_type=${{ matrix.build_type }}
|
||||
|
||||
# ── 7. CMake 配置 ─────────────────────────────────────
|
||||
- name: Configure CMake
|
||||
run: cmake --preset conan-release
|
||||
shell: bash
|
||||
run: |
|
||||
cmake --preset ci-release \
|
||||
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
|
||||
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache
|
||||
|
||||
# ── 8. 构建(含计时) ─────────────────────────────────
|
||||
- name: Build
|
||||
run: cmake --build --preset conan-release --config ${{ matrix.build_type }}
|
||||
id: build
|
||||
shell: bash
|
||||
run: |
|
||||
echo "::group::Build (${{ matrix.os }})"
|
||||
START_NS=$(date +%s%N 2>/dev/null || echo 0)
|
||||
START_S=$(date +%s)
|
||||
cmake --build --preset ci-release --config ${{ matrix.build_type }}
|
||||
END_S=$(date +%s)
|
||||
END_NS=$(date +%s%N 2>/dev/null || echo 0)
|
||||
DURATION=$((END_S - START_S))
|
||||
echo "::endgroup::"
|
||||
echo "duration=${DURATION}" >> $GITHUB_OUTPUT
|
||||
echo "Build wall time: ${DURATION}s"
|
||||
|
||||
# ── 9. ccache 统计 ────────────────────────────────────
|
||||
- name: ccache stats
|
||||
if: always()
|
||||
shell: bash
|
||||
run: |
|
||||
ccache -s || echo "ccache stats unavailable"
|
||||
ccache -z || true
|
||||
|
||||
# ── 10. 测试 ──────────────────────────────────────────
|
||||
- name: Test
|
||||
run: ctest --preset conan-release -C ${{ matrix.build_type }} --output-on-failure
|
||||
shell: bash
|
||||
run: ctest --preset ci-release -C ${{ matrix.build_type }} --output-on-failure
|
||||
|
||||
# ── 11. 构建时间摘要 ──────────────────────────────────
|
||||
- name: Build time summary
|
||||
if: always()
|
||||
shell: bash
|
||||
run: |
|
||||
DURATION="${{ steps.build.outputs.duration }}"
|
||||
echo "| Platform | Compiler | Build Time |" >> $GITHUB_STEP_SUMMARY
|
||||
echo "|----------|----------|-----------|" >> $GITHUB_STEP_SUMMARY
|
||||
echo "| ${{ matrix.os }} | ${{ (runner.os == 'Linux' && 'clang-18') || 'clang-cl' }} | ${DURATION}s |" >> $GITHUB_STEP_SUMMARY
|
||||
echo "CI build: ${{ matrix.os }} / ${{ (runner.os == 'Linux' && 'clang-18') || 'clang-cl' }} wall time ${DURATION}s"
|
||||
|
||||
Reference in New Issue
Block a user