@@ -101,7 +101,9 @@ jobs:
101101 build :
102102 name : Build ${{ inputs.label }}
103103 runs-on : ${{ inputs.runner }}
104- timeout-minutes : 30
104+ # Windows waits for the Linux CLI archive inside its own budget (see
105+ # "Wait for Linux CLI archive"), so it gets that wait on top of the usual 30.
106+ timeout-minutes : ${{ inputs.platform == 'win' && 70 || 30 }}
105107 env :
106108 T3CODE_CLERK_PUBLISHABLE_KEY : ${{ inputs.clerk_publishable_key }}
107109 T3CODE_CLERK_JWT_TEMPLATE : ${{ inputs.clerk_jwt_template }}
@@ -210,52 +212,6 @@ jobs:
210212 name : js-bundle
211213 path : apps
212214
213- # The WSL backend runs the Linux CLI archive inside the distro, so the
214- # Windows desktop embeds the same-arch archive the release attaches.
215- # This job starts alongside that Linux job instead of after it, and the
216- # Linux job uploads the archive partway through, usually before this job
217- # gets here. Stop early if the Linux job ended without uploading it.
218- - name : Wait for Linux CLI archive
219- if : inputs.platform == 'win'
220- shell : pwsh
221- timeout-minutes : 20
222- env :
223- GITHUB_TOKEN : ${{ github.token }}
224- ARTIFACT : cli-linux-${{ inputs.arch }}
225- LINUX_JOB : Build Linux ${{ inputs.arch }}
226- run : |
227- $headers = @{ Authorization = "Bearer $env:GITHUB_TOKEN"; Accept = "application/vnd.github+json" }
228- $run = "$env:GITHUB_API_URL/repos/$env:GITHUB_REPOSITORY/actions/runs/$env:GITHUB_RUN_ID"
229- while ($true) {
230- try {
231- # Read the Linux job before the artifacts. It uploads the archive
232- # before it finishes, so once it has finished without one, no
233- # archive is coming.
234- $jobs = Invoke-RestMethod -Headers $headers -Uri "$run/attempts/$env:GITHUB_RUN_ATTEMPT/jobs?per_page=100"
235- $linux = $jobs.jobs | Where-Object { $_.name.EndsWith($env:LINUX_JOB) } | Select-Object -First 1
236- $artifacts = Invoke-RestMethod -Headers $headers -Uri "$run/artifacts?name=$env:ARTIFACT"
237- if ($artifacts.total_count -gt 0) {
238- Write-Host "$env:ARTIFACT is ready."
239- exit 0
240- }
241- if ($linux.conclusion) {
242- Write-Host "::error::$env:LINUX_JOB ended ($($linux.conclusion)) without uploading $env:ARTIFACT."
243- exit 1
244- }
245- } catch {
246- Write-Warning "Could not read this run's artifacts or jobs: $($_.Exception.Message)"
247- }
248- Write-Host "Waiting for $env:ARTIFACT..."
249- Start-Sleep -Seconds 10
250- }
251-
252- - name : Download Linux CLI archive for WSL
253- if : inputs.platform == 'win'
254- uses : actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
255- with :
256- name : cli-linux-${{ inputs.arch }}
257- path : wsl-runtime
258-
259215 - name : Install Spectre-mitigated MSVC libs
260216 if : inputs.platform == 'win'
261217 shell : pwsh
@@ -354,6 +310,57 @@ jobs:
354310 Select-Object -Unique
355311 "PSModulePath=$($modulePathEntries -join ';')" >> $env:GITHUB_ENV
356312
313+ # The WSL backend runs the Linux CLI archive inside the distro, so the
314+ # Windows desktop embeds the same-arch archive the release attaches.
315+ # This job starts alongside that Linux job instead of after it, and the
316+ # Linux job uploads the archive partway through, so the wait is placed
317+ # after all other setup. It stops early if the Linux job ended without
318+ # uploading the archive.
319+ - name : Wait for Linux CLI archive
320+ if : inputs.platform == 'win'
321+ shell : pwsh
322+ timeout-minutes : 40
323+ env :
324+ GITHUB_TOKEN : ${{ github.token }}
325+ ARTIFACT : cli-linux-${{ inputs.arch }}
326+ LINUX_JOB : Build Linux ${{ inputs.arch }}
327+ run : |
328+ $headers = @{ Authorization = "Bearer $env:GITHUB_TOKEN"; Accept = "application/vnd.github+json" }
329+ $run = "$env:GITHUB_API_URL/repos/$env:GITHUB_REPOSITORY/actions/runs/$env:GITHUB_RUN_ID"
330+ function Test-Archive {
331+ (Invoke-RestMethod -Headers $headers -Uri "$run/artifacts?name=$env:ARTIFACT").total_count -gt 0
332+ }
333+ while ($true) {
334+ try {
335+ if (Test-Archive) {
336+ Write-Host "$env:ARTIFACT is ready."
337+ exit 0
338+ }
339+ $jobs = Invoke-RestMethod -Headers $headers -Uri "$run/attempts/$env:GITHUB_RUN_ATTEMPT/jobs?per_page=100"
340+ $linux = $jobs.jobs | Where-Object { $_.name.EndsWith($env:LINUX_JOB) } | Select-Object -First 1
341+ if ($linux.conclusion) {
342+ # The upload may have landed between the two requests above.
343+ if (Test-Archive) {
344+ Write-Host "$env:ARTIFACT is ready."
345+ exit 0
346+ }
347+ Write-Host "::error::$env:LINUX_JOB ended ($($linux.conclusion)) without uploading $env:ARTIFACT."
348+ exit 1
349+ }
350+ } catch {
351+ Write-Warning "Could not read this run's artifacts or jobs: $($_.Exception.Message)"
352+ }
353+ Write-Host "Waiting for $env:ARTIFACT..."
354+ Start-Sleep -Seconds 10
355+ }
356+
357+ - name : Download Linux CLI archive for WSL
358+ if : inputs.platform == 'win'
359+ uses : actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
360+ with :
361+ name : cli-linux-${{ inputs.arch }}
362+ path : wsl-runtime
363+
357364 - name : Build desktop artifact
358365 shell : bash
359366 env :
0 commit comments