Skip to content

Commit b7df3df

Browse files
[codex] Fix Windows release manifest publishing (#2095)
1 parent 6891c77 commit b7df3df

2 files changed

Lines changed: 149 additions & 12 deletions

File tree

.github/workflows/release.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,10 @@ jobs:
368368
shopt -s nullglob
369369
found_windows_manifest=false
370370
for x64_manifest in release-assets/*-win-x64.yml; do
371+
if [[ "$(basename "$x64_manifest")" == builder-debug-* ]]; then
372+
continue
373+
fi
374+
371375
arm64_manifest="${x64_manifest/-x64.yml/-arm64.yml}"
372376
output_manifest="${x64_manifest/-win-x64.yml/.yml}"
373377
if [[ ! -f "$arm64_manifest" ]]; then

scripts/release-smoke.ts

Lines changed: 145 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
import { execFileSync } from "node:child_process";
2-
import { cpSync, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs";
2+
import {
3+
cpSync,
4+
existsSync,
5+
mkdirSync,
6+
mkdtempSync,
7+
readFileSync,
8+
rmSync,
9+
writeFileSync,
10+
} from "node:fs";
311
import { tmpdir } from "node:os";
412
import { dirname, join, resolve } from "node:path";
513
import { fileURLToPath } from "node:url";
@@ -70,12 +78,15 @@ releaseDate: '2026-03-08T10:36:07.540Z'
7078
return { arm64Path, x64Path };
7179
}
7280

73-
function writeWindowsManifestFixtures(targetRoot: string): { arm64Path: string; x64Path: string } {
81+
function writeWindowsManifestFixtures(
82+
targetRoot: string,
83+
channel: string,
84+
): { arm64Path: string; x64Path: string } {
7485
const assetDirectory = resolve(targetRoot, "release-assets");
7586
mkdirSync(assetDirectory, { recursive: true });
7687

77-
const arm64Path = resolve(assetDirectory, "latest-win-arm64.yml");
78-
const x64Path = resolve(assetDirectory, "latest-win-x64.yml");
88+
const arm64Path = resolve(assetDirectory, `${channel}-win-arm64.yml`);
89+
const x64Path = resolve(assetDirectory, `${channel}-win-x64.yml`);
7990

8091
writeFileSync(
8192
arm64Path,
@@ -112,12 +123,46 @@ releaseDate: '2026-03-08T10:36:07.540Z'
112123
return { arm64Path, x64Path };
113124
}
114125

126+
function writeWindowsBuilderDebugFixtures(targetRoot: string): {
127+
arm64Path: string;
128+
x64Path: string;
129+
} {
130+
const assetDirectory = resolve(targetRoot, "release-assets");
131+
mkdirSync(assetDirectory, { recursive: true });
132+
133+
const arm64Path = resolve(assetDirectory, "builder-debug-win-arm64.yml");
134+
const x64Path = resolve(assetDirectory, "builder-debug-win-x64.yml");
135+
const debugFixture = `arm64:
136+
firstOrDefaultFilePatterns:
137+
- '**/*'
138+
nsis:
139+
script: |-
140+
!include "example.nsh"
141+
`;
142+
143+
writeFileSync(arm64Path, debugFixture);
144+
writeFileSync(x64Path, debugFixture);
145+
146+
return { arm64Path, x64Path };
147+
}
115148
function assertContains(haystack: string, needle: string, message: string): void {
116149
if (!haystack.includes(needle)) {
117150
throw new Error(message);
118151
}
119152
}
120153

154+
function assertExists(path: string, message: string): void {
155+
if (!existsSync(path)) {
156+
throw new Error(message);
157+
}
158+
}
159+
160+
function assertMissing(path: string, message: string): void {
161+
if (existsSync(path)) {
162+
throw new Error(message);
163+
}
164+
}
165+
121166
const tempRoot = mkdtempSync(join(tmpdir(), "t3-release-smoke-"));
122167

123168
try {
@@ -211,23 +256,60 @@ try {
211256
"Merged manifest is missing the x64 asset.",
212257
);
213258

214-
const { arm64Path: winArm64Path, x64Path: winX64Path } = writeWindowsManifestFixtures(tempRoot);
259+
const { arm64Path: winArm64Path, x64Path: winX64Path } = writeWindowsManifestFixtures(
260+
tempRoot,
261+
"latest",
262+
);
263+
const mergedWindowsManifestPath = resolve(tempRoot, "release-assets/latest.yml");
264+
const { arm64Path: nightlyWinArm64Path, x64Path: nightlyWinX64Path } =
265+
writeWindowsManifestFixtures(tempRoot, "nightly");
266+
const mergedNightlyWindowsManifestPath = resolve(tempRoot, "release-assets/nightly.yml");
267+
const { arm64Path: previewWinArm64Path, x64Path: previewWinX64Path } =
268+
writeWindowsManifestFixtures(tempRoot, "preview");
269+
const mergedPreviewWindowsManifestPath = resolve(tempRoot, "release-assets/preview.yml");
270+
const { arm64Path: winDebugArm64Path, x64Path: winDebugX64Path } =
271+
writeWindowsBuilderDebugFixtures(tempRoot);
215272
execFileSync(
216-
process.execPath,
273+
"bash",
217274
[
218-
resolve(repoRoot, "scripts/merge-update-manifests.ts"),
219-
"--platform",
220-
"win",
221-
winArm64Path,
222-
winX64Path,
275+
"-lc",
276+
`
277+
release_assets_dir=${JSON.stringify(resolve(tempRoot, "release-assets"))}
278+
shopt -s nullglob
279+
found_windows_manifest=false
280+
for x64_manifest in "$release_assets_dir"/*-win-x64.yml; do
281+
if [[ "$(basename "$x64_manifest")" == builder-debug-* ]]; then
282+
continue
283+
fi
284+
285+
arm64_manifest="\${x64_manifest/-x64.yml/-arm64.yml}"
286+
output_manifest="\${x64_manifest/-win-x64.yml/.yml}"
287+
if [[ ! -f "$arm64_manifest" ]]; then
288+
echo "Missing matching arm64 Windows manifest for $x64_manifest" >&2
289+
exit 1
290+
fi
291+
292+
found_windows_manifest=true
293+
node ${JSON.stringify(resolve(repoRoot, "scripts/merge-update-manifests.ts"))} --platform win \
294+
"$arm64_manifest" \
295+
"$x64_manifest" \
296+
"$output_manifest"
297+
rm -f "$arm64_manifest" "$x64_manifest"
298+
done
299+
300+
if [[ "$found_windows_manifest" != true ]]; then
301+
echo "No Windows updater manifests found to merge." >&2
302+
exit 1
303+
fi
304+
`,
223305
],
224306
{
225307
cwd: repoRoot,
226308
stdio: "inherit",
227309
},
228310
);
229311

230-
const mergedWindowsManifest = readFileSync(winArm64Path, "utf8");
312+
const mergedWindowsManifest = readFileSync(mergedWindowsManifestPath, "utf8");
231313
assertContains(
232314
mergedWindowsManifest,
233315
"T3-Code-9.9.9-smoke.0-arm64.exe",
@@ -238,6 +320,57 @@ try {
238320
"T3-Code-9.9.9-smoke.0-x64.exe",
239321
"Merged Windows manifest is missing the x64 asset.",
240322
);
323+
const mergedNightlyWindowsManifest = readFileSync(mergedNightlyWindowsManifestPath, "utf8");
324+
assertContains(
325+
mergedNightlyWindowsManifest,
326+
"T3-Code-9.9.9-smoke.0-arm64.exe",
327+
"Merged nightly Windows manifest is missing the arm64 asset.",
328+
);
329+
assertContains(
330+
mergedNightlyWindowsManifest,
331+
"T3-Code-9.9.9-smoke.0-x64.exe",
332+
"Merged nightly Windows manifest is missing the x64 asset.",
333+
);
334+
const mergedPreviewWindowsManifest = readFileSync(mergedPreviewWindowsManifestPath, "utf8");
335+
assertContains(
336+
mergedPreviewWindowsManifest,
337+
"T3-Code-9.9.9-smoke.0-arm64.exe",
338+
"Merged preview Windows manifest is missing the arm64 asset.",
339+
);
340+
assertContains(
341+
mergedPreviewWindowsManifest,
342+
"T3-Code-9.9.9-smoke.0-x64.exe",
343+
"Merged preview Windows manifest is missing the x64 asset.",
344+
);
345+
assertMissing(
346+
winArm64Path,
347+
"Windows release smoke unexpectedly kept the arm64 updater manifest.",
348+
);
349+
assertMissing(winX64Path, "Windows release smoke unexpectedly kept the x64 updater manifest.");
350+
assertMissing(
351+
nightlyWinArm64Path,
352+
"Windows release smoke unexpectedly kept the nightly arm64 updater manifest.",
353+
);
354+
assertMissing(
355+
nightlyWinX64Path,
356+
"Windows release smoke unexpectedly kept the nightly x64 updater manifest.",
357+
);
358+
assertMissing(
359+
previewWinArm64Path,
360+
"Windows release smoke unexpectedly kept the preview arm64 updater manifest.",
361+
);
362+
assertMissing(
363+
previewWinX64Path,
364+
"Windows release smoke unexpectedly kept the preview x64 updater manifest.",
365+
);
366+
assertExists(
367+
winDebugArm64Path,
368+
"Windows release smoke unexpectedly removed the arm64 builder debug fixture.",
369+
);
370+
assertExists(
371+
winDebugX64Path,
372+
"Windows release smoke unexpectedly removed the x64 builder debug fixture.",
373+
);
241374

242375
console.log("Release smoke checks passed.");
243376
} finally {

0 commit comments

Comments
 (0)