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
197 changes: 197 additions & 0 deletions .github/workflows/build-qiskit-aer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,197 @@
# SPDX-FileCopyrightText: 2026 The RISE Project
# SPDX-License-Identifier: MIT
---
# This workflow is based on: https://github.com/Qiskit/qiskit-aer/blob/0.17.2/.github/workflows/deploy.yml
# (wheel-build job) and pyproject.toml's [tool.cibuildwheel] table.
name: Build qiskit-aer wheels (riscv64)

on:
workflow_dispatch:
inputs:
version:
description: 'Version glob to (re)build; empty builds every version of docs/packages/qiskit-aer.yaml not released yet'
required: false
default: ''
pull_request:
branches: [main]
paths:
- '.github/workflows/build-qiskit-aer.yml'
- 'docs/packages/qiskit-aer.yaml'
push:
branches: [main]
paths:
- '.github/workflows/build-qiskit-aer.yml'
- 'docs/packages/qiskit-aer.yaml'

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

permissions:
contents: read # to fetch code (actions/checkout)

env:
MANYLINUX_RISCV64_IMAGE: quay.io/pypa/manylinux_2_39_riscv64

jobs:
setup:
uses: $/.github/workflows/_setup.yml
with:
package: qiskit-aer
version: ${{ inputs.version }}

build_wheels:
needs: [setup]
if: needs.setup.outputs.versions != '[]'
name: Build qiskit-aer ${{ matrix.version }} ${{ matrix.python }}-manylinux_riscv64
runs-on: ubuntu-24.04-riscv
timeout-minutes: 720
strategy:
fail-fast: false
matrix:
version: ${{ fromJSON(needs.setup.outputs.versions) }}
# cp314t is dropped: qiskit (a hard runtime and test-time dependency,
# imported by tools/verify_wheels.py) is published on our registry as
# a single cp310-abi3 wheel, which is not installable on a
# free-threaded interpreter.
python:
- "cp312"
- "cp313"
- "cp314"

env:
QISKIT_AER_VERSION: ${{ matrix.version }}

steps:
- name: Checkout qiskit-aer ${{ env.QISKIT_AER_VERSION }}
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: Qiskit/qiskit-aer
ref: ${{ env.QISKIT_AER_VERSION }}
persist-credentials: false

- name: Build wheels
uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0
with:
output-dir: wheelhouse/
only: ${{ matrix.python }}-manylinux_riscv64
env:
CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }}
# Replaces upstream's manylinux2014/yum before-all (pyproject.toml
# [tool.cibuildwheel.linux]); also stages OpenBLAS' licence, which
# auditwheel bundles the library without.
CIBW_BEFORE_ALL_LINUX: >-
dnf -y install openblas-devel &&
cp /usr/share/licenses/openblas/LICENSE {project}/LICENSE.openblas
CIBW_ENVIRONMENT: >-
PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/
PIP_ONLY_BINARY=numpy,scipy,qiskit,rustworkx
# cmake/dependency_utils.cmake's setup_conan() runs Conan 1.x
# (conan<2.0.0, pinned by pyproject.toml) to build fmt/8.0.1 from
# source. Conan 1.x's settings.yml has no riscv64 arch entry, and
# its autodetection matches "riscv64" on the generic `"64" in
# machine` fallback and misreports arch=x86_64, so its
# CMakeToolchain then adds an x86-only -m64 flag. Seed a
# riscv64-aware settings.yml and default profile before Conan
# runs so it never autodetects. settings.yml validates arch,
# arch_build and arch_target as three SEPARATE enum lists (not
# one shared list), so all three need the same riscv64 addition -
# our profile only sets arch/arch_build, but arch_target is
# patched too for anyone who later adds a cross-compile profile.
CIBW_BEFORE_BUILD: |
set -ex
pip install -q 'conan<2.0.0'
conan config init
conan_home=$(conan config home)
sed -i \
-e 's/^arch_build: \[x86, x86_64,/arch_build: [x86, x86_64, riscv64,/' \
-e 's/^arch_target: \[x86, x86_64,/arch_target: [x86, x86_64, riscv64,/' \
-e 's/^arch: \[x86, x86_64,/arch: [x86, x86_64, riscv64,/' \
"$conan_home/settings.yml"
grep -q '^arch_build: \[x86, x86_64, riscv64,' "$conan_home/settings.yml"
grep -q '^arch_target: \[x86, x86_64, riscv64,' "$conan_home/settings.yml"
grep -q '^arch: \[x86, x86_64, riscv64,' "$conan_home/settings.yml"
mkdir -p "$conan_home/profiles"
cat > "$conan_home/profiles/default" <<'PROFILE'
[settings]
os=Linux
os_build=Linux
arch=riscv64
arch_build=riscv64
build_type=Release
[options]
[build_requires]
[env]
PROFILE

- name: Check the wheel ships the extension and all licences
run: |
python3 - wheelhouse/*.whl <<'EOF'
import sys, zipfile
for whl in sys.argv[1:]:
names = zipfile.ZipFile(whl).namelist()
assert any(n.startswith("qiskit_aer/backends/controller_wrappers")
and n.endswith(".so") for n in names), whl
licences = {n.rsplit("/", 1)[1]
for n in names if ".dist-info/licenses/" in n} - {""}
assert licences == {"LICENSE.txt", "LICENSE.openblas"}, (whl, licences)
print(whl, "ok")
EOF

- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: qiskit-aer-${{ env.QISKIT_AER_VERSION }}-${{ matrix.python }}-manylinux_riscv64
path: wheelhouse/*.whl
if-no-files-found: error

gpl_sources:
needs: [setup]
if: needs.setup.outputs.versions != '[]'
strategy:
fail-fast: false
matrix:
version: ${{ fromJSON(needs.setup.outputs.versions) }}
name: Collect GPL sources
runs-on: ubuntu-24.04-riscv

env:
QISKIT_AER_VERSION: ${{ matrix.version }}

steps:
- name: Checkout python-wheels
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

# OpenBLAS is compiled with gfortran, so auditwheel vendors the image's
# libgfortran into qiskit_aer.libs/.
- uses: ./actions/collect-gpl-sources
with:
image: ${{ env.MANYLINUX_RISCV64_IMAGE }}
packages: gcc
output: gpl-sources.tar

- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: qiskit-aer-${{ env.QISKIT_AER_VERSION }}-gpl-sources
path: gpl-sources.tar
if-no-files-found: error

publish:
name: Publish qiskit-aer ${{ matrix.version }}
needs: [setup, build_wheels, gpl_sources]
if: needs.setup.outputs.versions != '[]'
strategy:
fail-fast: false
matrix:
version: ${{ fromJSON(needs.setup.outputs.versions) }}
permissions:
contents: write
pull-requests: write
uses: $/.github/workflows/_publish-wheel.yml
secrets:
app-private-key: ${{ secrets.RISEPROJECT_APP_PRIVATE_KEY }}
with:
artifact-pattern: qiskit-aer-${{ matrix.version }}-*-manylinux_riscv64
gpl-sources-artifact: qiskit-aer-${{ matrix.version }}-gpl-sources
gpl-sources-description: gcc
5 changes: 5 additions & 0 deletions docs/packages/qiskit-aer.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package-name: qiskit-aer
source-code: https://github.com/Qiskit/qiskit-aer
license: Apache-2.0
versions:
- version: 0.17.2
Loading