[215] Cycles: Bau (CI Linux/macOS) und Auslieferung (Tauri, Electron)
check / check (push) Has been cancelled
check / licenses (push) Has been cancelled
check / e2e (push) Has been cancelled
macos / native (push) Has been cancelled
cycles / linux (push) Has been cancelled
cycles / macos (push) Has been cancelled

cycles.yml baut Cycles je Plattform (Linux x86_64, macOS arm64) und legt das Paket als Artefakt und am Gitea-Release cycles-<version> ab;
release.yml lädt es vor dem App-Bau (get.sh). Mitgeliefert: Electron extraResources (resources/cycles), Tauri externalBin + resources
(tauri.cycles.conf.json). Fassade src/native/cyclesRuntime.ts (cyclesAvailable, runCycles mit Fortschritt und Abbruch), Hauptprozess und
Rust (cycles.rs) prüfen die Argumente und starten nur das Paketprogramm. build-macos.sh fertig, Lizenztexte im Paket, NOTICE, doc/CYCLES.md.
Geprüft: vitest, rustc --test, AppImage mit Linux-Paket (test:linux-app, Fall Cycles). Nicht geprüft: Workflows, Mac, Tauri-Befehle.
This commit is contained in:
Claude committed 2026-11-16 17:01:38 +00:00
1 parent e3fcfb0e3c
commit d0ba3f17ae
35 files changed
+1785 -58

No files matched your search

