-
Notifications
You must be signed in to change notification settings - Fork 2
191 lines (187 loc) · 6.52 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
# 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: cp310-manylinux_x86_64},
{os: ubuntu-latest, dist: cp311-manylinux_x86_64},
{os: ubuntu-latest, dist: cp312-manylinux_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: cp310-macosx_arm64, macosarch: arm64},
{os: macos-latest, dist: cp311-macosx_arm64, macosarch: arm64},
{os: macos-latest, dist: cp312-macosx_arm64, macosarch: arm64},
# Currently disabled because in CI it gives "DLL load failed" errors I don't understand when testing the wheel.
# {os: windows-latest, dist: cp310-win_amd64},
# {os: windows-latest, dist: cp311-win_amd64},
# {os: windows-latest, dist: cp312-win_amd64},
]
env:
MACOSX_DEPLOYMENT_TARGET: "10.15"
CIBW_BUILD: "${{ matrix.os_dist.dist }}"
CIBW_ARCHS_MACOS: "${{ matrix.os_dist.macosarch }}"
CIBW_TEST_REQUIRES: pytest stim sinter pygltflib
CIBW_TEST_COMMAND: pytest {project}/src
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- run: python tools/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
- run: python -m cibuildwheel --print-build-identifiers
- run: python -m cibuildwheel --output-dir output/chromobius
- run: python setup.py sdist
- run: mv dist/* output/chromobius
- uses: actions/upload-artifact@v3
with:
name: dist
path: |
./output/chromobius/*
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
- run: python setup.py sdist
- run: pip install dist/*.tar.gz
run_main:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- run: cmake .
- run: make chromobius -j 2
- run: out/chromobius --help
build_bazel:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: bazelbuild/setup-bazelisk@v1
- run: bazel build :all
- run: bazel test :chromobius_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 . --target chromobius chromobius_test chromobius_perf
- run: out/chromobius --help
perf:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- run: cmake .
- run: make chromobius_perf -j 2
- run: out/chromobius_perf
test:
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 .
- run: make chromobius_test -j 2
- run: out/chromobius_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 chromobius_test_o3 -j 2
- run: out/chromobius_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
- run: bazel build :chromobius_dev_wheel
- run: pip install bazel-bin/chromobius-0.0.dev0-py3-none-any.whl
- run: diff <(python tools/gen_chromobius_api_reference.py -dev) doc/chromobius_api_reference.md
- run: diff <(python tools/gen_chromobius_stub_file.py -dev) doc/chromobius.pyi
- run: python doc/chromobius.pyi
test_generated_file_lists_are_fresh:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: tools/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 :chromobius_dev_wheel
- run: pip install bazel-bin/chromobius-0.0.dev0-py3-none-any.whl
- run: pip install pytest stim sinter pygltflib
- run: pytest src
- run: tools/doctest_proper.py --module chromobius
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/
password: ${{ secrets.pypi_token_chromobius }}