Files
kira1928andClaude Fable 5 9811e0431b fix: 处理第二轮 code review 意见并修复 e2e 基础设施问题
后端:
- ffmpeg parser 找不到 FFmpeg 且异步初始化仍在 checking/downloading 时
  挂起等待终态(可被 ctx 取消或 Stop 中断),等待结束后立即重查并开始
  录制,不再进入"找不到 FFmpeg → 5 秒重试"失败循环(Codex P1)
- isFFmpegAvailableWithoutRemotetools 与 utils.GetFFmpegPath 语义对齐:
  配置了 ffmpeg_path 时以该路径为准不回退 PATH;补 exec.ErrDot → ./ffmpeg
  兜底(Copilot / Codex P2)
- WaitForToolsInit 在 Init() 重试进行中不再立即返回旧错误,等待本轮
  结束后读取最新结果;Init 的 defer 先发布结果再更新状态机(Gemini / Copilot)
- 新增 tools.FFmpegStatusChanged() 状态变化通知 channel

前端:
- ffmpeg-banner / update-banner 从 fixed 定位改为普通文档流,自然向下
  堆叠且把内容推开,不再互相重叠或遮挡页面顶部(Gemini high / Codex P3)
- SSEEventType 补充遗漏的 memory_warning 并注册监听

测试基础设施:
- mock server 新增 -speed 启动参数,限速在 bgo 启动前即生效(Codex P2)
- mock server 下载循环每个 chunk 前重新读取限速,运行时调速立即生效
  (Copilot / Codex P2)
- 修复 mock zip 结构:模拟真实发布包的单一顶层目录,避免 remotetools
  解压剥层后 pathToEntry 对不上导致 install 后找不到工具
- 新增 dev 专用 POST /api/debug/ffmpeg/reinit;下载失败用例先清工具缓存
  再重新触发初始化,解决用例间状态污染(Codex P2)
- e2e 等待逻辑去掉会被 SSE 长连接卡死的 networkidle(Codex P2)
- playwright.ffmpeg.config.ts 的清理副作用限定主进程执行,避免 worker
  重新加载配置时删掉下载中的工具目录
- CI 接入 ffmpeg 下载 e2e 并上传报告;package.json 加 test:e2e:ffmpeg
  (Codex P3)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-08 13:52:46 +09:00

150 lines
4.4 KiB
YAML

name: E2E Tests
on:
push:
branches:
- '*'
pull_request:
branches:
- '*'
# 取消之前排队/进行中的运行(同一 PR)
concurrency:
group: e2e-${{ github.head_ref || github.ref }}
cancel-in-progress: true
jobs:
e2e:
name: Playwright E2E Tests
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
cache: true
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.node-version'
cache: 'yarn'
# Playwright 浏览器缓存
- name: Get Playwright version
id: playwright-version
run: echo "version=$(node -e "console.log(require('@playwright/test/package.json').version)")" >> $GITHUB_OUTPUT
- name: Cache Playwright browsers
uses: actions/cache@v4
id: playwright-cache
with:
path: ~/.cache/ms-playwright
key: playwright-${{ runner.os }}-${{ steps.playwright-version.outputs.version }}
# bililive-tools 缓存(存储在 test-output/.appdata 下)
- name: Cache bililive-tools
uses: actions/cache@v4
with:
path: test-output/.appdata
key: bililive-tools-${{ runner.os }}-v1
- name: Install FFmpeg
run: sudo apt-get update && sudo apt-get install -y ffmpeg
- name: Install Node dependencies
run: yarn install --frozen-lockfile
- name: Install Playwright browsers
if: steps.playwright-cache.outputs.cache-hit != 'true'
run: npx playwright install --with-deps chromium
- name: Install Playwright deps only
if: steps.playwright-cache.outputs.cache-hit == 'true'
run: npx playwright install-deps chromium
- name: Pre-download osrp-stream-tester
run: go install github.com/kira1928/osrp-stream-tester/cmd/stream-tester@latest
- name: Build Web frontend
run: make build-web
- name: Build bililive-go with dev tag
run: |
mkdir -p bin
go build -tags dev -o bin/bililive-dev ./src/cmd/bililive
- name: Create test output directory
run: mkdir -p test-output
- name: Run E2E tests
run: npx playwright test
# FFmpeg 异步下载流程 e2e(独立配置:8085 端口 + mock 下载服务器)
- name: Run FFmpeg download E2E tests
run: npx playwright test -c playwright.ffmpeg.config.ts
# 写入报告元数据(供 Trace Viewer 使用)
- name: Write report metadata
if: always()
run: |
cat > playwright-report/.report-meta.json << EOF
{
"commit": "${{ github.sha }}",
"branch": "${{ github.ref_name }}",
"repo": "${{ github.repository }}",
"run_id": "${{ github.run_id }}",
"run_number": "${{ github.run_number }}",
"created_at": "$(date -u +%Y-%m-%dT%H:%M:%SZ)"
}
EOF
- name: Upload test results
uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-report
path: playwright-report/
retention-days: 14
- name: Upload test artifacts
uses: actions/upload-artifact@v4
if: failure()
with:
name: test-results
path: test-results/
retention-days: 7
- name: Upload FFmpeg test report
uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-report-ffmpeg
path: playwright-report-ffmpeg/
retention-days: 14
if-no-files-found: ignore
- name: Upload FFmpeg test artifacts
uses: actions/upload-artifact@v4
if: failure()
with:
name: test-results-ffmpeg
path: test-results-ffmpeg/
retention-days: 7
if-no-files-found: ignore
# 输出在线报告查看链接
- name: Print report viewer link
if: always()
run: |
echo ""
echo "=============================================="
echo "📊 查看测试报告:"
echo "https://bililive-go.com/dev/playwright/open?run=${{ github.run_id }}"
echo "=============================================="
echo ""