Add a handler for managing PyroSample plate contexts #1295
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |