-
-
Notifications
You must be signed in to change notification settings - Fork 985
280 lines (276 loc) · 10.1 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
name: CI
on:
push:
branches: [dev, master]
pull_request:
branches: [dev, master]
env:
CXX: g++-9
CC: gcc-9
# See coveralls-python - Github Actions support:
# https://github.com/TheKevJames/coveralls-python/blob/master/docs/usage/configuration.rst#github-actions-support
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_SERVICE_NAME: github
jobs:
lint:
runs-on: ubuntu-20.04
strategy:
matrix:
python-version: [3.8]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip wheel 'setuptools!=58.5.*,<60'
pip install ruff black mypy nbstripout nbformat
- name: Lint
run: |
make lint
docs:
runs-on: ubuntu-20.04
needs: lint
strategy:
matrix:
python-version: [3.8]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install gcc-9 g++-9 ninja-build graphviz
python -m pip install --upgrade pip wheel 'setuptools!=58.5.*,<60'
# Keep track of pyro-api master branch
pip install https://github.com/pyro-ppl/pyro-api/archive/master.zip
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
pip install .[test]
pip install -r docs/requirements.txt
pip freeze
- name: Build docs and run doctest
run: |
make docs
make doctest
tutorials-html:
runs-on: ubuntu-20.04
needs: lint
strategy:
matrix:
python-version: [3.8]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install gcc-9 g++-9 ninja-build graphviz pandoc
python -m pip install --upgrade pip wheel 'setuptools!=58.5.*,<60'
# Keep track of pyro-api master branch
pip install https://github.com/pyro-ppl/pyro-api/archive/master.zip
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
pip install .[test]
pip install -r docs/requirements.txt
# requirements for tutorials (from .[dev])
sudo apt-get install pandoc
pip install nbformat
pip install nbsphinx>=0.3.2
pip install nbstripout
pip install pypandoc
pip install ninja
pip freeze
- name: Build HTML from tutorials
run: |
SPHINXOPTS="-E" make tutorial
unit:
runs-on: ubuntu-20.04
needs: docs
strategy:
matrix:
python-version: [3.8]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install gcc-9 g++-9 ninja-build
python -m pip install --upgrade pip wheel 'setuptools!=58.5.*,<60'
# Keep track of pyro-api master branch
pip install https://github.com/pyro-ppl/pyro-api/archive/master.zip
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
pip install .[test]
pip install --upgrade coveralls
pip freeze
- name: Run unit tests
run: |
pytest -vs --cov=pyro --cov-config .coveragerc --stage unit --durations 20
- name: Submit to coveralls
run: coveralls --service=github || true
env:
COVERALLS_PARALLEL: true
COVERALLS_FLAG_NAME: ${{ matrix.test-name }}
examples:
runs-on: ubuntu-20.04
needs: [docs, tutorials-html]
strategy:
matrix:
python-version: [3.8]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Setup Graphviz
uses: ts-graphviz/setup-graphviz@v1
- name: Install dependencies
run: |
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install gcc-9 g++-9 ninja-build
python -m pip install --upgrade pip wheel 'setuptools!=58.5.*,<60'
# Keep track of pyro-api master branch
pip install https://github.com/pyro-ppl/pyro-api/archive/master.zip
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
pip install .[test]
pip install --upgrade coveralls
pip freeze
- name: Run examples
run: |
CI=1 pytest -vs --cov=pyro --cov-config .coveragerc --stage test_examples --durations 10
grep -l smoke_test tutorial/source/*.ipynb | xargs grep -L 'smoke_test = False' \
| CI=1 xargs pytest -vx --nbval-lax --current-env
- name: Submit to coveralls
run: coveralls --service=github || true
env:
COVERALLS_PARALLEL: true
COVERALLS_FLAG_NAME: ${{ matrix.test-name }}
integration_1:
runs-on: ubuntu-20.04
needs: docs
strategy:
matrix:
python-version: [3.8]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install gcc-9 g++-9 ninja-build
python -m pip install --upgrade pip wheel 'setuptools!=58.5.*,<60'
# Keep track of pyro-api master branch
pip install https://github.com/pyro-ppl/pyro-api/archive/master.zip
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
pip install .[test]
pip install --upgrade coveralls
pip freeze
- name: Run integration test (batch 1)
run: |
pytest -vs --cov=pyro --cov-config .coveragerc --stage integration_batch_1 --durations 10
- name: Submit to coveralls
run: coveralls --service=github || true
env:
COVERALLS_PARALLEL: true
COVERALLS_FLAG_NAME: ${{ matrix.test-name }}
integration_2:
runs-on: ubuntu-20.04
needs: docs
strategy:
matrix:
python-version: [3.8]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install gcc-9 g++-9 ninja-build
python -m pip install --upgrade pip wheel 'setuptools!=58.5.*,<60'
# Keep track of pyro-api master branch
pip install https://github.com/pyro-ppl/pyro-api/archive/master.zip
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
pip install .[test]
pip install --upgrade coveralls
pip freeze
- name: Run integration test (batch 2)
run: |
pytest -vs --cov=pyro --cov-config .coveragerc --stage integration_batch_2 --durations 10
- name: Submit to coveralls
run: coveralls --service=github || true
env:
COVERALLS_PARALLEL: true
COVERALLS_FLAG_NAME: ${{ matrix.test-name }}
funsor:
runs-on: ubuntu-20.04
needs: docs
strategy:
matrix:
python-version: [3.8]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install gcc-9 g++-9 ninja-build
python -m pip install --upgrade pip wheel 'setuptools!=58.5.*,<60'
# Keep track of pyro-api master branch
pip install https://github.com/pyro-ppl/pyro-api/archive/master.zip
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
pip install .[test]
pip install -e .[funsor]
pip install --upgrade coveralls
pip freeze
- name: Run funsor tests
run: |
pytest -vs --cov=pyro --cov-config .coveragerc --stage funsor --durations 10
CI=1 pytest -vs --cov=pyro --cov-config .coveragerc --stage test_examples --durations 10 -k funsor
- name: Submit to coveralls
run: coveralls --service=github || true
env:
COVERALLS_PARALLEL: true
COVERALLS_FLAG_NAME: ${{ matrix.test-name }}
finish:
needs: [unit, examples, integration_1, integration_2, funsor]
runs-on: ubuntu-20.04
strategy:
matrix:
python-version: [3.8]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Coveralls Finished
run: |
pip install --upgrade coveralls
coveralls --service=github --finish || true