|
| 1 | +name: 🧪 Runtime Matrix |
| 2 | +on: |
| 3 | + workflow_call: |
| 4 | + inputs: |
| 5 | + version: |
| 6 | + required: true |
| 7 | + type: string |
| 8 | + |
| 9 | +jobs: |
| 10 | + runtime-matrix: |
| 11 | + strategy: |
| 12 | + fail-fast: false |
| 13 | + matrix: |
| 14 | + runtime: [host-v8, host-qjs, host-jsc, web-browser, web-qjs] |
| 15 | + runs-on: ${{ matrix.runtime == 'host-jsc' && 'macos-latest' || 'ubuntu-22.04' }} |
| 16 | + name: Runtime (${{ matrix.runtime }}) |
| 17 | + steps: |
| 18 | + - name: ⏬ Checkout repository |
| 19 | + uses: actions/checkout@v6 |
| 20 | + |
| 21 | + - name: 🛠️ pnpm and build |
| 22 | + uses: ./.github/actions/pnpm-build |
| 23 | + |
| 24 | + - name: ⏬ Download host-v8 artifact |
| 25 | + if: matrix.runtime == 'host-v8' || matrix.runtime == 'web-browser' || matrix.runtime == 'web-qjs' |
| 26 | + uses: actions/download-artifact@v4 |
| 27 | + with: |
| 28 | + name: linux-editor-${{ inputs.version }}-v8 |
| 29 | + path: runtime-artifacts/host-v8 |
| 30 | + |
| 31 | + - name: ⏬ Download host-qjs artifact |
| 32 | + if: matrix.runtime == 'host-qjs' |
| 33 | + uses: actions/download-artifact@v4 |
| 34 | + with: |
| 35 | + name: linux-editor-${{ inputs.version }}-qjs-ng |
| 36 | + path: runtime-artifacts/host-qjs |
| 37 | + |
| 38 | + - name: ⏬ Download host-jsc artifact |
| 39 | + if: matrix.runtime == 'host-jsc' |
| 40 | + uses: actions/download-artifact@v4 |
| 41 | + with: |
| 42 | + name: macos-editor-${{ inputs.version }}-jsc |
| 43 | + path: runtime-artifacts/host-jsc |
| 44 | + |
| 45 | + - name: ⏬ Download web-browser template artifact |
| 46 | + if: matrix.runtime == 'web-browser' |
| 47 | + uses: actions/download-artifact@v4 |
| 48 | + with: |
| 49 | + name: web-template_debug-${{ inputs.version }}-browser |
| 50 | + path: runtime-artifacts/web-browser |
| 51 | + |
| 52 | + - name: ⏬ Download web-qjs template artifact |
| 53 | + if: matrix.runtime == 'web-qjs' |
| 54 | + uses: actions/download-artifact@v4 |
| 55 | + with: |
| 56 | + name: web-template_debug-${{ inputs.version }}-qjs-ng |
| 57 | + path: runtime-artifacts/web-qjs |
| 58 | + |
| 59 | + - name: 📦 Stage runtime assets for run-runtime-matrix |
| 60 | + shell: bash |
| 61 | + run: | |
| 62 | + set -euo pipefail |
| 63 | + fail_missing() { |
| 64 | + echo "::error::missing required runtime artifact for $1 (version ${{ inputs.version }})" |
| 65 | + exit 1 |
| 66 | + } |
| 67 | +
|
| 68 | + pick_one() { |
| 69 | + local dir="$1" |
| 70 | + local name_pattern="$2" |
| 71 | + local value |
| 72 | + value="$(find "$dir" -type f -name "$name_pattern" 2>/dev/null | head -n1 || true)" |
| 73 | + if [ -z "$value" ]; then |
| 74 | + return 1 |
| 75 | + fi |
| 76 | + echo "$value" |
| 77 | + } |
| 78 | +
|
| 79 | + mkdir -p tests/bin |
| 80 | + case "${{ matrix.runtime }}" in |
| 81 | + host-v8) |
| 82 | + src="$(pick_one runtime-artifacts/host-v8 'godot.linuxbsd.editor.*')" || fail_missing "host-v8 binary" |
| 83 | + cp "$src" tests/bin/godot-host-v8 |
| 84 | + chmod +x tests/bin/godot-host-v8 |
| 85 | + ;; |
| 86 | + host-qjs) |
| 87 | + src="$(pick_one runtime-artifacts/host-qjs 'godot.linuxbsd.editor.*')" || fail_missing "host-qjs binary" |
| 88 | + cp "$src" tests/bin/godot-host-qjs |
| 89 | + chmod +x tests/bin/godot-host-qjs |
| 90 | + ;; |
| 91 | + host-jsc) |
| 92 | + src="$(pick_one runtime-artifacts/host-jsc 'godot.macos.editor.*')" || fail_missing "host-jsc binary" |
| 93 | + cp "$src" tests/bin/godot-host-jsc |
| 94 | + chmod +x tests/bin/godot-host-jsc |
| 95 | + ;; |
| 96 | + web-browser) |
| 97 | + host_src="$(pick_one runtime-artifacts/host-v8 'godot.linuxbsd.editor.*')" || fail_missing "web-browser host-v8 binary" |
| 98 | + web_src="$(pick_one runtime-artifacts/web-browser '*.zip')" || fail_missing "web-browser template zip" |
| 99 | + cp "$host_src" tests/bin/godot-host-v8 |
| 100 | + cp "$web_src" tests/bin/godot-web-browser-template_debug.zip |
| 101 | + chmod +x tests/bin/godot-host-v8 |
| 102 | + ;; |
| 103 | + web-qjs) |
| 104 | + host_src="$(pick_one runtime-artifacts/host-v8 'godot.linuxbsd.editor.*')" || fail_missing "web-qjs host-v8 binary" |
| 105 | + web_src="$(pick_one runtime-artifacts/web-qjs '*.zip')" || fail_missing "web-qjs template zip" |
| 106 | + cp "$host_src" tests/bin/godot-host-v8 |
| 107 | + cp "$web_src" tests/bin/godot-web-qjs-template_debug.zip |
| 108 | + chmod +x tests/bin/godot-host-v8 |
| 109 | + ;; |
| 110 | + esac |
| 111 | +
|
| 112 | + - name: ▶️ Run selected runtime |
| 113 | + run: | |
| 114 | + pnpm test -- --runtimes ${{ matrix.runtime }} --skip-builds |
0 commit comments