+19
View File
@@ -0,0 +1,19 @@
<cycles>
<film exposure="0.03" />
<integrator max_bounce="6" max_diffuse_bounce="3" max_glossy_bounce="3" max_transmission_bounce="6" use_denoise="true" />
<camera width="1280" height="720" />
<transform matrix="0.771930 0.635707 -0.000000 0.000000 -0.094206 0.114393 0.988959 0.000000 -0.628688 0.763407 -0.148191 0.000000 14.000000 -17.000000 5.500000 1.000000"><camera type="perspective" fov="0.7853981633974483" nearclip="0.1" farclip="1000" /></transform>
<background>
<sky_texture name="sky" sky_type="multiple_scattering" sun_disc="true" sun_size="0.009512" sun_intensity="1.0" sun_elevation="0.6632251157578453" sun_rotation="2.6179938779914944" air_density="1.0" aerosol_density="1.0" ozone_density="1.0" altitude="100" />
<background name="bg" strength="1.0" />
<connect from="sky color" to="bg color" />
<connect from="bg background" to="output surface" />
</background>
<shader name="putz"><principled_bsdf name="p" base_color="0.82 0.78 0.70" roughness="0.85" metallic="0" /><connect from="p bsdf" to="output surface" /></shader>
<shader name="ziegel"><principled_bsdf name="p" base_color="0.45 0.12 0.07" roughness="0.7" metallic="0" /><connect from="p bsdf" to="output surface" /></shader>
<shader name="gras"><principled_bsdf name="p" base_color="0.12 0.25 0.05" roughness="0.9" metallic="0" /><connect from="p bsdf" to="output surface" /></shader>
<state shader="default_background"><light light_type="background" use_mis="true" map_resolution="1024" /></state>
<state shader="putz" interpolation="flat"><mesh P="-5 -4 0 5 -4 0 5 4 0 -5 4 0 -5 -4 3 5 -4 3 5 4 3 -5 4 3" nverts="4 4 4 4 4 4" verts="0 3 2 1 4 5 6 7 0 1 5 4 1 2 6 5 2 3 7 6 3 0 4 7" /><mesh P="-5 -4 3 -5 4 3 -5 0 5.2 5 4 3 5 -4 3 5 0 5.2" nverts="3 3" verts="0 1 2 3 4 5" /></state>
<state shader="ziegel" interpolation="flat"><mesh P="-5.5 -4.5 2.7 5.5 -4.5 2.7 5.5 0 5.2 -5.5 0 5.2 -5.5 4.5 2.7 5.5 4.5 2.7" nverts="4 4" verts="0 1 2 3 3 2 5 4" /></state>
<state shader="gras" interpolation="flat"><mesh P="-60 -60 0 60 -60 0 60 60 0 -60 60 0" nverts="4" verts="0 1 2 3" /></state>
</cycles>
+70 -1
View File
@@ -9,9 +9,10 @@
// durch die App (IPC, atomares Schreiben, Export-Bytes) bleibt der echte.
import { _electron, type ElectronApplication, type Page } from "playwright";
import { test, expect } from "@playwright/test";
import { buildSync } from "esbuild";
import { existsSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, rmSync } from "node:fs";
import { tmpdir } from "node:os";
import { join } from "node:path";
import { join, resolve } from "node:path";
const BIN = process.env.DOSSIER_ELECTRON_BIN ?? "";
@@ -302,3 +303,71 @@ test("Externe Links: kein Kindfenster, shell.openExternal für https, Navigation
expect(state.text).toMatch(/Neues Projekt|New project/);
await close(r);
});
// [215] Mitgeliefertes Cycles: im AppImage liegt `resources/cycles/cycles`; die Fassade `src/native/cyclesRuntime.ts` (hier mit esbuild in die
// Seite geladen, damit der echte Code über Preload → Hauptprozess → Prozessstart läuft) findet es, rendert die kleine Testszene mit 8 Samples
// zu einem PNG und meldet Fortschritt; Abbruch beendet den Prozess. Läuft nur, wenn das Paket mit Cycles gebaut wurde
// (`DOSSIER_CYCLES_DIR=<ordner> npm run electron:pack`, s. doc/CYCLES.md), sonst übersprungen.
test("Cycles: mitgeliefert, cyclesAvailable, runCycles rendert haus (8 Samples) zu PNG mit Fortschritt, Abbruch", async () => {
const r = await launch();
const { page, app } = r;
await expect(page.getByRole("button", { name: /Neues Projekt/ }).first()).toBeVisible({ timeout: 60_000 });
const res = await app.evaluate(({ app }) => ({ packaged: app.isPackaged, resources: process.resourcesPath }));
test.skip(!existsSync(join(res.resources, "cycles", "cycles")), "Paket ohne Cycles gebaut");
expect(res.packaged).toBe(true);
const facade = buildSync({
entryPoints: [resolve(process.cwd(), "src/native/cyclesRuntime.ts")],
bundle: true,
format: "iife",
globalName: "__cyclesFacade",
footer: { js: "window.__cyclesFacade = __cyclesFacade;" },
platform: "browser",
write: false,
}).outputFiles[0].text;
await page.evaluate(facade); // Runtime.evaluate: von der Seiten-CSP (kein eval) nicht betroffen
const xml = readFileSync(resolve(process.cwd(), "e2e/fixtures/cycles-haus.xml"), "utf8");
type Facade = {
cyclesAvailable(): Promise<boolean>;
prepareCyclesScene(f: { path: string; bytes: Uint8Array }[]): Promise<string>;
runCycles(dir: string, args: string[], on: (p: { fraction: number; sample: number; samples: number }) => void, signal?: AbortSignal): Promise<{ code: number; cancelled: boolean; lines: string[] }>;
readCyclesFile(path: string): Promise<Uint8Array>;
};
const out = await page.evaluate(async (xml) => {
const c = (window as unknown as { __cyclesFacade: Facade }).__cyclesFacade;
const available = await c.cyclesAvailable();
const dir = await c.prepareCyclesScene([{ path: "haus.xml", bytes: new TextEncoder().encode(xml) }]);
const progress: { sample: number; samples: number }[] = [];
const t0 = Date.now();
const run = await c.runCycles(dir, ["--background", "--device", "CPU", "--samples", "8", "--width", "320", "--height", "180", "--output", "out.png", "haus.xml"], (p) => progress.push({ sample: p.sample, samples: p.samples }));
const ms = Date.now() - t0;
const png = await c.readCyclesFile(`${dir}/out.png`);
// Abbruch: grosse Zahl Samples, nach dem ersten Fortschritt abbrechen
const ac = new AbortController();
const t1 = Date.now();
const aborted = await c.runCycles(dir, ["--background", "--device", "CPU", "--samples", "5000", "--width", "640", "--height", "360", "--output", "x.png", "haus.xml"], () => ac.abort(), ac.signal);
return { available, dir, progress, run, ms, head: Array.from(png.subarray(0, 8)), pngBytes: png.length, aborted, abortMs: Date.now() - t1 };
}, xml);
expect(out.available).toBe(true);
expect(out.dir).toContain("dossier-render");
expect(out.run.code).toBe(0);
expect(out.run.cancelled).toBe(false);
expect(out.progress.length).toBeGreaterThan(0);
expect(out.progress.at(-1)).toEqual({ sample: 8, samples: 8 });
expect(out.head).toEqual([0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a]);
expect(out.pngBytes).toBeGreaterThan(2000);
expect(out.aborted.cancelled).toBe(true);
expect(out.aborted.code).not.toBe(0);
expect(out.abortMs).toBeLessThan(20_000);
// Argumente werden im Hauptprozess geprüft: fremde Schalter und Pfade ausserhalb des Arbeitsordners starten nichts.
const rejected = await page.evaluate(async (dir) => {
const c = (window as unknown as { __cyclesFacade: Facade }).__cyclesFacade;
const tries = [["--help", "haus.xml"], ["--output", "../../etc/x.png", "haus.xml"], ["/etc/hosts.xml"]];
const outcomes: string[] = [];
for (const a of tries) outcomes.push(await c.runCycles(dir, a, () => {}).then(() => "gestartet", (e: Error) => e.message));
return outcomes;
}, out.dir);
expect(rejected.every((m) => m !== "gestartet")).toBe(true);
// Das gerenderte Bild stimmt grob (kein leeres Schwarz): Dateigrösse des 320×180-PNG nach Entrauschen > 2 kB (oben).
r.errors = r.errors.filter((e) => !/Error invoking remote method 'cycles:start'/.test(e));
await close(r);
});