From a13718d33c8176aa6c7c6d506b11918aa71f9ae5 Mon Sep 17 00:00:00 2001 From: Dame-time-0034 <812793632@qq.com> Date: Fri, 6 Nov 2026 20:43:16 +0800 Subject: [PATCH 1/3] =?UTF-8?q?ci:=20=E4=BF=AE=E5=A4=8D=E7=AC=AC=E4=B8=89?= =?UTF-8?q?=E6=96=B9=E5=B7=A5=E5=85=B7=E6=89=A7=E8=A1=8C=E6=9D=83=E9=99=90?= =?UTF-8?q?=E5=B9=B6=E5=8A=A0=E5=85=A5=E8=87=AA=E5=8A=A8=E5=8C=96=E6=B5=8B?= =?UTF-8?q?=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build_self_hosted_linux.yml | 94 ++++++++++++++++++- 1 file changed, 92 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_self_hosted_linux.yml b/.github/workflows/build_self_hosted_linux.yml index 10b9ca157..0c1a23fe3 100644 --- a/.github/workflows/build_self_hosted_linux.yml +++ b/.github/workflows/build_self_hosted_linux.yml @@ -2,6 +2,11 @@ name: hutb Linux CI/CD on: pull_request: workflow_dispatch: + inputs: + test_filter: + description: "自动化测试过滤条件,多个用 + 分隔;Filter: 前缀表示从路径开头匹配" + required: false + default: "Filter:System.Core.Misc.CString+Filter:System.Core.Misc.PathViews+System.Core.Misc.Algos+System.Core.Misc.AsciiSet+System.Core.Misc.Timespan+System.Core.Misc.DateTime" jobs: linux-dev: @@ -12,6 +17,7 @@ jobs: env: UE4_ROOT: ${{ github.workspace }} GIT_CODE: T8w6TYB_r71gGTP3A02B + TEST_FILTER: ${{ github.event.inputs.test_filter || 'Filter:System.Core.Misc.CString+Filter:System.Core.Misc.PathViews+System.Core.Misc.Algos+System.Core.Misc.AsciiSet+System.Core.Misc.Timespan+System.Core.Misc.DateTime' }} steps: # 仓库里的 post-checkout hook 会调用没有执行权限的 GitDependencies.sh,导致 checkout 失败 - name: Disable git hooks @@ -56,9 +62,10 @@ jobs: cd ../.. fi - # 仓库从 Windows 提交,执行权限丢失,统一补上(脚本 + 引擎自带二进制) + # 仓库从 Windows 提交,执行权限丢失,统一补上(脚本 + 引擎自带二进制 + 第三方工具) find . -type f -name "*.sh" -exec chmod +x {} + find ./Engine/Binaries ./Engine/Extras -type f -exec chmod +x {} + + find ./Engine/Source/ThirdParty -type f -path "*bin/Linux*" -exec chmod +x {} + ./Setup.sh --force ./GenerateProjectFiles.sh @@ -67,6 +74,90 @@ jobs: ./Engine/Build/BatchFiles/Linux/Build.sh UE4Editor Linux Development shell: bash + # 引擎仓库自身不含 .uproject,这里生成一个空工程用于运行引擎自带的自动化测试 + - name: Run automation tests + run: | + PROJECT_DIR="$RUNNER_TEMP/automation-project" + REPORT_DIR="$GITHUB_WORKSPACE/Saved/Automation/Reports" + mkdir -p "$PROJECT_DIR/Content" + rm -rf "$REPORT_DIR" + + cat > "$PROJECT_DIR/AutomationTest.uproject" <<'JSON' + { + "FileVersion": 3, + "EngineAssociation": "", + "Category": "", + "Description": "", + "Modules": [] + } + JSON + + # runner 可能没有图形会话,优先用 xvfb 提供虚拟显示 + if command -v xvfb-run >/dev/null 2>&1; then + LAUNCHER=(xvfb-run -a -s "-screen 0 1024x768x24") + else + LAUNCHER=() + fi + + set +e + "${LAUNCHER[@]}" ./Engine/Binaries/Linux/UE4Editor \ + "$PROJECT_DIR/AutomationTest.uproject" \ + -ExecCmds="Automation RunTests $TEST_FILTER" \ + -unattended -nopause -nullrhi -nosound -NoEnginePlugins -log \ + -TESTEXIT="Automation Test Queue Empty" \ + -ReportExportPath="$REPORT_DIR" \ + 2>&1 | tee automation.log + EDITOR_EXIT=${PIPESTATUS[0]} + set -e + + echo "EDITOR_EXIT=$EDITOR_EXIT" >> "$GITHUB_STEP_SUMMARY" + if [ "$EDITOR_EXIT" -ne 0 ]; then + echo "::error::编辑器进程异常退出($EDITOR_EXIT),见 automation.log" + exit 1 + fi + shell: bash + + # 编辑器进程在测试失败时仍返回 0,必须解析报告判定结果 + - name: Check automation report + run: | + python3 - <<'PY' + import json, os, sys + report_path = os.path.join(os.environ["GITHUB_WORKSPACE"], "Saved", "Automation", "Reports", "index.json") + if not os.path.exists(report_path): + print("::error::未生成自动化测试报告 index.json") + sys.exit(1) + + with open(report_path, encoding="utf-8-sig") as f: + report = json.load(f) + + succeeded = report.get("succeeded", 0) + failed = report.get("failed", 0) + not_run = report.get("notRun", 0) + print(f"通过 {succeeded},失败 {failed},未运行 {not_run}") + + for test in report.get("tests", []): + if test.get("state") != "Success": + print(f"::error::{test.get('fullTestPath')} -> {test.get('state')}") + + with open(os.environ["GITHUB_STEP_SUMMARY"], "a", encoding="utf-8") as f: + f.write("\n### 自动化测试\n\n") + f.write(f"| 通过 | 失败 | 未运行 |\n| --- | --- | --- |\n| {succeeded} | {failed} | {not_run} |\n") + + if failed or not_run or succeeded == 0: + sys.exit(1) + PY + shell: bash + + - name: Upload automation report + if: always() + uses: actions/upload-artifact@v4 + with: + name: automation-report + path: | + Saved/Automation/Reports + automation.log + if-no-files-found: warn + # 对应 RunUAT.bat:BuildGraph 产出 Linux Installed Build - name: install run: | @@ -90,4 +181,3 @@ jobs: shell: bash - uses: mickem/clean-after-action@v1 - From ac489b4a48d53d5b67ca97011200b405ce692a12 Mon Sep 17 00:00:00 2001 From: Dame-time-0034 <812793632@qq.com> Date: Fri, 6 Nov 2026 21:25:28 +0800 Subject: [PATCH 2/3] =?UTF-8?q?ci:=20=E6=8C=89=E5=AE=98=E6=96=B9=E6=96=87?= =?UTF-8?q?=E6=A1=A3=E5=90=AF=E7=94=A8=E6=B5=8B=E8=AF=95=E6=8F=92=E4=BB=B6?= =?UTF-8?q?=E5=B9=B6=E5=9C=A8=20Linux=20CI=20=E4=B8=AD=E8=BF=90=E8=A1=8C?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E5=8C=96=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build_self_hosted_linux.yml | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build_self_hosted_linux.yml b/.github/workflows/build_self_hosted_linux.yml index 0c1a23fe3..9c3a2dd77 100644 --- a/.github/workflows/build_self_hosted_linux.yml +++ b/.github/workflows/build_self_hosted_linux.yml @@ -6,7 +6,7 @@ on: test_filter: description: "自动化测试过滤条件,多个用 + 分隔;Filter: 前缀表示从路径开头匹配" required: false - default: "Filter:System.Core.Misc.CString+Filter:System.Core.Misc.PathViews+System.Core.Misc.Algos+System.Core.Misc.AsciiSet+System.Core.Misc.Timespan+System.Core.Misc.DateTime" + default: "Filter:System.Core.Misc.CString+Filter:System.Core.Misc.PathViews+System.Core.Misc.Algos+System.Core.Misc.AsciiSet+System.Core.Misc.Timespan+System.Core.Misc.DateTime+Filter:EditConditionParser" jobs: linux-dev: @@ -68,13 +68,17 @@ jobs: find ./Engine/Source/ThirdParty -type f -path "*bin/Linux*" -exec chmod +x {} + ./Setup.sh --force + + # Setup 成功即依赖已就绪;GenerateProjectFiles 以该标记判断依赖状态 + [ -f .ue4dependencies ] || touch .ue4dependencies + ./GenerateProjectFiles.sh # Linux 下对应 Windows 的 MSBuild 编译,构建编辑器目标 ./Engine/Build/BatchFiles/Linux/Build.sh UE4Editor Linux Development shell: bash - # 引擎仓库自身不含 .uproject,这里生成一个空工程用于运行引擎自带的自动化测试 + # 官方文档要求先启用测试插件(编辑 > 插件 > 测试),这里在工程中启用 - name: Run automation tests run: | PROJECT_DIR="$RUNNER_TEMP/automation-project" @@ -88,7 +92,11 @@ jobs: "EngineAssociation": "", "Category": "", "Description": "", - "Modules": [] + "Modules": [], + "Plugins": [ + { "Name": "EditorTests", "Enabled": true }, + { "Name": "RuntimeTests", "Enabled": true } + ] } JSON @@ -103,7 +111,7 @@ jobs: "${LAUNCHER[@]}" ./Engine/Binaries/Linux/UE4Editor \ "$PROJECT_DIR/AutomationTest.uproject" \ -ExecCmds="Automation RunTests $TEST_FILTER" \ - -unattended -nopause -nullrhi -nosound -NoEnginePlugins -log \ + -unattended -nopause -nullrhi -nosound -log \ -TESTEXIT="Automation Test Queue Empty" \ -ReportExportPath="$REPORT_DIR" \ 2>&1 | tee automation.log From 59a3d57dce7f06eeeecbd1b45a4f85877d620ac7 Mon Sep 17 00:00:00 2001 From: Dame-time-0034 <812793632@qq.com> Date: Fri, 6 Nov 2026 21:32:56 +0800 Subject: [PATCH 3/3] =?UTF-8?q?ci:=20=E4=BF=AE=E6=AD=A3=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E9=9B=86=EF=BC=88=E5=8A=A0=E5=85=A5=E6=8F=92?= =?UTF-8?q?=E4=BB=B6=E6=B5=8B=E8=AF=95=20EditConditionParser=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build_self_hosted_linux.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_self_hosted_linux.yml b/.github/workflows/build_self_hosted_linux.yml index 9c3a2dd77..141bd5457 100644 --- a/.github/workflows/build_self_hosted_linux.yml +++ b/.github/workflows/build_self_hosted_linux.yml @@ -17,7 +17,7 @@ jobs: env: UE4_ROOT: ${{ github.workspace }} GIT_CODE: T8w6TYB_r71gGTP3A02B - TEST_FILTER: ${{ github.event.inputs.test_filter || 'Filter:System.Core.Misc.CString+Filter:System.Core.Misc.PathViews+System.Core.Misc.Algos+System.Core.Misc.AsciiSet+System.Core.Misc.Timespan+System.Core.Misc.DateTime' }} + TEST_FILTER: ${{ github.event.inputs.test_filter || 'Filter:System.Core.Misc.CString+Filter:System.Core.Misc.PathViews+System.Core.Misc.Algos+System.Core.Misc.AsciiSet+System.Core.Misc.Timespan+System.Core.Misc.DateTime+Filter:EditConditionParser' }} steps: # 仓库里的 post-checkout hook 会调用没有执行权限的 GitDependencies.sh,导致 checkout 失败 - name: Disable git hooks