-
Notifications
You must be signed in to change notification settings - Fork 275
350 lines (282 loc) · 10.5 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
---
name: CI
on:
workflow_dispatch:
merge_group:
pull_request:
push:
branches:
- master
- develop
- v*
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
standard:
strategy:
fail-fast: false
matrix:
runs-on: [ubuntu-latest, windows-latest, macos-latest]
python:
- 3.8
- 3.9
- '3.10'
- '3.11'
- '3.12'
name: "Python ${{ matrix.python }} • ${{ matrix.runs-on }} • x64 ${{ matrix.args }}"
runs-on: ${{ matrix.runs-on }}
steps:
- uses: actions/checkout@v3
- name: Get history and tags for SCM versioning to work
if: ${{ !env.ACT }}
run: |
git fetch --prune --unshallow
git fetch --depth=1 origin +refs/tags/*:refs/tags/*
- name: Setup Python ${{ matrix.python }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
architecture: 'x64'
cache: 'pip'
cache-dependency-path: |
setup.cfg
pyproject.toml
- name: Prepare env
run: |
python -m pip install -U "setuptools>=61.0.0"
- name: Generate requirement file (Unix)
if: runner.os != 'Windows'
run: |
python setup.py gen_reqfile --include-extras=test,azure-quantum,braket,revkit
- name: Generate requirement file (Windows)
if: runner.os == 'Windows'
run: |
python setup.py gen_reqfile --include-extras=test,azure-quantum,braket
- name: Prepare env
run: |
python -m pip install -U pip setuptools wheel pybind11
cat requirements.txt
python -m pip install -r requirements.txt --prefer-binary
python -m pip install coveralls
- name: Setup annotations on Linux
if: runner.os == 'Linux'
run: python -m pip install pytest-github-actions-annotate-failures
- name: Build and install package (Unix)
if: runner.os != 'Windows'
run: python -m pip install -ve .[azure-quantum,braket,revkit,test]
- name: Build and install package (Windows)
if: runner.os == 'Windows'
run: python -m pip install -ve .[azure-quantum,braket,test]
- name: Pytest
run: |
echo 'backend: Agg' > matplotlibrc
python -m pytest -p no:warnings --cov=projectq
- name: Coveralls.io
run: coveralls --service=github
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_FLAG_NAME: python-${{ matrix.python }}-${{ matrix.runs-on }}-x64
COVERALLS_PARALLEL: true
finish:
needs: standard
runs-on: ubuntu-latest
container: python:3-slim
steps:
- name: Coveralls Finished
run: |
pip3 install --upgrade coveralls
coveralls --finish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
clang:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
clang:
- 11
- latest
env:
CC: clang
CXX: clang++
PROJECTQ_CLEANUP_COMPILER_FLAGS: ${{ (matrix.clang <= 10) && 1 || 0 }}
name: "Python 3 • Clang ${{ matrix.clang }} • x64"
container: "silkeh/clang:${{ matrix.clang }}"
steps:
- name: Install Git
run: |
apt-get update && apt-get install -y git --no-install-recommends
# Work-around for https://github.com/actions/runner-images/issues/6775
- name: Change Owner of Container Working Directory
run: chown root:root .
- uses: actions/checkout@v3
- name: Get history and tags for SCM versioning to work
if: ${{ !env.ACT }}
run: |
git fetch --prune --unshallow
git fetch --depth=1 origin +refs/tags/*:refs/tags/*
- name: Prepare env
run: >
apt-get update && apt-get install -y python3-dev python3-pip python3-setuptools python3-wheel
python3-numpy python3-scipy python3-matplotlib python3-requests python3-networkx
python3-pytest python3-pytest-cov python3-flaky python3-venv
--no-install-recommends
- name: Prepare Python env
run: |
python3 -m venv venv
./venv/bin/python3 -m pip install -U pip setuptools wheel
./venv/bin/python3 setup.py gen_reqfile --include-extras=test,azure-quantum,braket
cat requirements.txt
./venv/bin/python3 -m pip install -r requirements.txt --prefer-binary
- name: Upgrade pybind11 and flaky
run: ./venv/bin/python3 -m pip install --upgrade pybind11 flaky --prefer-binary
- name: Build and install package
run: ./venv/bin/python3 -m pip install -ve .[azure-quantum,braket,test]
- name: Pytest
run: |
echo 'backend: Agg' > matplotlibrc
./venv/bin/python3 -m pytest -p no:warnings
gcc:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
gcc:
- 9
- latest
name: "Python 3 • GCC ${{ matrix.gcc }} • x64"
container: "gcc:${{ matrix.gcc }}"
steps:
- uses: actions/checkout@v3
# Work-around for https://github.com/actions/runner-images/issues/6775
- name: Change Owner of Container Working Directory
run: chown root:root .
- name: Get history and tags for SCM versioning to work
if: ${{ !env.ACT }}
run: |
git fetch --prune --unshallow
git fetch --depth=1 origin +refs/tags/*:refs/tags/*
- name: Prepare env
run: >
apt-get update && apt-get install -y python3-dev python3-pip python3-setuptools python3-wheel
python3-numpy python3-scipy python3-matplotlib python3-requests python3-networkx
python3-pytest python3-pytest-cov python3-flaky python3-venv
--no-install-recommends
- name: Prepare Python env
run: |
python3 -m venv venv
./venv/bin/python3 -m pip install -U pip setuptools wheel
./venv/bin/python3 setup.py gen_reqfile --include-extras=test,azure-quantum,braket
cat requirements.txt
./venv/bin/python3 -m pip install -r requirements.txt --prefer-binary
- name: Upgrade pybind11 and flaky
run: ./venv/bin/python3 -m pip install --upgrade pybind11 flaky --prefer-binary
- name: Build and install package
run: ./venv/bin/python3 -m pip install -ve .[azure-quantum,braket,test]
- name: Pytest
run: |
echo 'backend: Agg' > matplotlibrc
./venv/bin/python3 -m pytest -p no:warnings
# Testing on CentOS (manylinux uses a centos base, and this is an easy way
# to get GCC 4.8, which is the manylinux1 compiler).
centos:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
centos:
- 7 # GCC 4.8
- 8
include:
- centos: 7
python_pkg: rh-python38-python-pip rh-python38-python-devel
enable_repo: --enablerepo=centos-sclo-rh
- centos: 8
python_pkg: python38-devel
name: "Python 3 • CentOS ${{ matrix.centos }} • x64"
container: "centos:${{ matrix.centos }}"
steps:
- name: Enable cache for yum
run: echo 'keepcache=1' >> /etc/yum.conf
- name: Setup yum cache
uses: actions/cache@v3
with:
path: |
/var/cache/yum/
/var/cache/dnf/
key: ${{ runner.os }}-centos${{ matrix.centos }}-yum-${{ secrets.yum_cache }}
- name: Fix repository URLs (CentOS 8 only)
if: matrix.centos == 8
run: |
sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*
- name: Update YUM/DNF
run: yum update -y
- name: Enable extra repositories && modify PATH (CentOS 7)
if: matrix.centos == 7
run: |
yum install -y centos-release-scl-rh
yum -y install https://packages.endpointdev.com/rhel/7/os/x86_64/endpoint-repo.x86_64.rpm
echo '/opt/rh/rh-python38/root/usr/bin' >> $GITHUB_PATH
- name: Add Python 3 and other dependencies
run: yum install -y ${{ matrix.enable_repo }} ${{ matrix.python_pkg }} gcc-c++ make
- name: Install Git > 2.18
run: |
yum install -y git
git config --global --add safe.directory /__w/ProjectQ/ProjectQ
# Work-around for https://github.com/actions/runner-images/issues/6775
- name: Change Owner of Container Working Directory
run: chown root:root .
- uses: actions/checkout@v3
- name: Get history and tags for SCM versioning to work
if: ${{ !env.ACT }}
run: |
git fetch --prune --unshallow
git fetch --depth=1 origin +refs/tags/*:refs/tags/*
- name: Create pip cache dir
run: mkdir -p ~/.cache/pip
- name: Cache wheels
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-centos${{ matrix.centos }}-pip-${{ hashFiles('**/setup.cfg', '**/pyproject.toml') }}
restore-keys: ${{ runner.os }}-centos-pip-
- name: Install dependencies
run: |
python3 -m pip install -U pip setuptools wheel
python3 setup.py gen_reqfile --include-extras=test,azure-quantum,braket
cat requirements.txt
python3 -m pip install -r requirements.txt --prefer-binary
- name: Build and install package
run: python3 -m pip install -ve .[azure-quantum,braket,test]
- name: Pytest
run: |
echo 'backend: Agg' > matplotlibrc
python3 -m pytest -p no:warnings
documentation:
name: "Documentation build test"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Get history and tags for SCM versioning to work
if: ${{ !env.ACT }}
run: |
git fetch --prune --unshallow
git fetch --depth=1 origin +refs/tags/*:refs/tags/*
- uses: actions/setup-python@v4
with:
python-version: '3.x'
architecture: 'x64'
cache: 'pip'
cache-dependency-path: |
setup.cfg
pyproject.toml
- name: Install docs & setup requirements
run: |
python3 -m pip install .[docs]
- name: Build docs
run: python3 -m sphinx -b html docs docs/.build
# NB: disabling until setup.py is updated to remove any mention of distutils
# - name: Make SDist
# run: python3 setup.py sdist