Skip to content

Commit ce7ab21

Browse files
committed
scratch: test Windows wait for Linux archive (do not merge)
1 parent 0cf482b commit ce7ab21

2 files changed

Lines changed: 116 additions & 72 deletions

File tree

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
# SCRATCH (never merged): reusable workflow shaped like release-desktop.yml.
2+
name: Scratch wait build
3+
4+
on:
5+
workflow_call:
6+
inputs:
7+
label:
8+
required: true
9+
type: string
10+
runner:
11+
required: true
12+
type: string
13+
platform:
14+
required: true
15+
type: string
16+
arch:
17+
required: true
18+
type: string
19+
upload:
20+
required: false
21+
default: true
22+
type: boolean
23+
24+
permissions:
25+
actions: read
26+
contents: read
27+
28+
jobs:
29+
build:
30+
name: Build ${{ inputs.label }}
31+
runs-on: ${{ inputs.runner }}
32+
timeout-minutes: ${{ inputs.platform == 'win' && 70 || 30 }}
33+
steps:
34+
- name: Simulate Linux build
35+
if: inputs.platform == 'linux'
36+
shell: bash
37+
run: |
38+
sleep 75
39+
mkdir -p out && echo archive > "out/t3-linux-${{ inputs.arch }}.tar.gz"
40+
41+
- name: Upload CLI archive
42+
if: inputs.platform == 'linux' && inputs.upload
43+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
44+
with:
45+
name: cli-linux-${{ inputs.arch }}
46+
path: out/*
47+
48+
- name: Simulate rest of Linux job
49+
if: inputs.platform == 'linux'
50+
shell: bash
51+
run: sleep 20
52+
53+
- name: Wait for Linux CLI archive
54+
if: inputs.platform == 'win'
55+
shell: pwsh
56+
timeout-minutes: 40
57+
env:
58+
GITHUB_TOKEN: ${{ github.token }}
59+
ARTIFACT: cli-linux-${{ inputs.arch }}
60+
LINUX_JOB: Build Linux ${{ inputs.arch }}
61+
run: |
62+
$headers = @{ Authorization = "Bearer $env:GITHUB_TOKEN"; Accept = "application/vnd.github+json" }
63+
$run = "$env:GITHUB_API_URL/repos/$env:GITHUB_REPOSITORY/actions/runs/$env:GITHUB_RUN_ID"
64+
function Test-Archive {
65+
(Invoke-RestMethod -Headers $headers -Uri "$run/artifacts?name=$env:ARTIFACT").total_count -gt 0
66+
}
67+
while ($true) {
68+
try {
69+
if (Test-Archive) {
70+
Write-Host "$env:ARTIFACT is ready."
71+
exit 0
72+
}
73+
$jobs = Invoke-RestMethod -Headers $headers -Uri "$run/attempts/$env:GITHUB_RUN_ATTEMPT/jobs?per_page=100"
74+
$linux = $jobs.jobs | Where-Object { $_.name.EndsWith($env:LINUX_JOB) } | Select-Object -First 1
75+
if ($linux.conclusion) {
76+
# The upload may have landed between the two requests above.
77+
if (Test-Archive) {
78+
Write-Host "$env:ARTIFACT is ready."
79+
exit 0
80+
}
81+
Write-Host "::error::$env:LINUX_JOB ended ($($linux.conclusion)) without uploading $env:ARTIFACT."
82+
exit 1
83+
}
84+
} catch {
85+
Write-Warning "Could not read this run's artifacts or jobs: $($_.Exception.Message)"
86+
}
87+
Write-Host "Waiting for $env:ARTIFACT..."
88+
Start-Sleep -Seconds 10
89+
}
90+
91+
- name: Download Linux CLI archive for WSL
92+
if: inputs.platform == 'win'
93+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
94+
with:
95+
name: cli-linux-${{ inputs.arch }}
96+
path: wsl-runtime
Lines changed: 20 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -1,81 +1,29 @@
1-
# On-demand Windows test lane. Manual only: nothing in the suite passes on
2-
# Windows yet, so this exists to give contributors (and agents) a cloud Windows
3-
# box to iterate against. Once the suite is green here, fold it into ci.yml.
4-
#
5-
# gh workflow run windows-tests.yml --ref <branch> -f package=packages/shared
6-
# gh workflow run windows-tests.yml --ref <branch> -f package=apps/server \
7-
# -f files="src/process/externalLauncher.test.ts src/cli/theme.test.ts"
8-
# gh run watch && gh run view --log-failed
1+
# SCRATCH (never merged): exercises the Windows wait for the Linux CLI archive.
2+
# x64: Linux uploads after ~75s, Windows must wait, then download.
3+
# arm64: Linux finishes without uploading, Windows must fail fast.
94
name: Windows Tests
105

116
on:
127
workflow_dispatch:
13-
inputs:
14-
package:
15-
description: "Workspace directory to test, e.g. apps/server or packages/shared. Empty runs every package except apps/server."
16-
type: string
17-
default: ""
18-
files:
19-
description: "Space-separated test files relative to the package directory. Empty runs the package's whole suite. Requires package."
20-
type: string
21-
default: ""
228

239
permissions:
10+
actions: read
2411
contents: read
2512

2613
jobs:
27-
test:
28-
name: Test (${{ inputs.package || 'all non-server' }})
29-
runs-on: blacksmith-8vcpu-windows-2025
30-
timeout-minutes: 45
31-
steps:
32-
- name: Checkout
33-
uses: actions/checkout@v6
34-
with:
35-
sparse-checkout: |
36-
/*
37-
!/.repos/
38-
sparse-checkout-cone-mode: false
39-
40-
# setup-vp's own cache restores a Linux-shaped store on Windows, which is
41-
# slower than no cache (see #7975). Cache pnpm's Windows store directly.
42-
- name: Setup Vite+
43-
uses: voidzero-dev/setup-vp@v1
44-
with:
45-
node-version-file: package.json
46-
cache: false
47-
run-install: false
48-
49-
- name: Resolve package cache path
50-
id: package_cache_path
51-
shell: pwsh
52-
run: '"path=$(vp pm cache dir)" >> $env:GITHUB_OUTPUT'
53-
54-
- name: Cache packages
55-
uses: actions/cache@v6
56-
with:
57-
path: ${{ steps.package_cache_path.outputs.path }}
58-
key: windows-tests-packages-v1-${{ hashFiles('pnpm-lock.yaml') }}
59-
60-
- name: Install
61-
run: vp install
62-
63-
- name: Ensure Electron runtime is installed
64-
if: inputs.package == '' || inputs.package == 'apps/desktop'
65-
run: vp run --filter "@t3tools/desktop" ensure:electron
66-
67-
# `vp run ... test -- <files>` does not forward positional args to vitest,
68-
# so file-scoped runs call `vp test run` inside the package instead.
69-
- name: Test
70-
shell: pwsh
71-
run: |
72-
$package = '${{ inputs.package }}'
73-
$files = '${{ inputs.files }}'
74-
if ($package -eq '') {
75-
vp run --parallel --concurrency-limit 4 --filter '!t3' --filter '!@t3tools/monorepo' test
76-
} elseif ($files -eq '') {
77-
vp run --filter "./$package" test
78-
} else {
79-
Set-Location $package
80-
vp test run $files.Split(' ')
81-
}
14+
linux_x64:
15+
name: Desktop Linux x64
16+
uses: ./.github/workflows/scratch-wait-build.yml
17+
with: { label: Linux x64, runner: blacksmith-2vcpu-ubuntu-2404, platform: linux, arch: x64 }
18+
linux_arm64:
19+
name: Desktop Linux arm64
20+
uses: ./.github/workflows/scratch-wait-build.yml
21+
with: { label: Linux arm64, runner: blacksmith-2vcpu-ubuntu-2404, platform: linux, arch: arm64, upload: false }
22+
win_x64:
23+
name: Desktop Windows x64
24+
uses: ./.github/workflows/scratch-wait-build.yml
25+
with: { label: Windows x64, runner: blacksmith-4vcpu-windows-2025, platform: win, arch: x64 }
26+
win_arm64:
27+
name: Desktop Windows arm64
28+
uses: ./.github/workflows/scratch-wait-build.yml
29+
with: { label: Windows arm64, runner: windows-11-arm, platform: win, arch: arm64 }

0 commit comments

Comments
 (0)