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: 1 addition & 1 deletion .github/release-drafter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ categories:
- "github-actions"
- "pre-commit"
- "submodules"
change-template: "- $TITLE ([#$NUMBER]($URL)) ([**@$AUTHOR**](https://github.com/$AUTHOR))"
change-template: "- $TITLE ([#$NUMBER]($URL)) (**@$AUTHOR**)"
change-title-escapes: '\<*_&'
version-resolver:
major:
Expand Down
13 changes: 12 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@ This project adheres to [Semantic Versioning], with the exception that minor rel

## [Unreleased]

## [1.4.0] - 2026-06-10

### Added

- ✨ Add fallback for loading version manifest from remote URL ([#191]) ([**@denialhaag**])
- ✨ Add support for new LLVM versions ([#189], [#190])

## [1.3.1] - 2026-05-18

### Added
Expand Down Expand Up @@ -82,7 +89,8 @@ _This is the initial release of the `setup-mlir` project._

<!-- Version links -->

[unreleased]: https://github.com/munich-quantum-software/setup-mlir/compare/v1.3.1...HEAD
[unreleased]: https://github.com/munich-quantum-software/setup-mlir/compare/v1.4.0...HEAD
[1.4.0]: https://github.com/munich-quantum-software/setup-mlir/releases/tag/v1.4.0
[1.3.1]: https://github.com/munich-quantum-software/setup-mlir/releases/tag/v1.3.1
[1.3.0]: https://github.com/munich-quantum-software/setup-mlir/releases/tag/v1.3.0
[1.2.1]: https://github.com/munich-quantum-software/setup-mlir/releases/tag/v1.2.1
Expand All @@ -93,6 +101,9 @@ _This is the initial release of the `setup-mlir` project._

<!-- PR links -->

[#191]: https://github.com/munich-quantum-software/setup-mlir/pull/191
[#190]: https://github.com/munich-quantum-software/setup-mlir/pull/190
[#189]: https://github.com/munich-quantum-software/setup-mlir/pull/189
[#177]: https://github.com/munich-quantum-software/setup-mlir/pull/177
[#174]: https://github.com/munich-quantum-software/setup-mlir/pull/174
[#171]: https://github.com/munich-quantum-software/setup-mlir/pull/171
Expand Down
4 changes: 2 additions & 2 deletions __tests__/integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ describe("setup-mlir Integration Tests", () => {
await io.rmRF(cachedPath);
}
cachedPath = undefined;
}, 30000); // 30-second time-out for cleanup
}, 30000); // 30-second timeout for cleanup

describe("Version Validation", () => {
it("should validate version tag format", () => {
Expand Down Expand Up @@ -449,7 +449,7 @@ describe("setup-mlir Integration Tests", () => {

cachedPath = cachedDir;
}
}, 900000); // 15-minute time-out
}, 900000); // 15-minute timeout

it("should reject debug flag on non-Windows platforms", async () => {
if (process.platform === "win32") {
Expand Down
2 changes: 1 addition & 1 deletion __tests__/update-known-versions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,5 +148,5 @@ describe("Update Known Versions", () => {
"github.com/munich-quantum-software/portable-mlir-toolchain/releases/download",
);
}
}, 600000); // 10 minute timeout
}, 600000); // 10-minute timeout
});
49 changes: 33 additions & 16 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -34734,52 +34734,69 @@ function determineArchitecture() {




/**
* Get the manifest entry for the specified arguments
* @param version The requested LLVM version
* @param platform The platform
* @param architecture The architecture
* @param debug Whether to get a debug build
* @param forceRemote Whether to force loading the manifest from the remote URL
* @returns The manifest entry
*/
async function getManifestEntries(version, platform, architecture, debug) {
async function getManifestEntries(version, platform, architecture, debug, forceRemote = false) {
// Normalize inputs
version = version.toLowerCase();
platform = getPlatform(platform);
architecture = getArchitecture(architecture);
const manifest = await loadManifest();
const manifest = await loadManifest(forceRemote);
const entries = manifest.filter((entry) => entry.version.startsWith(version) &&
entry.platform === platform &&
entry.architecture === architecture &&
entry.debug === debug);
if (entries.length === 0 && !forceRemote) {
core_debug(`No local manifest entries found for LLVM ${version}. Retrying with remote manifest.`);
return await getManifestEntries(version, platform, architecture, debug, true);
}
if (entries.length === 0) {
throw new Error(`No ${architecture} ${platform}${debug ? " (debug)" : ""} archive found for LLVM ${version}.`);
}
return entries;
}
/**
* Load the manifest from the local file system or remote URL
* Load the manifest from the remote URL.
* @returns The manifest entries
*/
async function loadManifest() {
async function loadManifestFromRemote() {
const actionRepo = process.env.GITHUB_ACTION_REPOSITORY ??
"munich-quantum-software/setup-mlir";
const actionRef = process.env.GITHUB_ACTION_REF ?? "main";
const manifestUrl = `https://raw.githubusercontent.com/${actionRepo}/${actionRef}/version-manifest.json`;
const response = await fetch(manifestUrl, {
redirect: "follow",
signal: AbortSignal.timeout(30000), // 30-second timeout
});
if (!response.ok) {
throw new Error(`Failed to fetch version manifest from ${manifestUrl}: ${response.status} ${response.statusText}`);
}
return (await response.json());
}
/**
* Load the manifest. The manifest is loaded from file if possible, but falls back to the remote URL if the file is not found.
* @param forceRemote Whether to force loading the manifest from the remote URL
* @returns The manifest entries
*/
async function loadManifest(forceRemote = false) {
if (forceRemote) {
return await loadManifestFromRemote();
}
try {
const fileContent = await external_node_fs_namespaceObject.promises.readFile(MANIFEST_FILE, "utf-8");
return JSON.parse(fileContent);
}
catch (error) {
if (error instanceof Error && "code" in error && error.code === "ENOENT") {
const actionRepo = process.env.GITHUB_ACTION_REPOSITORY ??
"munich-quantum-software/setup-mlir";
const actionRef = process.env.GITHUB_ACTION_REF ?? "main";
const manifestUrl = `https://raw.githubusercontent.com/${actionRepo}/${actionRef}/version-manifest.json`;
const response = await fetch(manifestUrl, {
redirect: "follow",
signal: AbortSignal.timeout(30000), // 30 second timeout
});
if (!response.ok) {
throw new Error(`Failed to fetch version manifest from ${manifestUrl}: ${response.status} ${response.statusText}`);
}
return (await response.json());
return await loadManifestFromRemote();
}
throw error;
}
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

75 changes: 54 additions & 21 deletions src/utils/download.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@
*/

import { promises as fs } from "node:fs";
import { ManifestEntry } from "./manifest.js";
import { MANIFEST_FILE } from "./constants.js";

import * as core from "@actions/core";

import { MANIFEST_FILE } from "./constants.js";
import { ManifestEntry } from "./manifest.js";
import { getPlatform, getArchitecture } from "./platform.js";

/**
Expand All @@ -27,20 +29,22 @@ import { getPlatform, getArchitecture } from "./platform.js";
* @param platform The platform
* @param architecture The architecture
* @param debug Whether to get a debug build
* @param forceRemote Whether to force loading the manifest from the remote URL
* @returns The manifest entry
*/
async function getManifestEntries(
version: string,
platform: string,
architecture: string,
debug: boolean,
forceRemote: boolean = false,
): Promise<ManifestEntry[]> {
// Normalize inputs
version = version.toLowerCase();
platform = getPlatform(platform);
architecture = getArchitecture(architecture);

const manifest = await loadManifest();
const manifest = await loadManifest(forceRemote);

const entries = manifest.filter(
(entry) =>
Expand All @@ -50,40 +54,69 @@ async function getManifestEntries(
entry.debug === debug,
);

if (entries.length === 0 && !forceRemote) {
core.debug(
`No local manifest entries found for LLVM ${version}. Retrying with remote manifest.`,
);
return await getManifestEntries(
version,
platform,
architecture,
debug,
true,
);
}
Comment thread
coderabbitai[bot] marked this conversation as resolved.

if (entries.length === 0) {
throw new Error(
`No ${architecture} ${platform}${debug ? " (debug)" : ""} archive found for LLVM ${version}.`,
);
}

return entries;
}

/**
* Load the manifest from the local file system or remote URL
* Load the manifest from the remote URL.
* @returns The manifest entries
*/
async function loadManifest(): Promise<ManifestEntry[]> {
async function loadManifestFromRemote(): Promise<ManifestEntry[]> {
const actionRepo =
process.env.GITHUB_ACTION_REPOSITORY ??
"munich-quantum-software/setup-mlir";
const actionRef = process.env.GITHUB_ACTION_REF ?? "main";
const manifestUrl = `https://raw.githubusercontent.com/${actionRepo}/${actionRef}/version-manifest.json`;
Comment thread
coderabbitai[bot] marked this conversation as resolved.

const response = await fetch(manifestUrl, {
redirect: "follow",
signal: AbortSignal.timeout(30000), // 30-second timeout
});
if (!response.ok) {
throw new Error(
`Failed to fetch version manifest from ${manifestUrl}: ${response.status} ${response.statusText}`,
);
}
return (await response.json()) as ManifestEntry[];
Comment thread
denialhaag marked this conversation as resolved.
}

/**
* Load the manifest. The manifest is loaded from file if possible, but falls back to the remote URL if the file is not found.
* @param forceRemote Whether to force loading the manifest from the remote URL
* @returns The manifest entries
*/
async function loadManifest(
forceRemote: boolean = false,
): Promise<ManifestEntry[]> {
if (forceRemote) {
return await loadManifestFromRemote();
}

try {
const fileContent = await fs.readFile(MANIFEST_FILE, "utf-8");
return JSON.parse(fileContent) as ManifestEntry[];
} catch (error) {
if (error instanceof Error && "code" in error && error.code === "ENOENT") {
const actionRepo =
process.env.GITHUB_ACTION_REPOSITORY ??
"munich-quantum-software/setup-mlir";
const actionRef = process.env.GITHUB_ACTION_REF ?? "main";
const manifestUrl = `https://raw.githubusercontent.com/${actionRepo}/${actionRef}/version-manifest.json`;

const response = await fetch(manifestUrl, {
redirect: "follow",
signal: AbortSignal.timeout(30000), // 30 second timeout
});
if (!response.ok) {
throw new Error(
`Failed to fetch version manifest from ${manifestUrl}: ${response.status} ${response.statusText}`,
);
}
return (await response.json()) as ManifestEntry[];
return await loadManifestFromRemote();
}
throw error;
}
Expand Down
Loading