-
Notifications
You must be signed in to change notification settings - Fork 116
409 lines (399 loc) · 16 KB
/
ci.yml
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
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: ci
on:
push:
branches:
- main
tags:
- v*
pull_request:
branches:
- main
jobs:
build_dist:
runs-on: ${{ matrix.os_dist.os }}
strategy:
fail-fast: false
matrix:
os_dist: [
{os: ubuntu-latest, dist: cp36-manylinux_x86_64},
{os: ubuntu-latest, dist: cp37-manylinux_x86_64},
{os: ubuntu-latest, dist: cp38-manylinux_x86_64},
{os: ubuntu-latest, dist: cp39-manylinux_x86_64},
{os: ubuntu-latest, dist: cp310-manylinux_x86_64},
{os: ubuntu-latest, dist: cp311-manylinux_x86_64},
{os: ubuntu-latest, dist: cp312-manylinux_x86_64},
{os: ubuntu-latest, dist: cp36-manylinux_i686},
{os: ubuntu-latest, dist: cp37-manylinux_i686},
# cp38-manylinux_i686 disabled because pandas isn't prebuilt and takes 20 minutes to build.
# {os: ubuntu-latest, dist: cp38-manylinux_i686},
# cp39-manylinux_i686 disabled because pandas isn't prebuilt and takes 20 minutes to build.
# {os: ubuntu-latest, dist: cp39-manylinux_i686},
# cp310-manylinux_i686 disabled because scipy isn't prebuilt and fails to build.
#
# The actual error seen in github actions:
#
# numpy.distutils.system_info.NotFoundError: No BLAS/LAPACK
# libraries found. To build Scipy from sources, BLAS & LAPACK
# libraries need to be installed.
#
#{os: ubuntu-latest, dist: cp310-manylinux_i686},
# pypy manylinux builds disabled because scipy isn't prebuilt and fails to build.
#
# The actual error seen in github actions:
#
# numpy.distutils.system_info.NotFoundError: No BLAS/LAPACK
# libraries found. To build Scipy from sources, BLAS & LAPACK
# libraries need to be installed.
#
# {os: ubuntu-latest, dist: pp37-manylinux_x86_64},
# {os: ubuntu-latest, dist: pp38-manylinux_x86_64},
# {os: ubuntu-latest, dist: pp39-manylinux_x86_64},
# {os: ubuntu-latest, dist: pp37-manylinux_i686},
# {os: ubuntu-latest, dist: pp38-manylinux_i686},
# {os: ubuntu-latest, dist: pp39-manylinux_i686},
# musllinux builds disabled because scipy isn't prebuilt and fails to build.
#
# The actual error seen in github actions:
#
# numpy.distutils.system_info.NotFoundError: No BLAS/LAPACK
# libraries found. To build Scipy from sources, BLAS & LAPACK
# libraries need to be installed.
#
# {os: ubuntu-latest, dist: cp36-musllinux_x86_64},
# {os: ubuntu-latest, dist: cp37-musllinux_x86_64},
# {os: ubuntu-latest, dist: cp38-musllinux_x86_64},
# {os: ubuntu-latest, dist: cp39-musllinux_x86_64},
# {os: ubuntu-latest, dist: cp310-musllinux_x86_64},
# {os: ubuntu-latest, dist: cp36-musllinux_i686},
# {os: ubuntu-latest, dist: cp37-musllinux_i686},
# {os: ubuntu-latest, dist: cp38-musllinux_i686},
# {os: ubuntu-latest, dist: cp39-musllinux_i686},
# {os: ubuntu-latest, dist: cp310-musllinux_i686},
{os: macos-latest, dist: cp36-macosx_x86_64, macosarch: x86_64},
{os: macos-latest, dist: cp37-macosx_x86_64, macosarch: x86_64},
{os: macos-latest, dist: cp38-macosx_x86_64, macosarch: x86_64},
{os: macos-latest, dist: cp39-macosx_x86_64, macosarch: x86_64},
{os: macos-latest, dist: cp310-macosx_x86_64, macosarch: x86_64},
{os: macos-latest, dist: cp311-macosx_x86_64, macosarch: x86_64},
{os: macos-latest, dist: cp312-macosx_x86_64, macosarch: x86_64},
{os: macos-latest, dist: cp38-macosx_arm64, macosarch: arm64},
{os: macos-latest, dist: cp39-macosx_arm64, macosarch: arm64},
{os: macos-latest, dist: cp310-macosx_arm64, macosarch: arm64},
{os: macos-latest, dist: cp311-macosx_arm64, macosarch: arm64},
{os: macos-latest, dist: cp312-macosx_arm64, macosarch: arm64},
# pypy OSX builds disabled because numpy isn't prebuilt and fails to build.
#
# The actual error seen in github actions:
#
# RuntimeError: Found /usr/lib/libcblas.dylib, but that file is a
# symbolic link to the MacOS Accelerate framework, which is not
# supported by NumPy. You must configure the build to use a
# different optimized library, or disable the use of optimized
# BLAS and LAPACK by setting the environment variables
# NPY_BLAS_ORDER="" and NPY_LAPACK_ORDER="" before building NumPy.
#
# {os: macOS-10.15, dist: pp37-macosx_x86_64},
# {os: macOS-10.15, dist: pp38-macosx_x86_64},
# {os: macOS-10.15, dist: pp39-macosx_x86_64},
{os: windows-2019, dist: cp36-win_amd64},
{os: windows-2019, dist: cp37-win_amd64},
{os: windows-2019, dist: cp38-win_amd64},
{os: windows-2019, dist: cp39-win_amd64},
{os: windows-2019, dist: cp310-win_amd64},
{os: windows-2019, dist: cp311-win_amd64},
{os: windows-2019, dist: cp312-win_amd64},
{os: windows-2019, dist: cp36-win32},
{os: windows-2019, dist: cp37-win32},
# cp38-win32 and cp39-win32 disabled because scipy fails to build.
#
# The actual error seen in github actions:
#
# Need python for 64-bit, but found 32-bit
# ..\..\meson.build:82:0: ERROR: Python dependency not found
#
#{os: windows-2019, dist: cp38-win32},
#{os: windows-2019, dist: cp39-win32},
# cp310-win32 disabled because numpy isn't prebuilt and fails to build.
#
# The actual error seen in github actions:
#
# CCompiler_spawn() got an unexpected keyword argument 'env'
#
# {os: windows-2019, dist: cp310-win32},
]
env:
CIBW_BUILD: "${{ matrix.os_dist.dist }}"
CIBW_ARCHS_MACOS: "${{ matrix.os_dist.macosarch }}"
CIBW_TEST_REQUIRES: cirq-core pytest
CIBW_TEST_COMMAND: pytest {project}/src {project}/glue/cirq && stim help
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- run: python dev/overwrite_dev_versions_with_date.py
- run: mkdir -p output/stim
- run: mkdir -p output/stimcirq
- run: mkdir -p output/sinter
- run: python -m pip install pybind11~=2.11.1 cibuildwheel~=2.16.2 setuptools wheel
- run: python -m cibuildwheel --print-build-identifiers
- run: python -m cibuildwheel --output-dir output/stim
- run: python setup.py sdist
- run: cd glue/cirq && python setup.py sdist
- run: cd glue/sample && python setup.py sdist
- run: mv dist/* output/stim
- run: mv glue/cirq/dist/* output/stimcirq
- run: mv glue/sample/dist/* output/sinter
- uses: actions/upload-artifact@v3
with:
name: dist
path: |
./output/stimcirq/*.tar.gz
./output/sinter/*.tar.gz
./output/stim/*
check_sdist_installs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- run: python -m pip install pybind11~=2.11.1 cibuildwheel~=2.16.2 setuptools wheel
- run: python setup.py sdist
- run: pip install dist/*.tar.gz
upload_dev_release_to_pypi:
needs: ["build_dist"]
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v2
with:
name: dist
path: dist
- uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
packages_dir: dist/stim/
password: ${{ secrets.pypi_token_stim }}
- uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
packages_dir: dist/stimcirq/
password: ${{ secrets.pypi_token_stimcirq }}
- uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
packages_dir: dist/sinter/
password: ${{ secrets.pypi_token_sinter }}
run_main:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- run: cmake .
- run: make stim -j 2
- run: echo -e "H 0 \n CNOT 0 1 \n M 0 1" | out/stim --sample
build_bazel:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: bazelbuild/setup-bazelisk@v1
- run: bazel build :all
- run: bazel test :stim_test
build_clang:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v1
- run: |
cd ..
git clone https://github.com/google/googletest.git -b release-1.12.1
mkdir googletest/build && cd googletest/build
cmake .. -DBUILD_GMOCK=OFF
make
sudo make install
- uses: egor-tensin/setup-clang@v1
with:
version: latest
platform: x64
- run: cmake . -DCMAKE_C_COMPILER=cc -DCMAKE_CXX_COMPILER=c++
- run: cmake --build .
build_lib:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- run: cmake .
- run: make libstim -j 2
- run: echo -e '#include "stim.h"\nint main(int argc,const char **argv) {return !stim::find_bool_argument("test", argc, argv);}' > test.cc
- run: g++ -std=c++20 test.cc out/libstim.a -I src
- run: ./a.out test
build_lib_install:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- run: mkdir install_dir
- run: cmake . -DCMAKE_INSTALL_PREFIX=install_dir
- run: make -j 2
- run: make install
- run: echo -e '#include "stim.h"\nint main(int argc,const char **argv) {return !stim::find_bool_argument("test", argc, argv);}' > test.cc
- run: g++ -std=c++20 test.cc install_dir/lib/libstim.a -I install_dir/include
- run: ./a.out test
- run: echo -e "H 0 \n CNOT 0 1 \n M 0 1" | install_dir/bin/stim --sample
benchmark_windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v1
- uses: microsoft/[email protected]
- run: cmake .
- run: MSBuild.exe stim_perf.vcxproj /p:Configuration=Release /p:OutDir=msbuild_out /p:O=2
- run: msbuild_out/stim_perf.exe
benchmark:
runs-on: ubuntu-latest
strategy:
matrix:
simd_width: [64, 128, 256]
steps:
- uses: actions/checkout@v1
- run: cmake . -DSIMD_WIDTH=${{ matrix.simd_width }}
- run: make stim_perf -j 2
- run: out/stim_perf
test:
runs-on: ubuntu-latest
strategy:
matrix:
simd_width: [64, 128, 256]
steps:
- uses: actions/checkout@v1
- run: |
cd ..
git clone https://github.com/google/googletest.git -b release-1.12.1
mkdir googletest/build && cd googletest/build
cmake .. -DBUILD_GMOCK=OFF
make
sudo make install
- run: cmake . -DSIMD_WIDTH=${{ matrix.simd_width }}
- run: make stim_test -j 2
- run: out/stim_test
test_o3:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- run: |
cd ..
git clone https://github.com/google/googletest.git -b release-1.12.1
mkdir googletest/build && cd googletest/build
cmake .. -DBUILD_GMOCK=OFF
make
sudo make install
- run: cmake . -DSIMD_WIDTH=256
- run: make stim_test_o3 -j 2
- run: out/stim_test_o3
test_generated_docs_are_fresh:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- uses: bazelbuild/setup-bazelisk@v1
- uses: actions/setup-node@v1
with:
node-version: 16.x
- run: bazel build :stim_dev_wheel
- run: pip install bazel-bin/stim-0.0.dev0-py3-none-any.whl
- run: diff <(python dev/gen_stim_api_reference.py -dev) doc/python_api_reference_vDev.md
- run: diff <(python dev/gen_stim_stub_file.py -dev) glue/python/src/stim/__init__.pyi
- run: diff <(python dev/gen_stim_stub_file.py -dev) doc/stim.pyi
- run: diff <(python -c "import stim; stim.main(command_line_args=['help', 'gates_markdown'])") doc/gates.md
- run: diff <(python -c "import stim; stim.main(command_line_args=['help', 'formats_markdown'])") doc/result_formats.md
- run: diff <(python -c "import stim; stim.main(command_line_args=['help', 'commands_markdown'])") doc/usage_command_line.md
- run: diff <(dev/gen_known_gates_for_js.sh) glue/crumble/test/generated_gate_name_list.test.js
- run: python doc/stim.pyi
- run: npm install -g [email protected] [email protected]
- run: diff <(dev/regen_crumble_to_cpp_string_write_to_stdout.sh) src/stim/diagram/crumble_data.cc
- run: pip install -e glue/sample
- run: diff <(python dev/gen_sinter_api_reference.py -dev) doc/sinter_api.md
test_generated_file_lists_are_fresh:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: dev/regen_file_lists.sh /tmp
- run: diff /tmp/perf_files file_lists/perf_files
- run: diff /tmp/pybind_files file_lists/pybind_files
- run: diff /tmp/source_files_no_main file_lists/source_files_no_main
- run: diff /tmp/test_files file_lists/test_files
test_pybind:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- uses: bazelbuild/setup-bazelisk@v1
- run: bazel build :stim_dev_wheel
- run: pip install bazel-bin/stim-0.0.dev0-py3-none-any.whl
- run: pip install pytest
- run: pytest src
- run: dev/doctest_proper.py --module stim
test_stimcirq:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- uses: bazelbuild/setup-bazelisk@v1
- run: bazel build :stim_dev_wheel
- run: pip install bazel-bin/stim-0.0.dev0-py3-none-any.whl
- run: pip install -e glue/cirq
- run: pip install pytest
- run: pytest glue/cirq
- run: dev/doctest_proper.py --module stimcirq --import cirq sympy
test_sinter:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- uses: bazelbuild/setup-bazelisk@v1
- run: bazel build :stim_dev_wheel
- run: pip install bazel-bin/stim-0.0.dev0-py3-none-any.whl
- run: pip install -e glue/sample
- run: pip install pytest pymatching fusion-blossom~=0.1.4
- run: pytest glue/sample
- run: dev/doctest_proper.py --module sinter
- run: sinter help
test_stimzx:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- uses: bazelbuild/setup-bazelisk@v1
- run: bazel build :stim_dev_wheel
- run: pip install bazel-bin/stim-0.0.dev0-py3-none-any.whl
- run: pip install -e glue/zx
- run: pip install pytest
- run: pytest glue/zx
- run: dev/doctest_proper.py --module stimzx
test_stimjs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: mymindstorm/setup-emsdk@v14
with:
version: 2.0.18
actions-cache-folder: 'emsdk-cache'
- uses: actions/setup-node@v1
with:
node-version: 16.x
- run: npm install
- run: bash glue/javascript/build_wasm.sh
- run: node puppeteer_run_tests.js
test_crumble:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
- run: node glue/crumble/run_tests_headless.js