|
93 | 93 | type: string |
94 | 94 |
|
95 | 95 | permissions: |
| 96 | + # Windows builds read this run's artifact list to wait for the Linux CLI archive. |
| 97 | + actions: read |
96 | 98 | contents: read |
97 | 99 |
|
98 | 100 | jobs: |
99 | 101 | build: |
100 | 102 | name: Build ${{ inputs.label }} |
101 | 103 | runs-on: ${{ inputs.runner }} |
102 | | - 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 }} |
103 | 107 | env: |
104 | 108 | T3CODE_CLERK_PUBLISHABLE_KEY: ${{ inputs.clerk_publishable_key }} |
105 | 109 | T3CODE_CLERK_JWT_TEMPLATE: ${{ inputs.clerk_jwt_template }} |
@@ -204,15 +208,6 @@ jobs: |
204 | 208 | name: js-bundle |
205 | 209 | path: apps |
206 | 210 |
|
207 | | - # The WSL backend runs the Linux CLI archive inside the distro, so the |
208 | | - # Windows desktop embeds the same-arch archive the release attaches. |
209 | | - - name: Download Linux CLI archive for WSL |
210 | | - if: inputs.platform == 'win' |
211 | | - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8 |
212 | | - with: |
213 | | - name: cli-linux-${{ inputs.arch }} |
214 | | - path: wsl-runtime |
215 | | - |
216 | 211 | # Only the resource monitor build needs these libraries. With a cached |
217 | 212 | # monitor, the desktop build's preflight skips its MSVC check, and node-pty |
218 | 213 | # ships prebuilt Windows binaries, so the 30-60s install is skipped too. |
@@ -314,6 +309,57 @@ jobs: |
314 | 309 | Select-Object -Unique |
315 | 310 | "PSModulePath=$($modulePathEntries -join ';')" >> $env:GITHUB_ENV |
316 | 311 |
|
| 312 | + # The WSL backend runs the Linux CLI archive inside the distro, so the |
| 313 | + # Windows desktop embeds the same-arch archive the release attaches. |
| 314 | + # This job starts alongside that Linux job instead of after it, and the |
| 315 | + # Linux job uploads the archive partway through, so the wait is placed |
| 316 | + # after all other setup. It stops early if the Linux job ended without |
| 317 | + # uploading the archive. |
| 318 | + - name: Wait for Linux CLI archive |
| 319 | + if: inputs.platform == 'win' |
| 320 | + shell: pwsh |
| 321 | + timeout-minutes: 40 |
| 322 | + env: |
| 323 | + GITHUB_TOKEN: ${{ github.token }} |
| 324 | + ARTIFACT: cli-linux-${{ inputs.arch }} |
| 325 | + LINUX_JOB: Build Linux ${{ inputs.arch }} |
| 326 | + run: | |
| 327 | + $headers = @{ Authorization = "Bearer $env:GITHUB_TOKEN"; Accept = "application/vnd.github+json" } |
| 328 | + $run = "$env:GITHUB_API_URL/repos/$env:GITHUB_REPOSITORY/actions/runs/$env:GITHUB_RUN_ID" |
| 329 | + function Test-Archive { |
| 330 | + (Invoke-RestMethod -Headers $headers -Uri "$run/artifacts?name=$env:ARTIFACT").total_count -gt 0 |
| 331 | + } |
| 332 | + while ($true) { |
| 333 | + try { |
| 334 | + if (Test-Archive) { |
| 335 | + Write-Host "$env:ARTIFACT is ready." |
| 336 | + exit 0 |
| 337 | + } |
| 338 | + $jobs = Invoke-RestMethod -Headers $headers -Uri "$run/attempts/$env:GITHUB_RUN_ATTEMPT/jobs?per_page=100" |
| 339 | + $linux = $jobs.jobs | Where-Object { $_.name.EndsWith($env:LINUX_JOB) } | Select-Object -First 1 |
| 340 | + if ($linux.conclusion) { |
| 341 | + # The upload may have landed between the two requests above. |
| 342 | + if (Test-Archive) { |
| 343 | + Write-Host "$env:ARTIFACT is ready." |
| 344 | + exit 0 |
| 345 | + } |
| 346 | + Write-Host "::error::$env:LINUX_JOB ended ($($linux.conclusion)) without uploading $env:ARTIFACT." |
| 347 | + exit 1 |
| 348 | + } |
| 349 | + } catch { |
| 350 | + Write-Warning "Could not read this run's artifacts or jobs: $($_.Exception.Message)" |
| 351 | + } |
| 352 | + Write-Host "Waiting for $env:ARTIFACT..." |
| 353 | + Start-Sleep -Seconds 10 |
| 354 | + } |
| 355 | +
|
| 356 | + - name: Download Linux CLI archive for WSL |
| 357 | + if: inputs.platform == 'win' |
| 358 | + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8 |
| 359 | + with: |
| 360 | + name: cli-linux-${{ inputs.arch }} |
| 361 | + path: wsl-runtime |
| 362 | + |
317 | 363 | - name: Build desktop artifact |
318 | 364 | shell: bash |
319 | 365 | env: |
|
0 commit comments