Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ jobs:
ubuntu-24.04,
ubuntu-24.04-arm,
macos-26,
macos-26-intel,
windows-2025,
windows-11-arm,
]
Expand Down Expand Up @@ -123,7 +122,6 @@ jobs:
ubuntu-24.04,
ubuntu-24.04-arm,
macos-26,
macos-26-intel,
windows-2025,
windows-11-arm,
]
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ releases may include breaking changes.

### Removed

- 🍎 Drop support for x86 macOS ([#257]) ([**@denialhaag**])
- 🔥 Remove Windows Debug support, including the `debug` action input and
PowerShell `-use_debug` switch ([#256], [#258]) ([**@denialhaag**])

Expand Down Expand Up @@ -148,6 +149,7 @@ _This is the initial release of the `setup-mlir` project._
<!-- PR links -->

[#258]: https://github.com/munich-quantum-software/setup-mlir/pull/258
[#257]: https://github.com/munich-quantum-software/setup-mlir/pull/257
[#256]: https://github.com/munich-quantum-software/setup-mlir/pull/256
[#230]: https://github.com/munich-quantum-software/setup-mlir/pull/230
[#229]: https://github.com/munich-quantum-software/setup-mlir/pull/229
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

This repository provides an action for setting up MLIR in GitHub Actions and
installation scripts for setting up MLIR locally. Only Release builds are
supported.
supported. macOS requires Apple silicon (`arm64`).

The MLIR binaries are built and distributed in the
[`portable-mlir-toolchain`](https://github.com/munich-quantum-software/portable-mlir-toolchain/)
Expand Down
60 changes: 11 additions & 49 deletions __tests__/integration.test.ts
Comment thread
denialhaag marked this conversation as resolved.
Original file line number Diff line number Diff line change
Expand Up @@ -100,26 +100,6 @@ describe("setup-mlir Integration Tests", () => {
}, 30000); // 30-second timeout for cleanup

describe("Version Validation", () => {
it("should validate version tag format", () => {
const isVersionTag = RegExp("^\\d+\\.\\d+\\.\\d+$").test(testVersion);
expect(isVersionTag).toBe(true);
});

it("should validate commit hash format", () => {
const isCommitHash = RegExp("^[0-9a-f]{7,40}$", "i").test(
testVersionCommit,
);
expect(isCommitHash).toBe(true);
});

it("should reject invalid version format", () => {
const invalidVersion = "invalid-version-123";
const isVersionTag = RegExp("^\\d+\\.\\d+\\.\\d+$").test(invalidVersion);
const isCommitHash = RegExp("^[0-9a-f]{7,40}$", "i").test(invalidVersion);
expect(isVersionTag).toBe(false);
expect(isCommitHash).toBe(false);
});

it("should reject non-existent version", async () => {
const { getMLIRUrl } = await import("../src/utils/download.js");

Expand All @@ -128,32 +108,6 @@ describe("setup-mlir Integration Tests", () => {
});

describe("Platform and Architecture Detection", () => {
it("should detect current platform", () => {
const expectedPlatform =
process.platform === "linux"
? "linux"
: process.platform === "darwin"
? "macOS"
: process.platform === "win32"
? "windows"
: null;

expect(expectedPlatform).not.toBeNull();
});

it("should detect current architecture", () => {
let expectedArch = "";
if (process.platform === "linux") {
expectedArch = process.arch === "x64" ? "x86_64" : "aarch64";
} else if (process.platform === "darwin") {
expectedArch = process.arch === "x64" ? "x86_64" : "arm64";
} else {
expectedArch = process.arch === "x64" ? "x86_64" : "aarch64";
}

expect(expectedArch).not.toBeNull();
});

it("should handle explicit platform specification", async () => {
const { getMLIRUrl } = await import("../src/utils/download.js");

Expand All @@ -174,9 +128,9 @@ describe("setup-mlir Integration Tests", () => {
? "macOS"
: "windows";

const asset = await getMLIRUrl(testVersion, platform, "X86");
const asset = await getMLIRUrl(testVersion, platform, "AArch64");
expect(asset.url).toBeTruthy();
expect(asset.name).toContain("x86_64");
expect(asset.name).toContain(platform === "macOS" ? "arm64" : "aarch64");
});
});

Expand Down Expand Up @@ -446,7 +400,7 @@ describe("setup-mlir Integration Tests", () => {
expect(zstdAsset.name).toMatch(/^zstd-.*\.(tar\.gz|zip)$/);
});

it("should use latest release also when requested release doesn't have zstd binaries", async () => {
it("should resolve zstd for a commit-based LLVM version", async () => {
const { getZstdUrl } = await import("../src/utils/download.js");

const zstdAsset = await getZstdUrl(testVersionCommit, "host", "host");
Expand Down Expand Up @@ -567,6 +521,14 @@ describe("setup-mlir Integration Tests", () => {
);
});

it("should require AArch64 for macOS", async () => {
const { getMLIRUrl } = await import("../src/utils/download.js");

await expect(getMLIRUrl(testVersion, "macOS", "X86")).rejects.toThrow(
"macOS requires AArch64 architecture.",
);
});

it("should reject invalid architecture", async () => {
const { getMLIRUrl } = await import("../src/utils/download.js");

Expand Down
4 changes: 3 additions & 1 deletion __tests__/update-known-versions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,9 @@ describe("Update Known Versions", () => {
expect(["linux", "macos", "windows"]).toContain(entry.platform);

// Verify architecture is valid
expect(["x86", "aarch64"]).toContain(entry.architecture);
expect(
entry.platform === "macos" ? ["aarch64"] : ["x86", "aarch64"],
).toContain(entry.architecture);

// Verify download URL is from the correct repository
expect(entry.download_url).toContain(
Expand Down
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ inputs:
required: false
default: "host"
architecture:
description: "The architecture to install the MLIR toolchain for (either X86, AArch64, or host). Defaults to host."
description: "The architecture to install the MLIR toolchain for (either X86, AArch64, or host). macOS requires AArch64. Defaults to host."
required: false
default: "host"

Expand Down
3 changes: 3 additions & 0 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -35087,6 +35087,9 @@ async function getManifestEntry(version, platform, architecture, forceRemote = f
version = version.toLowerCase();
platform = getPlatform(platform);
architecture = getArchitecture(architecture);
if (platform === "macos" && architecture !== "aarch64") {
throw new Error("macOS requires AArch64 architecture.");
}
const manifest = await loadManifest(forceRemote);
const entries = manifest.filter((entry) => entry.version.startsWith(version) &&
entry.platform === platform &&
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

20 changes: 4 additions & 16 deletions dist/update-known-versions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -36054,7 +36054,6 @@ async function getReleases(octokit) {
function populateZstdInfo(info, asset) {
const match_linux_x86 = asset.name.match(/zstd-(.+?)_x86_64-unknown-linux-gnu\.tar\.gz/);
const match_linux_aarch64 = asset.name.match(/zstd-(.+?)_aarch64-unknown-linux-gnu\.tar\.gz/);
const match_macos_x86 = asset.name.match(/zstd-(.+?)_x86_64-apple-darwin\.tar\.gz/);
const match_macos_aarch64 = asset.name.match(/zstd-(.+?)_arm64-apple-darwin\.tar\.gz/);
const match_windows_x86 = asset.name.match(/zstd-(.+?)_x86_64-pc-windows-msvc\.tar\.gz/);
const match_windows_aarch64 = asset.name.match(/zstd-(.+?)_aarch64-pc-windows-msvc\.tar\.gz/);
Expand All @@ -36069,10 +36068,6 @@ function populateZstdInfo(info, asset) {
assetNameKey = `asset_name_linux_aarch64`;
downloadUrlKey = `download_url_linux_aarch64`;
}
else if (match_macos_x86) {
assetNameKey = `asset_name_macos_x86`;
downloadUrlKey = `download_url_macos_x86`;
}
else if (match_macos_aarch64) {
assetNameKey = `asset_name_macos_aarch64`;
downloadUrlKey = `download_url_macos_aarch64`;
Expand Down Expand Up @@ -36126,7 +36121,6 @@ function getVersionFromAssetName(assetName) {
function populateManifest(manifest, asset, release, zstdInfo) {
const match_linux_x86 = asset.name.match(/llvm-mlir_(.+?)_x86_64-unknown-linux-gnu\.tar\.zst/i);
const match_linux_aarch64 = asset.name.match(/llvm-mlir_(.+?)_aarch64-unknown-linux-gnu\.tar\.zst/i);
const match_macos_x86 = asset.name.match(/llvm-mlir_(.+?)_x86_64-apple-darwin\.tar\.zst/i);
const match_macos_aarch64 = asset.name.match(/llvm-mlir_(.+?)_arm64-apple-darwin\.tar\.zst/i);
const match_windows_x86 = asset.name.match(/llvm-mlir_(.+?)_x86_64-pc-windows-msvc\.tar\.zst/i);
const match_windows_aarch64 = asset.name.match(/llvm-mlir_(.+?)_aarch64-pc-windows-msvc\.tar\.zst/i);
Expand All @@ -36147,12 +36141,6 @@ function populateManifest(manifest, asset, release, zstdInfo) {
zstdAssetNameKey = "asset_name_linux_aarch64";
zstdDownloadUrlKey = "download_url_linux_aarch64";
}
else if (match_macos_x86) {
architecture = "x86";
platform = "macos";
zstdAssetNameKey = "asset_name_macos_x86";
zstdDownloadUrlKey = "download_url_macos_x86";
}
else if (match_macos_aarch64) {
architecture = "aarch64";
platform = "macos";
Expand Down Expand Up @@ -36255,16 +36243,16 @@ async function updateManifest() {
const manifest = [];
const zstdInfo = {};
for (const release of releases) {
const assets = release.assets.filter((asset) => !/(?:x86_64-apple-darwin|macos_.*_x86)\.|_debug/i.test(asset.name));
let version = undefined;
for (const asset of release.assets) {
for (const asset of assets) {
if (asset.name.startsWith("zstd-")) {
populateZstdInfo(zstdInfo, asset);
}
}
for (const asset of release.assets) {
for (const asset of assets) {
if (asset.name.startsWith("llvm-mlir_") &&
asset.name.endsWith(".tar.zst") &&
!asset.name.includes("_debug")) {
asset.name.endsWith(".tar.zst")) {
try {
version = getVersionFromAssetName(asset.name);
if (versions.has(version)) {
Expand Down
2 changes: 1 addition & 1 deletion dist/update-known-versions/index.js.map

Large diffs are not rendered by default.

Loading
Loading