| ... | @@ -1,5 +1,13 @@ | ... | @@ -1,5 +1,13 @@ |
| 1 | import { execFileSync } from "node:child_process"; | 1 | 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"; |
| 3 | import { tmpdir } from "node:os"; | 11 | import { tmpdir } from "node:os"; |
| 4 | import { dirname, join, resolve } from "node:path"; | 12 | import { dirname, join, resolve } from "node:path"; |
| 5 | import { fileURLToPath } from "node:url"; | 13 | import { fileURLToPath } from "node:url"; |
| ... | @@ -70,12 +78,15 @@ releaseDate: '2026-03-08T10:36:07.540Z' | ... | @@ -70,12 +78,15 @@ releaseDate: '2026-03-08T10:36:07.540Z' |
| 70 | return { arm64Path, x64Path }; | 78 | return { arm64Path, x64Path }; |
| 71 | } | 79 | } |
| 72 | | 80 | |
| 73 | function writeWindowsManifestFixtures(targetRoot: string): { arm64Path: string; x64Path: string } { | 81 | function writeWindowsManifestFixtures( |
| | 82 | targetRoot: string, |
| | 83 | channel: string, |
| | 84 | ): { arm64Path: string; x64Path: string } { |
| 74 | const assetDirectory = resolve(targetRoot, "release-assets"); | 85 | const assetDirectory = resolve(targetRoot, "release-assets"); |
| 75 | mkdirSync(assetDirectory, { recursive: true }); | 86 | mkdirSync(assetDirectory, { recursive: true }); |
| 76 | | 87 | |
| 77 | const arm64Path = resolve(assetDirectory, "latest-win-arm64.yml"); | 88 | const arm64Path = resolve(assetDirectory, `${channel}-win-arm64.yml`); |
| 78 | const x64Path = resolve(assetDirectory, "latest-win-x64.yml"); | 89 | const x64Path = resolve(assetDirectory, `${channel}-win-x64.yml`); |
| 79 | | 90 | |
| 80 | writeFileSync( | 91 | writeFileSync( |
| 81 | arm64Path, | 92 | arm64Path, |
| ... | @@ -112,12 +123,46 @@ releaseDate: '2026-03-08T10:36:07.540Z' | ... | @@ -112,12 +123,46 @@ releaseDate: '2026-03-08T10:36:07.540Z' |
| 112 | return { arm64Path, x64Path }; | 123 | return { arm64Path, x64Path }; |
| 113 | } | 124 | } |
| 114 | | 125 | |
| | 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 | } |
| 115 | function assertContains(haystack: string, needle: string, message: string): void { | 148 | function assertContains(haystack: string, needle: string, message: string): void { |
| 116 | if (!haystack.includes(needle)) { | 149 | if (!haystack.includes(needle)) { |
| 117 | throw new Error(message); | 150 | throw new Error(message); |
| 118 | } | 151 | } |
| 119 | } | 152 | } |
| 120 | | 153 | |
| | 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 | |
| 121 | const tempRoot = mkdtempSync(join(tmpdir(), "t3-release-smoke-")); | 166 | const tempRoot = mkdtempSync(join(tmpdir(), "t3-release-smoke-")); |
| 122 | | 167 | |
| 123 | try { | 168 | try { |
| ... | @@ -211,15 +256,52 @@ try { | ... | @@ -211,15 +256,52 @@ try { |
| 211 | "Merged manifest is missing the x64 asset.", | 256 | "Merged manifest is missing the x64 asset.", |
| 212 | ); | 257 | ); |
| 213 | | 258 | |
| 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); |
| 215 | execFileSync( | 272 | execFileSync( |
| 216 | process.execPath, | 273 | "bash", |
| 217 | [ | 274 | [ |
| 218 | resolve(repoRoot, "scripts/merge-update-manifests.ts"), | 275 | "-lc", |
| 219 | "--platform", | 276 | ` |
| 220 | "win", | 277 | release_assets_dir=${JSON.stringify(resolve(tempRoot, "release-assets"))} |
| 221 | winArm64Path, | 278 | shopt -s nullglob |
| 222 | winX64Path, | 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 | `, |
| 223 | ], | 305 | ], |
| 224 | { | 306 | { |
| 225 | cwd: repoRoot, | 307 | cwd: repoRoot, |
| ... | @@ -227,7 +309,7 @@ try { | ... | @@ -227,7 +309,7 @@ try { |
| 227 | }, | 309 | }, |
| 228 | ); | 310 | ); |
| 229 | | 311 | |
| 230 | const mergedWindowsManifest = readFileSync(winArm64Path, "utf8"); | 312 | const mergedWindowsManifest = readFileSync(mergedWindowsManifestPath, "utf8"); |
| 231 | assertContains( | 313 | assertContains( |
| 232 | mergedWindowsManifest, | 314 | mergedWindowsManifest, |
| 233 | "T3-Code-9.9.9-smoke.0-arm64.exe", | 315 | "T3-Code-9.9.9-smoke.0-arm64.exe", |
| ... | @@ -238,6 +320,57 @@ try { | ... | @@ -238,6 +320,57 @@ try { |
| 238 | "T3-Code-9.9.9-smoke.0-x64.exe", | 320 | "T3-Code-9.9.9-smoke.0-x64.exe", |
| 239 | "Merged Windows manifest is missing the x64 asset.", | 321 | "Merged Windows manifest is missing the x64 asset.", |
| 240 | ); | 322 | ); |
| | 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 | ); |
| 241 | | 374 | |
| 242 | console.log("Release smoke checks passed."); | 375 | console.log("Release smoke checks passed."); |
| 243 | } finally { | 376 | } finally { |