diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..0ba0544 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,38 @@ +name: Godot checks + +on: + push: + branches: [main] + pull_request: + workflow_dispatch: + +permissions: + contents: read + +jobs: + validate: + runs-on: windows-latest + timeout-minutes: 10 + steps: + - uses: actions/checkout@v4 + - name: Download the fixed Godot version + shell: pwsh + run: | + $archive = Join-Path $env:RUNNER_TEMP 'godot.zip' + $directory = Join-Path $env:RUNNER_TEMP 'godot-4.7.1' + Invoke-WebRequest 'https://github.com/godotengine/godot/releases/download/4.7.1-stable/Godot_v4.7.1-stable_win64.exe.zip' -OutFile $archive + $expected = 'c7a289051eaefb460b0106b60e9cd5bee0ef55fd102dcb2bed1eb356cf3d90a1' + if ((Get-FileHash $archive -Algorithm SHA256).Hash -ne $expected) { + throw 'Godot archive checksum mismatch' + } + Expand-Archive $archive -DestinationPath $directory + "GODOT=$directory\Godot_v4.7.1-stable_win64_console.exe" >> $env:GITHUB_ENV + - name: Import project + shell: pwsh + run: '& $env:GODOT --headless --editor --path . --quit' + - name: Run project assertions + shell: pwsh + run: '& $env:GODOT --headless --path . --script res://tests/test_runner.gd' + - name: Start the main scene for 30 frames + shell: pwsh + run: '& $env:GODOT --headless --path . --quit-after 30' diff --git a/README.md b/README.md index ae48904..ed3b1b0 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,8 @@ ## 运行 +先从 [Godot 4.7.1 官方发布页](https://github.com/godotengine/godot/releases/tag/4.7.1-stable) 下载 Windows 标准版 `Godot_v4.7.1-stable_win64.exe.zip`,将其中的可执行文件解压到仓库根目录。仓库不包含引擎程序;请使用固定的 4.7.1-stable 版本。 + 在仓库根目录执行: ```powershell @@ -53,10 +55,15 @@ `tests/test_runner.gd` 是唯一顶层入口,聚合固定时钟、主场景控制和 `tests/simulation/lifecycle_test_suite.gd`: +首次克隆后,先导入项目以生成 Godot 的脚本类缓存,再运行测试: + ```powershell +& '.\Godot_v4.7.1-stable_win64_console.exe' --headless --editor --path . --quit & '.\Godot_v4.7.1-stable_win64_console.exe' --headless --path . --script 'res://tests/test_runner.gd' ``` +GitHub Actions 在推送到 `main` 和提交 PR 时自动使用同一版本引擎,校验下载文件的 SHA-256,依次执行项目导入、134 项断言和主场景 30 帧无头启动。这些检查不替代窗口布局与玩法的人工验收。 + ## 导出状态 当前机器尚未检测到 Godot 4.7.1 Export Templates,因此暂不提供 Windows 导出命令。Export Templates 安装并创建 `export_presets.cfg` 后再验证导出流程。