Skip to content

Commit b24b05a

Browse files
committed
fix(ci): harden mirror bootstrap release smoke
1 parent 6b82447 commit b24b05a

4 files changed

Lines changed: 41 additions & 11 deletions

File tree

.github/workflows/release-desktop-multi-os.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ jobs:
8181
echo "Godot mirror release already exists: $GODOT_MIRROR_TAG"
8282
else
8383
gh release create "$GODOT_MIRROR_TAG" \
84+
--target "$GITHUB_SHA" \
8485
--title "$GODOT_MIRROR_TAG" \
8586
--notes "Project-controlled mirror for Godot desktop bootstrap archives."
8687
fi

scripts/tauri-sidecar-utils.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,14 +430,19 @@ function validateTauriSidecars(options = {}) {
430430
const repoRoot = options.repoRoot || path.resolve(__dirname, '..');
431431
const platform = options.platform || process.platform;
432432
const arch = options.arch || process.arch;
433+
const env = options.env || process.env;
433434
const validateAll = options.validateAll === true;
434435
const binDir = path.join(repoRoot, 'src-tauri', 'bin');
435436

436437
const requiredServerBinaryNames = validateAll
437438
? [SERVER_BINARIES.windows_x64, SERVER_BINARIES.linux_x64, SERVER_BINARIES.macos_arm64]
438439
: [resolveHostServerBinaryName({ platform, arch })].filter(Boolean);
439440
const requiredMarkdownWorkerBinaryNames = [resolveHostMarkdownWorkerBinaryName({ platform, arch })].filter(Boolean);
440-
const requiredGodotBinaryNames = [resolveHostGodotBinaryName({ platform, arch })].filter(Boolean);
441+
const requiredGodotBinaryNames = validateAll
442+
? [HOST_GODOT_BINARY.windows_x64].filter(Boolean)
443+
: shouldFailOnMissing({ platform, env })
444+
? [resolveHostGodotBinaryName({ platform, arch })].filter(Boolean)
445+
: [];
441446

442447
const invalid = [];
443448

src/godot.sidecar.bootstrap.contract.test.ts

Lines changed: 32 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ type SidecarUtilsModule = {
4141
platform?: string;
4242
arch?: string;
4343
validateAll?: boolean;
44+
env?: Record<string, string | undefined>;
4445
}) => ValidateSidecarsResult;
4546
};
4647

@@ -233,15 +234,11 @@ describe('godot sidecar bootstrap contracts', () => {
233234
).rejects.toThrow(/sha256/i);
234235
});
235236

236-
test('validates the host-specific godot binary name together with server and markdown worker sidecars', () => {
237+
test('does not require a linux host godot binary by default when validating sidecars', () => {
237238
const fakeRepoRoot = temp.mkdir('repo');
238239
const binDir = temp.mkdir(path.join('repo', 'src-tauri', 'bin'));
239240
fs.writeFileSync(path.join(binDir, 'server-x86_64-unknown-linux-gnu'), 'server');
240241
fs.writeFileSync(path.join(binDir, 'markdown-worker-x86_64-unknown-linux-gnu'), 'worker');
241-
fs.writeFileSync(
242-
path.join(binDir, 'godot-x86_64-unknown-linux-gnu'),
243-
Buffer.alloc(sidecarUtils.MIN_GODOT_BINARY_BYTES + 8, 5)
244-
);
245242

246243
const result = sidecarUtils.validateTauriSidecars({
247244
repoRoot: fakeRepoRoot,
@@ -255,6 +252,36 @@ describe('godot sidecar bootstrap contracts', () => {
255252
expect(result.invalid).toEqual([]);
256253
});
257254

255+
test('requires the windows host godot binary together with server and markdown worker sidecars', () => {
256+
const fakeRepoRoot = temp.mkdir('repo');
257+
const binDir = temp.mkdir(path.join('repo', 'src-tauri', 'bin'));
258+
fs.writeFileSync(path.join(binDir, 'server-x86_64-pc-windows-msvc.exe'), 'server');
259+
fs.writeFileSync(path.join(binDir, 'markdown-worker-x86_64-pc-windows-msvc.exe'), 'worker');
260+
261+
const missingGodot = sidecarUtils.validateTauriSidecars({
262+
repoRoot: fakeRepoRoot,
263+
platform: 'win32',
264+
arch: 'x64',
265+
});
266+
267+
expect(missingGodot.invalid).toEqual([
268+
expect.stringContaining('godot-x86_64-pc-windows-msvc.exe'),
269+
]);
270+
271+
fs.writeFileSync(
272+
path.join(binDir, 'godot-x86_64-pc-windows-msvc.exe'),
273+
Buffer.alloc(sidecarUtils.MIN_GODOT_BINARY_BYTES + 8, 5)
274+
);
275+
276+
const ready = sidecarUtils.validateTauriSidecars({
277+
repoRoot: fakeRepoRoot,
278+
platform: 'win32',
279+
arch: 'x64',
280+
});
281+
282+
expect(ready.invalid).toEqual([]);
283+
});
284+
258285
test('treats git-lfs pointer placeholders as invalid server and markdown-worker sidecars', () => {
259286
const fakeRepoRoot = temp.mkdir('repo');
260287
const binDir = temp.mkdir(path.join('repo', 'src-tauri', 'bin'));
@@ -266,11 +293,6 @@ describe('godot sidecar bootstrap contracts', () => {
266293

267294
fs.writeFileSync(path.join(binDir, 'server-x86_64-unknown-linux-gnu'), lfsPointer);
268295
fs.writeFileSync(path.join(binDir, 'markdown-worker-x86_64-unknown-linux-gnu'), lfsPointer);
269-
fs.writeFileSync(
270-
path.join(binDir, 'godot-x86_64-unknown-linux-gnu'),
271-
Buffer.alloc(sidecarUtils.MIN_GODOT_BINARY_BYTES + 8, 5)
272-
);
273-
274296
const result = sidecarUtils.validateTauriSidecars({
275297
repoRoot: fakeRepoRoot,
276298
platform: 'linux',

src/release.godot.mirror.contract.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ describe('release workflow godot mirror contract', () => {
1515

1616
expect(workflow).toContain('GODOT_MIRROR_TAG: "godot-mirror-v4.3-stable"');
1717
expect(workflow).toContain('ensure-godot-mirror-assets:');
18+
expect(workflow).toContain('gh release create "$GODOT_MIRROR_TAG" \\');
19+
expect(workflow).toContain('--target "$GITHUB_SHA" \\');
1820
expect(workflow).toContain('gh release upload "$GODOT_MIRROR_TAG"');
1921
expect(workflow).toContain(
2022
'https://github.com/Jacobinwwey/NoteConnection/releases/download/${GODOT_MIRROR_TAG}'

0 commit comments

Comments
 (0)