-
Notifications
You must be signed in to change notification settings - Fork 1
211 lines (184 loc) · 6.22 KB
/
Copy pathbuild.yml
File metadata and controls
211 lines (184 loc) · 6.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
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