mirror of
https://github.com/oven-sh/setup-bun.git
synced 2026-05-23 14:40:45 +00:00
fix: use native Windows ARM64 binary for Bun >= 1.3.10 (#165)
Bun v1.3.10 ships native Windows ARM64 binaries. Update getArchitecture() and getAvx2() to be version-aware so that windows-11-arm runners download bun-windows-aarch64.zip instead of falling back to bun-windows-x64-baseline.zip. The x64 fallback is preserved for older versions that lack ARM64 assets. Closes #164 Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -7,6 +7,9 @@ const MOCK_TAGS = [
|
||||
{ ref: "refs/tags/bun-v1.0.0" },
|
||||
{ ref: "refs/tags/bun-v1.0.1" },
|
||||
{ ref: "refs/tags/bun-v1.1.0" },
|
||||
{ ref: "refs/tags/bun-v1.3.9" },
|
||||
{ ref: "refs/tags/bun-v1.3.10" },
|
||||
{ ref: "refs/tags/bun-v1.4.0" },
|
||||
{ ref: "refs/tags/canary" },
|
||||
];
|
||||
|
||||
@@ -98,7 +101,7 @@ describe("getDownloadUrl", () => {
|
||||
});
|
||||
|
||||
expect(url).toBe(
|
||||
"https://github.com/oven-sh/bun/releases/download/bun-v1.1.0/bun-linux-x64.zip",
|
||||
"https://github.com/oven-sh/bun/releases/download/bun-v1.4.0/bun-linux-x64.zip",
|
||||
);
|
||||
expect(requestSpy).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
@@ -111,7 +114,7 @@ describe("getDownloadUrl", () => {
|
||||
});
|
||||
|
||||
expect(url).toBe(
|
||||
"https://github.com/oven-sh/bun/releases/download/bun-v1.1.0/bun-linux-x64.zip",
|
||||
"https://github.com/oven-sh/bun/releases/download/bun-v1.4.0/bun-linux-x64.zip",
|
||||
);
|
||||
expect(requestSpy).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
@@ -141,6 +144,86 @@ describe("getDownloadUrl", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("Windows ARM64", () => {
|
||||
it("should use native aarch64 binary for Bun >= 1.3.10", async () => {
|
||||
const url = await getDownloadUrl({
|
||||
version: "1.3.10",
|
||||
os: "windows",
|
||||
arch: "arm64",
|
||||
});
|
||||
|
||||
expect(url).toBe(
|
||||
"https://github.com/oven-sh/bun/releases/download/bun-v1.3.10/bun-windows-aarch64.zip",
|
||||
);
|
||||
expect(requestSpy).toHaveBeenCalledTimes(0);
|
||||
});
|
||||
|
||||
it("should use native aarch64 binary for Bun 1.4.0", async () => {
|
||||
const url = await getDownloadUrl({
|
||||
version: "1.4.0",
|
||||
os: "windows",
|
||||
arch: "arm64",
|
||||
});
|
||||
|
||||
expect(url).toBe(
|
||||
"https://github.com/oven-sh/bun/releases/download/bun-v1.4.0/bun-windows-aarch64.zip",
|
||||
);
|
||||
expect(requestSpy).toHaveBeenCalledTimes(0);
|
||||
});
|
||||
|
||||
it("should fall back to x64-baseline for Bun < 1.3.10", async () => {
|
||||
const url = await getDownloadUrl({
|
||||
version: "1.1.0",
|
||||
os: "windows",
|
||||
arch: "arm64",
|
||||
});
|
||||
|
||||
expect(url).toBe(
|
||||
"https://github.com/oven-sh/bun/releases/download/bun-v1.1.0/bun-windows-x64-baseline.zip",
|
||||
);
|
||||
expect(requestSpy).toHaveBeenCalledTimes(0);
|
||||
});
|
||||
|
||||
it("should fall back to x64-baseline for Bun 1.3.9", async () => {
|
||||
const url = await getDownloadUrl({
|
||||
version: "1.3.9",
|
||||
os: "windows",
|
||||
arch: "arm64",
|
||||
});
|
||||
|
||||
expect(url).toBe(
|
||||
"https://github.com/oven-sh/bun/releases/download/bun-v1.3.9/bun-windows-x64-baseline.zip",
|
||||
);
|
||||
expect(requestSpy).toHaveBeenCalledTimes(0);
|
||||
});
|
||||
|
||||
it("should use native aarch64 for dynamic version resolving to >= 1.3.10", async () => {
|
||||
const url = await getDownloadUrl({
|
||||
version: "^1.3.0",
|
||||
os: "windows",
|
||||
arch: "arm64",
|
||||
});
|
||||
|
||||
expect(url).toBe(
|
||||
"https://github.com/oven-sh/bun/releases/download/bun-v1.4.0/bun-windows-aarch64.zip",
|
||||
);
|
||||
expect(requestSpy).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
it("should use native aarch64 for canary on Windows ARM64", async () => {
|
||||
const url = await getDownloadUrl({
|
||||
version: "canary",
|
||||
os: "windows",
|
||||
arch: "arm64",
|
||||
});
|
||||
|
||||
expect(url).toBe(
|
||||
"https://github.com/oven-sh/bun/releases/download/canary/bun-windows-aarch64.zip",
|
||||
);
|
||||
expect(requestSpy).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
});
|
||||
|
||||
describe("Token Handling", () => {
|
||||
it("should pass token to API request when resolving dynamic versions", async () => {
|
||||
await getDownloadUrl({
|
||||
|
||||
Reference in New Issue
Block a user