fix: downgrade @actions/artifact to v1 for Gitea compatibility
This commit is contained in:
+14
-24
@@ -12,19 +12,19 @@ vi.mock("@actions/core", () => ({
|
||||
}));
|
||||
|
||||
import * as artifact from "@actions/artifact";
|
||||
vi.mock("@actions/artifact", () => ({
|
||||
DefaultArtifactClient: class {
|
||||
uploadArtifact() {
|
||||
return Promise.resolve({});
|
||||
}
|
||||
},
|
||||
}));
|
||||
vi.mock("@actions/artifact", () => {
|
||||
const mockClient = {
|
||||
uploadArtifact: vi.fn().mockResolvedValue({}),
|
||||
};
|
||||
return {
|
||||
create: vi.fn(() => mockClient),
|
||||
};
|
||||
});
|
||||
|
||||
import * as core from "@actions/core";
|
||||
import fs from "fs";
|
||||
import os from "os";
|
||||
import path from "path";
|
||||
import { DefaultArtifactClient } from "@actions/artifact";
|
||||
|
||||
import {
|
||||
isOfficialServer,
|
||||
@@ -178,29 +178,22 @@ describe("uploadLogArtifacts", () => {
|
||||
vi.clearAllMocks();
|
||||
});
|
||||
|
||||
it("instantiates DefaultArtifactClient and calls uploadArtifact", async () => {
|
||||
const spy = vi.spyOn(
|
||||
artifact.DefaultArtifactClient.prototype,
|
||||
"uploadArtifact",
|
||||
);
|
||||
it("instantiates client and calls uploadArtifact", async () => {
|
||||
await uploadLogArtifacts(
|
||||
["/path/to/shard0_console_log.txt"],
|
||||
"custom-name",
|
||||
);
|
||||
expect(spy).toHaveBeenCalledWith(
|
||||
expect(artifact.create().uploadArtifact).toHaveBeenCalledWith(
|
||||
"custom-name",
|
||||
["/path/to/shard0_console_log.txt"],
|
||||
"/path/to",
|
||||
{ continueOnError: true },
|
||||
);
|
||||
});
|
||||
|
||||
it("does nothing if filePaths is empty", async () => {
|
||||
const spy = vi.spyOn(
|
||||
artifact.DefaultArtifactClient.prototype,
|
||||
"uploadArtifact",
|
||||
);
|
||||
await uploadLogArtifacts([]);
|
||||
expect(spy).not.toHaveBeenCalled();
|
||||
expect(artifact.create().uploadArtifact).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -622,22 +615,19 @@ describe("monitorConsole", () => {
|
||||
}, 50);
|
||||
|
||||
// Verify uploadArtifact was called with two files
|
||||
const spy = vi.spyOn(
|
||||
artifact.DefaultArtifactClient.prototype,
|
||||
"uploadArtifact",
|
||||
);
|
||||
await monitorConsole(api, {
|
||||
...BASE_OPTS,
|
||||
logToFile: true,
|
||||
});
|
||||
|
||||
expect(spy).toHaveBeenCalledWith(
|
||||
expect(artifact.create().uploadArtifact).toHaveBeenCalledWith(
|
||||
"screeps-console-log",
|
||||
expect.arrayContaining([
|
||||
expect.stringContaining("shard0_console_log.txt"),
|
||||
expect.stringContaining("shard1_console_log.txt"),
|
||||
]),
|
||||
expect.any(String),
|
||||
{ continueOnError: true },
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user