Commit 53edee8
authored
ci: cross-compile Windows tests and CLI binaries on Linux with cargo-xwin (#1824)
## Summary
Build the Windows test binaries and the CLI/binding once on a Linux
runner with cargo-xwin, then just run them on Windows (download-only).
Same approach as voidzero-dev/vite-task#443.
### Cache-miss comparison
| Run | Wall time |
| --- | ---: |
| [`main` (cache
miss)](https://github.com/voidzero-dev/vite-plus/actions/runs/27357067695)
| 34m45s |
| [this PR (Windows CLI binary-cache
miss)](https://github.com/voidzero-dev/vite-plus/actions/runs/28646362896/attempts/1)
| 17m09s |
Net: **17m36s faster**, about **51% less wall time**. Both runs include
the Socket Firewall Free job. The PR run missed the `windows-cli-xwin`
binary cache after the reviewed cache-key/path refactors; the Windows
SDK and package-manager caches were warm.
Latest binary-cache-miss breakdown:
- `build-windows-tests`: **2m45s**, followed by the download-only
Windows test job in **3m05s**.
- `build-windows-cli`: **7m46s**, followed by the slowest download-only
Windows consumer tail in **6m52s**.
- All Windows test, CLI E2E, snapshot, SFW, and ecosystem jobs passed
using the Linux-built artifacts.
### Warm-cache comparison
| Run | Wall time |
| --- | ---: |
| [Before: `main` (NAPI binding cache
hit)](https://github.com/voidzero-dev/vite-plus/actions/runs/28568784291)
| 11m57s |
| [After: this PR (`windows-cli-xwin` cache
hit)](https://github.com/voidzero-dev/vite-plus/actions/runs/28646362896/attempts/3)
| 7m13s |
Net: **4m44s faster**, about **40% less wall time**. These are full
successful CI executions with the native caches already populated. In
the PR run, `build-windows-cli` restored the exact binary cache, skipped
native compilation, re-uploaded the artifact, and completed in **9s**.
Why this is faster:
- Linux is a much faster place to cross-compile the Windows binaries
(cargo-xwin + clang-cl/lld-link against the cached MSVC CRT / Windows
SDK), instead of every Windows job rebuilding the same ~24-minute
release binding + CLI binaries.
- Before, the run was gated by the single slowest Windows job (~30m,
each doing its own full build); after, the native work is performed once
on Linux and the Windows jobs only download and execute the resulting
artifacts.
- The Windows jobs (`Test`, `CLI E2E`, `CLI snap`, `sfw`) now download a
prebuilt artifact and skip native compilation, so they need no Rust
toolchain or dev drive.
- `test`'s Windows leg runs from a nextest archive
(`build-windows-tests`) with no toolchain at all.
- Releases are unaffected and keep building natively on Windows (their
cache keys differ via `RELEASE_BUILD`/`VERSION`). CI Windows binaries
are clang-cl/lld-link-built; the e2e/snap suites still run them on real
Windows.
```mermaid
flowchart LR
subgraph Before["Before: every Windows job rebuilds the workspace"]
B1["Windows jobs x5"] --> B2["Compile binding + vp on Windows<br/>~24m each"]
B2 --> B3["Install vp"]
B3 --> B4["Run e2e / snap / sfw"]
end
subgraph After["After: build once on Linux, run on Windows"]
A1["Linux: build-windows-cli"] --> A2["vp.exe + binding artifact"]
A2 --> A3["CLI E2E / snap / sfw (Windows)<br/>download + run, no toolchain"]
A4["Linux: build-windows-tests"] --> A5["nextest archive"]
A5 --> A6["Test (Windows)<br/>run-only"]
end
```1 parent ff5ad75 commit 53edee8
7 files changed
Lines changed: 450 additions & 58 deletions
File tree
- .github
- actions
- build-upstream
- build-windows-cli
- compute-native-cache-input-hash
- setup-xwin
- workflows
- packages/cli
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
11 | 18 | | |
12 | 19 | | |
13 | 20 | | |
| |||
18 | 25 | | |
19 | 26 | | |
20 | 27 | | |
21 | | - | |
22 | | - | |
23 | | - | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
24 | 34 | | |
25 | 35 | | |
26 | 36 | | |
27 | 37 | | |
28 | | - | |
| 38 | + | |
29 | 39 | | |
30 | 40 | | |
31 | 41 | | |
| |||
38 | 48 | | |
39 | 49 | | |
40 | 50 | | |
| 51 | + | |
41 | 52 | | |
42 | 53 | | |
43 | 54 | | |
| |||
52 | 63 | | |
53 | 64 | | |
54 | 65 | | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
55 | 75 | | |
56 | 76 | | |
57 | 77 | | |
| |||
69 | 89 | | |
70 | 90 | | |
71 | 91 | | |
72 | | - | |
| 92 | + | |
73 | 93 | | |
74 | 94 | | |
75 | 95 | | |
76 | 96 | | |
77 | 97 | | |
78 | 98 | | |
79 | | - | |
| 99 | + | |
80 | 100 | | |
81 | 101 | | |
82 | 102 | | |
| |||
87 | 107 | | |
88 | 108 | | |
89 | 109 | | |
90 | | - | |
| 110 | + | |
91 | 111 | | |
92 | 112 | | |
93 | 113 | | |
94 | 114 | | |
95 | 115 | | |
96 | 116 | | |
97 | 117 | | |
98 | | - | |
| 118 | + | |
99 | 119 | | |
100 | 120 | | |
101 | 121 | | |
| |||
106 | 126 | | |
107 | 127 | | |
108 | 128 | | |
109 | | - | |
| 129 | + | |
110 | 130 | | |
111 | 131 | | |
112 | 132 | | |
| |||
117 | 137 | | |
118 | 138 | | |
119 | 139 | | |
120 | | - | |
| 140 | + | |
121 | 141 | | |
122 | 142 | | |
123 | 143 | | |
124 | 144 | | |
125 | 145 | | |
126 | 146 | | |
127 | 147 | | |
128 | | - | |
| 148 | + | |
129 | 149 | | |
130 | 150 | | |
131 | 151 | | |
| |||
136 | 156 | | |
137 | 157 | | |
138 | 158 | | |
139 | | - | |
| 159 | + | |
140 | 160 | | |
141 | 161 | | |
142 | 162 | | |
| |||
147 | 167 | | |
148 | 168 | | |
149 | 169 | | |
150 | | - | |
| 170 | + | |
151 | 171 | | |
152 | 172 | | |
153 | 173 | | |
154 | 174 | | |
155 | 175 | | |
156 | 176 | | |
157 | | - | |
| 177 | + | |
158 | 178 | | |
159 | 179 | | |
160 | 180 | | |
161 | 181 | | |
162 | 182 | | |
163 | 183 | | |
164 | | - | |
| 184 | + | |
165 | 185 | | |
166 | 186 | | |
167 | 187 | | |
168 | 188 | | |
169 | 189 | | |
170 | 190 | | |
171 | | - | |
| 191 | + | |
172 | 192 | | |
173 | 193 | | |
174 | 194 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
Lines changed: 43 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
0 commit comments