diff --git a/.github/workflows/windows-fork-qualification.yml b/.github/workflows/windows-fork-qualification.yml new file mode 100644 index 0000000000000..8df8e0e2b4cd6 --- /dev/null +++ b/.github/workflows/windows-fork-qualification.yml @@ -0,0 +1,84 @@ +name: Windows fork qualification + +on: + push: + branches: [qualification/windows-package] + +permissions: + contents: read + +jobs: + package: + if: github.repository == 'InTheta/t3code' + runs-on: windows-2025 + timeout-minutes: 45 + env: + T3_QUALIFICATION_SHA: ${{ github.sha }} + CSC_IDENTITY_AUTO_DISCOVERY: "false" + steps: + - name: Check out the pinned public source + shell: pwsh + run: | + git init + if ($LASTEXITCODE -ne 0) { throw "Git initialization failed" } + git config core.longpaths true + if ($LASTEXITCODE -ne 0) { throw "Git long-path setup failed" } + git fetch --no-tags --depth=1 https://github.com/InTheta/t3code.git $env:T3_QUALIFICATION_SHA + if ($LASTEXITCODE -ne 0) { throw "Pinned source fetch failed" } + git checkout --detach FETCH_HEAD + if ($LASTEXITCODE -ne 0) { throw "Pinned source checkout failed" } + - uses: ./.github/actions/setup-ci-deps + with: + install-args: --filter=@t3tools/desktop... --filter=t3... --filter=@t3tools/scripts... + - name: Verify source and prepare the MSVC target + shell: pwsh + run: | + if ((git rev-parse HEAD) -ne $env:T3_QUALIFICATION_SHA) { + throw "Unexpected qualification source commit" + } + rustup target add x86_64-pc-windows-msvc + # The shared Vite+ cache publishes its Windows executable to Git Bash. + - name: Build the Windows x64 installer + id: package + shell: bash + run: | + export TEMP="$RUNNER_TEMP" + export TMP="$RUNNER_TEMP" + vp run dist:desktop:win:x64 --keep-stage --output-dir "$RUNNER_TEMP/t3-windows-qualification" + - name: Record rejected payload inventory + if: failure() && steps.package.outcome == 'failure' + shell: pwsh + run: | + $stage = @(Get-ChildItem -LiteralPath $env:RUNNER_TEMP -Directory -Filter 't3code-desktop-win-stage-*') + if ($stage.Count -ne 1) { throw "Expected one retained package staging directory" } + $payload = @(Get-ChildItem -LiteralPath (Join-Path $stage[0].FullName 'app/dist') -Directory -Filter '*-unpacked') + if ($payload.Count -ne 1) { throw "Expected one unpacked Windows payload" } + $files = Get-ChildItem -LiteralPath $payload[0].FullName -File -Recurse -Force | ForEach-Object { + [pscustomobject]@{path=[IO.Path]::GetRelativePath($payload[0].FullName,$_.FullName).Replace('\','/');bytes=$_.Length} + } + $files | Sort-Object path | ConvertTo-Json | Set-Content "$env:RUNNER_TEMP/t3-rejected-payload.json" + - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 + if: failure() && steps.package.outcome == 'failure' + with: + name: t3-rejected-payload-inventory + path: ${{ runner.temp }}/t3-rejected-payload.json + if-no-files-found: error + retention-days: 7 + - name: Record installer identity + shell: pwsh + run: | + $output = "$env:RUNNER_TEMP/t3-windows-qualification" + $installer = @(Get-ChildItem -LiteralPath $output -Filter '*.exe' -File) + if ($installer.Count -ne 1) { throw "Expected one Windows installer" } + $hash = Get-FileHash -Algorithm SHA256 -LiteralPath $installer[0].FullName + "$($hash.Hash.ToLowerInvariant()) $($installer[0].Name)" | Set-Content "$output/SHA256SUMS.txt" + $env:T3_QUALIFICATION_SHA | Set-Content "$output/SOURCE-SHA.txt" + - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 + with: + name: t3-windows-x64-qualification + path: | + ${{ runner.temp }}/t3-windows-qualification/*.exe + ${{ runner.temp }}/t3-windows-qualification/SHA256SUMS.txt + ${{ runner.temp }}/t3-windows-qualification/SOURCE-SHA.txt + if-no-files-found: error + retention-days: 7 diff --git a/scripts/lib/server-compile-cache.test.ts b/scripts/lib/server-compile-cache.test.ts index c237d821b761c..cc8889fed781f 100644 --- a/scripts/lib/server-compile-cache.test.ts +++ b/scripts/lib/server-compile-cache.test.ts @@ -7,6 +7,7 @@ import { expect, it } from "vite-plus/test"; import { cacheKey, seedPreparedCache } from "./server-compile-cache.ts"; it.each([ + { platform: "win32", hostArch: "x64", arch: 1, reason: "Windows installer cache" }, { platform: "freebsd", hostArch: "x64", arch: 1, reason: "unsupported target freebsd" }, { platform: "linux", hostArch: "x64", arch: 3, reason: "unexecutable target linux/arm64" }, { platform: "linux", hostArch: "arm64", arch: 1, reason: "unexecutable target linux/x64" }, diff --git a/scripts/prepare-server-compile-cache.cjs b/scripts/prepare-server-compile-cache.cjs index b094958628149..d7ec2c96e4f6b 100644 --- a/scripts/prepare-server-compile-cache.cjs +++ b/scripts/prepare-server-compile-cache.cjs @@ -6,7 +6,13 @@ const os = require("node:os"); // afterPack runs before signing and installer creation, against the final ASAR layout. module.exports = async ({ appOutDir, electronPlatformName, arch, packager }) => { - if (!["darwin", "win32", "linux"].includes(electronPlatformName)) { + // The optional cache is populated at runtime. Shipping its entries in the + // Windows installer can exceed the packaged payload file-count limit. + if (electronPlatformName === "win32") { + console.log("[server-compile-cache] Skipping Windows installer cache"); + return; + } + if (!["darwin", "linux"].includes(electronPlatformName)) { console.log(`[server-compile-cache] Skipping unsupported target ${electronPlatformName}`); return; } @@ -38,10 +44,7 @@ module.exports = async ({ appOutDir, electronPlatformName, arch, packager }) => const executable = electronPlatformName === "darwin" ? path.join(appOutDir, `${product}.app`, "Contents", "MacOS", product) - : path.join( - appOutDir, - electronPlatformName === "win32" ? `${product}.exe` : packager.executableName, - ); + : path.join(appOutDir, packager.executableName); const helper = path.join( resources, "app.asar",