2026-04-05 00:53:40 +00:00
|
|
|
import { describe, expect, it } from "vitest";
|
|
|
|
|
import { readFileSync } from "node:fs";
|
|
|
|
|
import path from "node:path";
|
|
|
|
|
|
2026-04-05 02:34:15 +00:00
|
|
|
const autoTagWorkflowPath = path.resolve(
|
2026-04-05 00:53:40 +00:00
|
|
|
process.cwd(),
|
2026-04-05 02:34:15 +00:00
|
|
|
".gitea/workflows/auto-tag.yml",
|
2026-04-05 00:53:40 +00:00
|
|
|
);
|
|
|
|
|
|
2026-04-05 02:34:15 +00:00
|
|
|
describe("auto-tag release cross-platform artifact handling", () => {
|
2026-04-05 00:53:40 +00:00
|
|
|
it("overrides OpenSSL vendoring for windows-gnu cross builds", () => {
|
2026-04-05 02:34:15 +00:00
|
|
|
const workflow = readFileSync(autoTagWorkflowPath, "utf-8");
|
2026-04-05 00:53:40 +00:00
|
|
|
|
|
|
|
|
expect(workflow).toContain("OPENSSL_NO_VENDOR: \"0\"");
|
|
|
|
|
expect(workflow).toContain("OPENSSL_STATIC: \"1\"");
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it("fails linux uploads when no artifacts are found", () => {
|
2026-04-05 02:34:15 +00:00
|
|
|
const workflow = readFileSync(autoTagWorkflowPath, "utf-8");
|
2026-04-05 00:53:40 +00:00
|
|
|
|
|
|
|
|
expect(workflow).toContain("ERROR: No Linux amd64 artifacts were found to upload.");
|
|
|
|
|
expect(workflow).toContain("ERROR: No Linux arm64 artifacts were found to upload.");
|
2026-04-05 03:15:02 +00:00
|
|
|
expect(workflow).toContain("cargo tauri build --target aarch64-unknown-linux-gnu");
|
|
|
|
|
expect(workflow).toContain(
|
|
|
|
|
"find src-tauri/target/aarch64-unknown-linux-gnu/release/bundle -type f",
|
|
|
|
|
);
|
2026-04-05 00:53:40 +00:00
|
|
|
});
|
2026-04-05 02:09:03 +00:00
|
|
|
|
|
|
|
|
it("fails windows uploads when no artifacts are found", () => {
|
2026-04-05 02:34:15 +00:00
|
|
|
const workflow = readFileSync(autoTagWorkflowPath, "utf-8");
|
2026-04-05 02:09:03 +00:00
|
|
|
|
|
|
|
|
expect(workflow).toContain(
|
|
|
|
|
"ERROR: No Windows amd64 artifacts were found to upload.",
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it("replaces existing release assets before uploading reruns", () => {
|
2026-04-05 02:34:15 +00:00
|
|
|
const workflow = readFileSync(autoTagWorkflowPath, "utf-8");
|
2026-04-05 02:09:03 +00:00
|
|
|
|
|
|
|
|
expect(workflow).toContain("Deleting existing asset id=$id name=$NAME before upload...");
|
|
|
|
|
expect(workflow).toContain("-X DELETE \"$API/releases/$RELEASE_ID/assets/$id\"");
|
|
|
|
|
});
|
2026-04-05 00:53:40 +00:00
|
|
|
});
|