A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.
TypeScript 2d-game-engine3d3d-game-engineandroidcppecsgame-editorgame-enginegamedeviostypescriptwebassemblywebglwebgpuwechat-minigame
feat: add /build comment trigger for cross-platform CI
esengine1957e9b69723
diff --git a/.github/workflows/cross-platform.yml b/.github/workflows/cross-platform.ymlindex f85a9f649..f33800357 100644--- a/.github/workflows/cross-platform.yml+++ b/.github/workflows/cross-platform.yml@@ -7,6 +7,8 @@ on:description: 'Reason for running this build'required: falsedefault: 'Manual verification'+ issue_comment:+ types: [created]milestone:types: [closed]schedule:@@ -14,6 +16,11 @@ on:jobs:build:+ # Only run on /build comment or non-comment triggers+ if: >-+ github.event_name != 'issue_comment' ||+ (github.event.comment.body == '/build' &&+ github.event.issue.state == 'open')strategy:fail-fast: falsematrix:@@ -26,8 +33,23 @@ jobs:name: ${{ matrix.name }} Buildruns-on: ${{ matrix.platform }}+ permissions:+ contents: read+ issues: writesteps:+ - name: React to comment+ if: github.event_name == 'issue_comment'+ uses: actions/github-script@v7+ with:+ script: |+ await github.rest.reactions.createForIssueComment({+ owner: context.repo.owner,+ repo: context.repo.repo,+ comment_id: context.payload.comment.id,+ content: 'rocket'+ });+- uses: actions/checkout@v4with:submodules: recursive@@ -101,49 +123,98 @@ jobs:run: cd desktop/src-tauri && cargo check# Artifact size report- - name: Report artifact sizes+ - name: Collect artifact sizes+ id: sizesshell: bashrun: |- echo "## 📦 Artifact Size Report (${{ matrix.name }})" >> $GITHUB_STEP_SUMMARY- echo "" >> $GITHUB_STEP_SUMMARY- echo "| Artifact | Size |" >> $GITHUB_STEP_SUMMARY- echo "|----------|------|" >> $GITHUB_STEP_SUMMARY+ report=""+ report+="| Artifact | Size |\n"+ report+="|----------|------|\n"- # SDK bundleif [ -f sdk/dist/index.bundled.js ]; thensize=$(du -sh sdk/dist/index.bundled.js | cut -f1)- echo "| SDK bundle (index.bundled.js) | $size |" >> $GITHUB_STEP_SUMMARY+ report+="| SDK bundle | $size |\n"fi- # WASM corefor f in desktop/public/*.wasm; doif [ -f "$f" ]; thenname=$(basename "$f")size=$(du -sh "$f" | cut -f1)- echo "| WASM ($name) | $size |" >> $GITHUB_STEP_SUMMARY+ report+="| WASM ($name) | $size |\n"fidone- # Toolchainif [ -d desktop/src-tauri/toolchain ]; thentotal=$(du -sh desktop/src-tauri/toolchain | cut -f1)- echo "| Toolchain (total) | $total |" >> $GITHUB_STEP_SUMMARY-+ report+="| Toolchain (total) | $total |\n"if [ -d desktop/src-tauri/toolchain/engine-src ]; thensize=$(du -sh desktop/src-tauri/toolchain/engine-src | cut -f1)- echo "| ├─ engine-src | $size |" >> $GITHUB_STEP_SUMMARY+ report+="| - engine-src | $size |\n"fiif [ -d desktop/src-tauri/toolchain/cmake ]; thensize=$(du -sh desktop/src-tauri/toolchain/cmake | cut -f1)- echo "| ├─ cmake | $size |" >> $GITHUB_STEP_SUMMARY+ report+="| - cmake | $size |\n"fifi- # esbuild.wasmif [ -f desktop/public/esbuild.wasm ]; thensize=$(du -sh desktop/public/esbuild.wasm | cut -f1)- echo "| esbuild.wasm | $size |" >> $GITHUB_STEP_SUMMARY+ report+="| esbuild.wasm | $size |\n"fi- echo "" >> $GITHUB_STEP_SUMMARY- echo "_Generated at $(date -u '+%Y-%m-%d %H:%M UTC')_" >> $GITHUB_STEP_SUMMARY+ # Write to step summary+ echo -e "## Artifact Size Report (${{ matrix.name }})\n" >> $GITHUB_STEP_SUMMARY+ echo -e "$report" >> $GITHUB_STEP_SUMMARY++ # Save for issue comment+ EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)+ echo "report<<$EOF" >> $GITHUB_OUTPUT+ echo -e "$report" >> $GITHUB_OUTPUT+ echo "$EOF" >> $GITHUB_OUTPUT++ # Report results back to Issue+ report:+ needs: build+ if: always() && github.event_name == 'issue_comment'+ runs-on: ubuntu-latest+ permissions:+ issues: write++ steps:+ - name: Post result to Issue+ uses: actions/github-script@v7+ with:+ script: |+ const jobs = await github.rest.actions.listJobsForWorkflowRun({+ owner: context.repo.owner,+ repo: context.repo.repo,+ run_id: context.runId,+ });++ const buildJobs = jobs.data.jobs.filter(j => j.name !== 'Report Results');+ const lines = buildJobs.map(j => {+ const icon = j.conclusion === 'success' ? '✅' : '❌';+ const dur = j.completed_at && j.started_at+ ? Math.round((new Date(j.completed_at) - new Date(j.started_at)) / 1000)+ : 0;+ return `| ${j.name} | ${icon} ${j.conclusion || 'unknown'} | ${dur}s |`;+ });++ const runUrl = `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`;++ const body = [+ `## 🔨 Cross-Platform Build Results`,+ '',+ '| Platform | Status | Duration |',+ '|----------|--------|----------|',+ ...lines,+ '',+ `[View full run](${runUrl})`,+ ].join('\n');++ await github.rest.issues.createComment({+ owner: context.repo.owner,+ repo: context.repo.repo,+ issue_number: context.payload.issue.number,+ body,+ });