Skip to content

Commit 3072a73

Browse files
committed
fix: address CI review feedback
1 parent 68e88d3 commit 3072a73

File tree

5 files changed

+31
-13
lines changed

5 files changed

+31
-13
lines changed

.github/actions/setup-llvm/action.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,11 @@ runs:
5757
llvm_root="${{ runner.temp }}/llvm"
5858
echo "LLVM_PATH=${llvm_root}" >>"$GITHUB_ENV"
5959
echo "${{ inputs.llvm-sys-prefix-env-var }}=${llvm_root}" >>"$GITHUB_ENV"
60-
echo "LD_LIBRARY_PATH=${llvm_root}/lib:${LD_LIBRARY_PATH:-}" >>"$GITHUB_ENV"
60+
if [ -n "${LD_LIBRARY_PATH:-}" ]; then
61+
echo "LD_LIBRARY_PATH=${llvm_root}/lib:${LD_LIBRARY_PATH}" >>"$GITHUB_ENV"
62+
else
63+
echo "LD_LIBRARY_PATH=${llvm_root}/lib" >>"$GITHUB_ENV"
64+
fi
6165
6266
- name: Install LLVM (macOS)
6367
if: runner.os == 'macOS' && inputs.enable-macos == 'true'

.github/workflows/rust-release.yml

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,24 @@ on:
66
- 'v*.*.*'
77
workflow_dispatch:
88

9+
env:
10+
LLVM_VERSION: "21.1.8"
11+
LLVM_SYS_PREFIX_ENV_VAR: "LLVM_SYS_211_PREFIX"
12+
913
jobs:
1014
publish:
1115
runs-on: ubuntu-latest
1216
steps:
1317
- uses: actions/checkout@v6
1418

15-
- name: Install LLVM
16-
uses: KyleMayes/install-llvm-action@v2
19+
- name: Setup LLVM
20+
uses: ./.github/actions/setup-llvm
1721
with:
18-
version: "14.0"
19-
directory: ${{ runner.temp }}/llvm
20-
env: true
21-
22-
- name: Configure LLVM
23-
run: echo "LLVM_SYS_140_PREFIX=$LLVM_PATH" >> "$GITHUB_ENV"
22+
llvm-version: ${{ env.LLVM_VERSION }}
23+
llvm-sys-prefix-env-var: ${{ env.LLVM_SYS_PREFIX_ENV_VAR }}
24+
enable-macos: "false"
25+
enable-windows: "false"
26+
linux-cache-key-suffix: rust-release-v1
2427

2528
- uses: dtolnay/rust-toolchain@stable
2629

examples/python_api.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
# ///
1212
"""Example demonstrating the qir_qis Python API."""
1313

14+
import sys
1415
from pathlib import Path
1516

1617
from rich import print as rprint
@@ -32,10 +33,17 @@
3233
rprint(f"Entry point attributes: {attributes}")
3334

3435
# Compile to QIS
36+
if sys.platform.startswith("win"):
37+
opt_level = 0
38+
target = "native"
39+
else:
40+
opt_level = 2
41+
target = "aarch64"
42+
3543
qis_bytes = qir_to_qis(
3644
bc_bytes,
37-
opt_level=2,
38-
target="aarch64",
45+
opt_level=opt_level,
46+
target=target,
3947
)
4048

4149
# Write output

examples/rust_api.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,11 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
1616
println!("Required qubits: {attributes:#?}");
1717

1818
// Compile to QIS
19-
let qis_bytes = qir_to_qis(&bc_bytes, 2, "aarch64", None)?;
19+
#[cfg(windows)]
20+
let (opt_level, target) = (0, "native");
21+
#[cfg(not(windows))]
22+
let (opt_level, target) = (2, "aarch64");
23+
let qis_bytes = qir_to_qis(&bc_bytes, opt_level, target, None)?;
2024

2125
// Write output
2226
fs::write("output.qis.bc", qis_bytes)?;

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,6 @@ LLVM_SYS_211_PREFIX = '/tmp/llvm'
9494
MACOSX_DEPLOYMENT_TARGET = "15.0"
9595
[tool.cibuildwheel.macos]
9696
before-all = [
97-
'curl -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal',
9897
'brew install llvm@21',
9998
'if [ "$(uname -m)" = "arm64" ]; then LLVM_PREFIX=/opt/homebrew/opt/llvm@21; else LLVM_PREFIX=/usr/local/opt/llvm@21; fi',
10099
'mkdir -p /tmp/llvm',

0 commit comments

Comments
 (0)