Skip to content

Build

Build #23

Workflow file for this run

name: Build
on:
workflow_dispatch:
inputs:
py_doc_deps:
type: string
required: true
default: build==1.4.2 setuptools==82.0.1 sphinx==9.1.0 sphinx-multiversion==0.2.4 sphinx-rtd-theme==3.1.0 sphinx-inline-tabs==2025.12.21.14 sphinx-c-autodoc==1.6.0 clang==18.1.8
py_cibw_deps:
type: string
required: true
default: cibuildwheel==3.4.0
rust_version:
type: string
required: true
default: 'stable'
jobs:
rust:
name: Rust ${{ matrix.toolchain }} tests
strategy:
matrix:
toolchain: ['1.82.0', stable, nightly]
runs-on: ubuntu-24.04
steps:
- name: Install Rust
run: |
rustup set profile minimal
rustup update ${{ matrix.toolchain }}
rustup default ${{ matrix.toolchain }}
- uses: actions/checkout@v4
- name: Build crate
run: cargo package
- name: Upload crate
if: ${{ matrix.toolchain == 'stable' }}
uses: actions/upload-artifact@v4
with:
name: rust-crate
path: target/package/*.crate
- name: Build documentation
run: cargo doc --no-deps
- name: Upload documentation
if: ${{ matrix.toolchain == 'stable' }}
uses: actions/upload-artifact@v4
with:
name: rust-doc
path: target/doc
- name: Run unit tests
run: cargo test --verbose
rust_wasm:
name: Rust WebAssembly library
runs-on: ubuntu-24.04
steps:
- name: Install Rust
run: |
rustup set profile minimal
rustup update ${{ inputs.rust_version }}
rustup default ${{ inputs.rust_version }}
rustup target add wasm32-wasip1
- uses: actions/checkout@v4
- name: Build WebAssembly library
run: cargo rustc --crate-type=staticlib --target=wasm32-wasip1 --release --no-default-features --features=capi
- name: Upload WebAssembly library
uses: actions/upload-artifact@v4
with:
name: wasm
path: target/wasm32-wasip1/release/libqblaze.a
python_sdist:
name: Python sdist and documentation
runs-on: ubuntu-24.04
steps:
- name: Install Rust
run: |
rustup set profile minimal
rustup update ${{ inputs.rust_version }}
rustup default ${{ inputs.rust_version }}
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: '3.13'
- name: Install libclang
run: |
sudo apt-get update
sudo apt-get -y install libclang-18-dev
- run: pip install ${{ inputs.py_doc_deps }}
- uses: actions/checkout@v4
- name: Build sdist
run: python -Pm build -s
- name: Upload sdist
uses: actions/upload-artifact@v4
with:
name: python-sdist
path: dist/*.tar.gz
- name: Build documentation
run: make -C doc
env:
QBLAZE_SPHINX_AUTODOC_CLANG_LIBDIR: '/usr/lib/llvm-18/lib'
- name: Upload documentation
uses: actions/upload-artifact@v4
with:
name: doc
path: doc/_build/html/
python_wheels:
name: Python wheels on ${{ matrix.os }}
needs: python_sdist
strategy:
matrix:
os: [ubuntu-24.04, ubuntu-24.04-arm, windows-2025, windows-11-arm, macos-26-intel, macos-26]
runs-on: ${{ matrix.os }}
steps:
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: '3.13'
- run: pip install ${{ inputs.py_cibw_deps }}
- uses: actions/checkout@v4
- name: Download sdist
uses: actions/download-artifact@v4
with:
name: python-sdist
path: src
- name: Build wheels
run: cibuildwheel --output-dir=dist src/*.tar.gz
shell: bash
env:
# the action runner doesn't have Podman installed
CIBW_CONTAINER_ENGINE: "docker; disable_host_mount: true"
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: python-wheels-${{ matrix.os }}
path: dist/*.whl
python_test:
name: Run Python ${{ matrix.python }} tests on ${{ matrix.os }}
needs: python_wheels
strategy:
matrix:
os: [ubuntu-24.04, ubuntu-24.04-arm, windows-2025, windows-11-arm, macos-26-intel, macos-26]
python: ['3.11', '3.12', '3.13', '3.14', '3.14t']
runs-on: ${{ matrix.os }}
steps:
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- uses: actions/checkout@v4
- name: Download wheels
uses: actions/download-artifact@v4
with:
name: python-wheels-${{ matrix.os }}
path: dist
- name: Prepare environment
run: |
pip install --constraint=tests/pip-constraints.txt --only-binary=numpy pytest numpy
pip install --only-binary=qblaze --no-index --find-links=dist qblaze
- name: Run tests
run: pytest --ignore tests/test_qiskit.py --ignore python/qblaze/qiskit.py
qiskit_test:
name: Run Qiskit ${{ matrix.qiskit }} tests on ${{ matrix.os }}
needs: python_wheels
strategy:
matrix:
os: [ubuntu-24.04, ubuntu-24.04-arm, windows-2025, macos-26-intel, macos-26]
# Qiskit and Qiskit Aer binaries are not available for Windows on ARM
# Qiskit Aer binaries for manylinux on ARM are not available for Python 3.14.
python: ['3.11', '3.13']
qiskit: ['1.4.5', '2.3.1']
runs-on: ${{ matrix.os }}
steps:
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- uses: actions/checkout@v4
- name: Download wheels
uses: actions/download-artifact@v4
with:
name: python-wheels-${{ matrix.os }}
path: dist
- name: Prepare environment
run: |
pip install --constraint=tests/pip-constraints.txt --only-binary=numpy,scipy,qiskit,qiskit-aer pytest numpy qiskit==${{ matrix.qiskit }} qiskit-aer==0.17.2
pip install --only-binary=qblaze --no-index --find-links=dist qblaze
- name: Run tests
run: pytest
- name: Run random circuits
run: python tests/rand-circuit.py 20