mirror of
https://github.com/snapotter-hq/SnapOtter.git
synced 2026-08-03 07:46:42 +02:00
fix: make OCR portable and reliable across AMD64 and ARM64 (#519)
* fix: make OCR portable and reliable * fix: harden OCR installation portability * fix: pin OCR partials across downloads * fix: make OCR execution reliably asynchronous * fix: harden OCR portability and docs routes * fix: preserve decoder and docs safeguards
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
import { readFileSync } from "node:fs";
|
||||
import { resolve } from "node:path";
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
const root = process.cwd();
|
||||
|
||||
function read(path: string): string {
|
||||
return readFileSync(resolve(root, path), "utf8");
|
||||
}
|
||||
|
||||
function workflowJob(workflow: string, name: string, nextName: string): string {
|
||||
const start = workflow.indexOf(` ${name}:\n`);
|
||||
const end = workflow.indexOf(` ${nextName}:\n`, start + name.length + 3);
|
||||
expect(start, `${name} should exist in ci.yml`).toBeGreaterThanOrEqual(0);
|
||||
expect(end, `${nextName} should follow ${name} in ci.yml`).toBeGreaterThan(start);
|
||||
return workflow.slice(start, end);
|
||||
}
|
||||
|
||||
function expectImageMagickExtraCoders(source: string): void {
|
||||
expect(source).toContain("libmagickcore-6.q16-7-extra");
|
||||
expect(source).toContain("libmagickcore-6.q16-6-extra");
|
||||
expect(source).toContain("No supported ImageMagick EXR coder package found");
|
||||
expect(source).toContain("convert -list format");
|
||||
}
|
||||
|
||||
describe("cross-platform image decoder dependencies", () => {
|
||||
it("installs EXR-capable ImageMagick coders in unit and integration CI", () => {
|
||||
const workflow = read(".github/workflows/ci.yml");
|
||||
expectImageMagickExtraCoders(workflowJob(workflow, "test-unit", "test-integration"));
|
||||
expectImageMagickExtraCoders(workflowJob(workflow, "test-integration", "test-e2e-smoke"));
|
||||
});
|
||||
|
||||
it("installs the same coders in production and test containers", () => {
|
||||
expectImageMagickExtraCoders(read("docker/Dockerfile"));
|
||||
expectImageMagickExtraCoders(read("docker/Dockerfile.test"));
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user