-
Notifications
You must be signed in to change notification settings - Fork 32
267 lines (238 loc) · 8.7 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
name: ci
on:
workflow_dispatch:
pull_request:
push:
branches:
- master
jobs:
build_sdist:
name: Build SDist
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Build SDist
run: pipx run build --sdist
- name: Check metadata
run: pipx run twine check dist/*
- uses: actions/upload-artifact@v3
with:
path: dist/*.tar.gz
build_wheels:
runs-on: ${{ matrix.os_dist.os }}
env:
MACOSX_DEPLOYMENT_TARGET: "10.15"
CIBW_BUILD: "${{ matrix.os_dist.dist }}"
CIBW_ARCHS_MACOS: "x86_64 universal2 arm64"
CIBW_BEFORE_BUILD: pip install --upgrade ninja
CIBW_TEST_REQUIRES: pytest stim
CIBW_TEST_COMMAND: pytest {project}/tests
strategy:
fail-fast: false
matrix:
os_dist: [
# macosx x86_64
# {os: macos-latest, dist: cp36-macosx_x86_64},
{os: macos-latest, dist: cp37-macosx_x86_64},
{os: macos-latest, dist: cp38-macosx_x86_64},
{os: macos-latest, dist: cp39-macosx_x86_64},
{os: macos-latest, dist: cp310-macosx_x86_64},
{os: macos-latest, dist: cp311-macosx_x86_64},
{os: macos-latest, dist: cp312-macosx_x86_64},
# macosx arm64
{os: macos-latest, dist: cp38-macosx_arm64},
{os: macos-latest, dist: cp39-macosx_arm64},
{os: macos-latest, dist: cp310-macosx_arm64},
{os: macos-latest, dist: cp311-macosx_arm64},
{os: macos-latest, dist: cp312-macosx_arm64},
# macosx universal2
# {os: macos-latest, dist: cp38-macosx_universal2},
# {os: macos-latest, dist: cp39-macosx_universal2},
# {os: macos-latest, dist: cp310-macosx_universal2},
# {os: macos-latest, dist: cp311-macosx_universal2},
# {os: macos-latest, dist: cp312-macosx_universal2},
# windows amd64
# {os: windows-latest, dist: cp36-win_amd64},
{os: windows-latest, dist: cp37-win_amd64},
{os: windows-latest, dist: cp38-win_amd64},
{os: windows-latest, dist: cp39-win_amd64},
{os: windows-latest, dist: cp310-win_amd64},
{os: windows-latest, dist: cp311-win_amd64},
{os: windows-latest, dist: cp312-win_amd64},
# windows win32
# {os: windows-latest, dist: cp36-win32},
{os: windows-latest, dist: cp37-win32},
# scipy install fails
# {os: windows-latest, dist: cp38-win32},
# {os: windows-latest, dist: cp39-win32},
# {os: windows-latest, dist: cp310-win32},
# {os: windows-latest, dist: cp311-win32},
# For arm64, get error "cibuildwheel: No build identifiers selected"
# {os: windows-latest, dist: cp39-win_arm64},
# {os: windows-latest, dist: cp310-win_arm64},
# {os: windows-latest, dist: cp311-win_arm64},
# ubuntu x86_64
# {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},
# ubuntu i686
# {os: ubuntu-latest, dist: cp36-manylinux_i686},
{os: ubuntu-latest, dist: cp37-manylinux_i686},
# scipy built distribution not available and build fails on manylinux_i686 for python 3.8 up
# {os: ubuntu-latest, dist: cp38-manylinux_i686},
# {os: ubuntu-latest, dist: cp39-manylinux_i686},
# {os: ubuntu-latest, dist: cp310-manylinux_i686},
# {os: ubuntu-latest, dist: cp311-manylinux_i686},
# Don't include musllinux as it has g++-9 (need g++-10 for <bits>)
# {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: cp311-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: ubuntu-latest, dist: cp311-musllinux_i686},
]
steps:
- uses: actions/checkout@v3
with:
submodules: true
- uses: actions/setup-python@v4
- name: Install g++
if: runner.os == 'Linux'
run: |
sudo apt update
sudo apt install gcc-10 g++-10
- uses: pypa/cibuildwheel@v2.16.5
- name: Verify clean directory
run: git diff --exit-code
shell: bash
- name: Upload wheels
uses: actions/upload-artifact@v3
with:
path: wheelhouse/*.whl
benchmark_windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
with:
submodules: true
- run: cmake .
- run: cmake --build . --target pymatching_perf --config Release
- run: Release\pymatching_perf.exe
benchmark:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-latest, ubuntu-latest]
steps:
- uses: actions/checkout@v3
with:
submodules: true
- run: CC=gcc-10 CXX=g++-10 cmake .
if: matrix.os == 'ubuntu-latest'
- run: cmake .
if: matrix.os == 'macos-latest'
- run: make pymatching_perf
- run: ./pymatching_perf
gtest:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-latest, ubuntu-latest]
steps:
- uses: actions/checkout@v3
with:
submodules: true
- run: CC=gcc-10 CXX=g++-10 cmake .
if: matrix.os == 'ubuntu-latest'
- run: cmake .
if: matrix.os == 'macos-latest'
- run: make pymatching_tests
- run: ./pymatching_tests
pip_install:
strategy:
fail-fast: false
matrix:
platform: [windows-latest, macos-latest, ubuntu-latest]
python-version: ["3.11"]
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v3
with:
submodules: true
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Add requirements
run: python -m pip install --upgrade cmake>=3.12 ninja pytest flake8 pytest-cov setuptools
- name: Build and install
run: python -m pip install --verbose -e .
- name: Test without stim or rustworkx
run: python -m pytest tests
- name: Install stim and rustworkx
run: python -m pip install stim rustworkx
- name: Test with stim and rustworkx using coverage
run: python -m pytest tests --cov=./src/pymatching --cov-report term
- name: flake8
run: flake8 ./src ./tests
build_docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: true
- uses: actions/setup-python@v4
- name: Install pandoc
run: |
sudo apt install pandoc
python -m pip install pandoc
- name: Add sphinx requirements
run: python -m pip install -r ./docs/sphinx_docs/requirements.txt
- name: Build and install PyMatching
run: pip install --verbose .
- name: Build docs
run: cd docs/sphinx_docs && make html
codecov:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: true
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Add requirements
run: python -m pip install --upgrade cmake>=3.12 ninja pytest flake8 pytest-cov stim rustworkx
- name: Build and install
run: pip install --verbose -e .
- name: Run tests and collect coverage
run: pytest tests --cov=./src/pymatching --cov-report=xml
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
# upload_pypi:
# needs: [build_wheels, build_sdist]
# runs-on: ubuntu-latest
# environment: pypi
# permissions:
# id-token: write
# if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
# steps:
# - uses: actions/download-artifact@v3
# with:
# # unpacks all CIBW artifacts into dist/
# pattern: cibw-*
# path: dist
# - uses: pypa/gh-action-pypi-publish@release/v1