Skip to content

Commit

A desktop release lists every platform it built. Each build job notes what it collected in a file named for its machine, and the Windows build on Linux runs on the same kind of machine as the Linux build, so its notes replaced the Linux job's when the publish job merged them: 0.2.0's files all uploaded, but its manifest named Windows alone. The notes are named for the platforms they hold now.

syntaqxcommitted Parenta59c006Browse files
2 files+23−40/2 viewed
+13−3
200200 }
201201 }
202202 if (entries.length === 0) throw new Error("no bundles found: run build first");
203− // One notes file per machine, so the folders of several machines merge
204− // by copying them together (the release workflow does).
205− writeFileSync(join(dir, `collect-${hostPlatform()}.json`), `${JSON.stringify(entries, null, 2)}\n`);
203+ // One notes file per set of platforms collected, so the folders of
204+ // several jobs merge by copying them together (the release workflow
205+ // does). It is named for what it holds, not the machine: the Windows
206+ // build on Linux runs on the same kind of machine as the Linux build, and
207+ // a file named for the machine replaced the Linux notes, which left
208+ // Linux out of the manifest.
209+ writeFileSync(join(dir, notesName(entries)), `${JSON.stringify(entries, null, 2)}\n`);
206210 console.log(`collected ${entries.length} files of ${v} into ${dir}`);
207211 }
208212
209213 const isNotes = (name) => /^collect-.*\.json$/.test(name);
210214
215+/** The notes file's name for these entries: the platforms they are for, such as `collect-linux-x64.json`. */
216+export function notesName(entries) {
217+ const platforms = [...new Set(entries.map((entry) => `${entry.platform}-${entry.arch}`))].sort();
218+ return `collect-${platforms.join("+")}.json`;
219+}
220+
211221 function writeManifest(notes) {
212222 const v = version();
213223 const dir = outDir(v);
+10−1
11 import assert from "node:assert/strict";
22 import { test } from "node:test";
33
4−import { classify, hostPlatform, manifest, platformOfTriple } from "./desktop-release.mjs";
4+import { classify, hostPlatform, manifest, notesName, platformOfTriple } from "./desktop-release.mjs";
5+
6+test("each job's notes are named for the platforms they hold, so jobs on the same kind of machine do not overwrite each other", () => {
7+ const linux = [{ platform: "linux", arch: "x64" }, { platform: "linux", arch: "x64" }];
8+ const windows = [{ platform: "windows", arch: "x64" }];
9+ assert.equal(notesName(linux), "collect-linux-x64.json");
10+ assert.equal(notesName(windows), "collect-windows-x64.json");
11+ assert.notEqual(notesName(linux), notesName(windows));
12+ assert.equal(notesName([...windows, ...linux]), "collect-linux-x64+windows-x64.json");
13+});
514
615 test("a bundle's place in a release", () => {
716 assert.deepEqual(classify("g1t_0.1.0_x64-setup.exe", "windows-x64", "0.1.0"), {