ci: 测试失败时输出注解,便于无管理员权限时定位
构建与发布 / 单测与集成测试 (push) Waiting to run
构建与发布 / 打包 ${{ matrix.platform }} ${{ matrix.arch }} (arm64, linux, ubuntu-24.04-arm) (push) Blocked by required conditions
构建与发布 / 打包 ${{ matrix.platform }} ${{ matrix.arch }} (arm64, macos, macos-15) (push) Blocked by required conditions
构建与发布 / 打包 ${{ matrix.platform }} ${{ matrix.arch }} (x64, linux, ubuntu-24.04) (push) Blocked by required conditions
构建与发布 / 打包 ${{ matrix.platform }} ${{ matrix.arch }} (x64, windows, windows-2025) (push) Blocked by required conditions
构建与发布 / 发布 GitHub Release (push) Blocked by required conditions
构建与发布 / 单测与集成测试 (push) Waiting to run
构建与发布 / 打包 ${{ matrix.platform }} ${{ matrix.arch }} (arm64, linux, ubuntu-24.04-arm) (push) Blocked by required conditions
构建与发布 / 打包 ${{ matrix.platform }} ${{ matrix.arch }} (arm64, macos, macos-15) (push) Blocked by required conditions
构建与发布 / 打包 ${{ matrix.platform }} ${{ matrix.arch }} (x64, linux, ubuntu-24.04) (push) Blocked by required conditions
构建与发布 / 打包 ${{ matrix.platform }} ${{ matrix.arch }} (x64, windows, windows-2025) (push) Blocked by required conditions
构建与发布 / 发布 GitHub Release (push) Blocked by required conditions
This commit is contained in:
@@ -43,17 +43,31 @@ jobs:
|
|||||||
- name: 安装依赖
|
- name: 安装依赖
|
||||||
run: npm ci
|
run: npm ci
|
||||||
|
|
||||||
|
# 下载完整日志需要仓库管理员权限,失败详情转成注解才能在提交页直接看到
|
||||||
- name: 单元测试
|
- name: 单元测试
|
||||||
run: npm test
|
shell: bash
|
||||||
|
run: |
|
||||||
|
set -o pipefail
|
||||||
|
npm test 2>&1 | tee /tmp/unit.log && exit 0
|
||||||
|
echo "::error title=单元测试失败::$(grep -A 15 '^not ok' /tmp/unit.log \
|
||||||
|
| head -150 | sed 's/%/%25/g; s/\r//g' | awk '{printf "%s%%0A", $0}')"
|
||||||
|
exit 1
|
||||||
|
|
||||||
# Electron 集成测试要开真实窗口,无头环境靠 xvfb 提供 X server
|
# Electron 集成测试要开真实窗口,无头环境靠 xvfb 提供 X server
|
||||||
- name: Electron 集成测试
|
- name: Electron 集成测试
|
||||||
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
|
set -o pipefail
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
sudo apt-get install -y xvfb libnss3 libatk1.0-0t64 libatk-bridge2.0-0t64 libcups2t64 libgbm1 libasound2t64 libgtk-3-0t64
|
sudo apt-get install -y xvfb libnss3 libatk1.0-0t64 libatk-bridge2.0-0t64 libcups2t64 libgbm1 libasound2t64 libgtk-3-0t64
|
||||||
for suite in startup download cover annotation reader-features library-notes ai-scope; do
|
for suite in startup download cover annotation reader-features library-notes ai-scope; do
|
||||||
echo "::group::$suite"
|
echo "::group::$suite"
|
||||||
xvfb-run -a npx electron "src/_test/electron/$suite.integration.js"
|
if ! xvfb-run -a npx electron "src/_test/electron/$suite.integration.js" 2>&1 | tee "/tmp/$suite.log"; then
|
||||||
|
echo "::endgroup::"
|
||||||
|
echo "::error title=集成测试失败 $suite::$(grep -iE 'FAIL|Error|失败' "/tmp/$suite.log" \
|
||||||
|
| head -60 | sed 's/%/%25/g; s/\r//g' | awk '{printf "%s%%0A", $0}')"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
echo "::endgroup::"
|
echo "::endgroup::"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user