Skip to content

Commit

Permalink
Test on oldest supported versions during end-to-end CI (#4374)
Browse files Browse the repository at this point in the history
* test on oldest supported versions during end-to-end CI

* less strict pin

* try 1.15 pin

* try pinning pandas and scipy too

* only test betabinom if scipy modern enough

* revert sort_conda changes (will do in separate PR)

* generate requirements-dev from py37 env
  • Loading branch information
MarcoGorelli authored Jan 5, 2021
1 parent aabec02 commit 34b05d8
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 24 deletions.
2 changes: 1 addition & 1 deletion .codecov.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
codecov:
require_ci_to_pass: no
notify:
after_n_builds: 9
after_n_builds: 16

coverage:
precision: 2
Expand Down
13 changes: 7 additions & 6 deletions .github/workflows/arviz_compat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ jobs:
os: [ubuntu-latest, macos-latest]
floatx: [float64]
test-subset:
- pymc3/tests/test_distributions.py
- pymc3/tests/test_distributions_random.py
- pymc3/tests/test_sampling.py
fail-fast: false
Expand All @@ -27,12 +28,12 @@ jobs:
- name: Cache conda
uses: actions/cache@v1
env:
# Increase this value to reset cache if environment-dev-py38.yml has not changed
# Increase this value to reset cache if environment-dev-py39.yml has not changed
CACHE_NUMBER: 0
with:
path: ~/conda_pkgs_dir
key: ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{
hashFiles('conda-envs/environment-dev-py38.yml') }}
hashFiles('conda-envs/environment-dev-py39.yml') }}
- name: Cache multiple paths
uses: actions/cache@v2
env:
Expand All @@ -47,18 +48,18 @@ jobs:
hashFiles('requirements.txt') }}
- uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: pymc3-dev-py38
activate-environment: pymc3-dev-py39
channel-priority: strict
environment-file: conda-envs/environment-dev-py38.yml
environment-file: conda-envs/environment-dev-py39.yml
use-only-tar-bz2: true # IMPORTANT: This needs to be set for caching to work properly!
- name: Install pymc3
run: |
conda activate pymc3-dev-py38
conda activate pymc3-dev-py39
pip install -e .
python --version
- name: Install latest arviz
run: |
conda activate pymc3-dev-py38
conda activate pymc3-dev-py39
pip uninstall arviz -y
pip install git+git://github.com/arviz-devs/arviz.git
- name: Run tests
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,12 @@ jobs:
- name: Cache conda
uses: actions/cache@v1
env:
# Increase this value to reset cache if environment-dev-py39.yml has not changed
# Increase this value to reset cache if environment-dev-py37.yml has not changed
CACHE_NUMBER: 0
with:
path: ~/conda_pkgs_dir
key: ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{
hashFiles('conda-envs/environment-dev-py39.yml') }}
hashFiles('conda-envs/environment-dev-py37.yml') }}
- name: Cache multiple paths
uses: actions/cache@v2
env:
Expand All @@ -90,18 +90,18 @@ jobs:
hashFiles('requirements.txt') }}
- uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: pymc3-dev-py39
activate-environment: pymc3-dev-py37
channel-priority: strict
environment-file: conda-envs/environment-dev-py39.yml
environment-file: conda-envs/environment-dev-py37.yml
use-only-tar-bz2: true # IMPORTANT: This needs to be set for caching to work properly!
- name: Install-pymc3
run: |
conda activate pymc3-dev-py39
conda activate pymc3-dev-py37
pip install -e .
python --version
- name: Run tests
run: |
conda activate pymc3-dev-py39
conda activate pymc3-dev-py37
python -m pytest -vv --cov=pymc3 --cov-report=xml --cov-report term --durations=50 $TEST_SUBSET
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ jobs:
- name: Cache conda
uses: actions/cache@v1
env:
# Increase this value to reset cache if conda-envs/environment-dev-py37.yml has not changed
# Increase this value to reset cache if conda-envs/environment-dev-py38.yml has not changed
CACHE_NUMBER: 0
with:
path: ~/conda_pkgs_dir
key: ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{
hashFiles('conda-envs/environment-dev-py37.yml') }}
hashFiles('conda-envs/environment-dev-py38.yml') }}
- name: Cache multiple paths
uses: actions/cache@v2
env:
Expand All @@ -46,15 +46,15 @@ jobs:
hashFiles('requirements.txt') }}
- uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: pymc3-dev-py37
activate-environment: pymc3-dev-py38
channel-priority: strict
environment-file: conda-envs/environment-dev-py37.yml
environment-file: conda-envs/environment-dev-py38.yml
use-only-tar-bz2: true # IMPORTANT: This needs to be set for caching to work properly!
- name: Install-pymc3
run: |
conda activate pymc3-dev-py37
conda activate pymc3-dev-py38
pip install -e .
python --version
- run: |
conda activate pymc3-dev-py37
conda activate pymc3-dev-py38
python -m pytest -vv --cov=pymc3 --cov-report=xml --cov-report term --durations=50 $TEST_SUBSET
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ repos:
- id: conda-env-sort
additional_dependencies: [pyyaml]
entry: python scripts/sort_conda_envs.py
files: ^conda-envs/
files: ^conda-envs/environment-dev-py37\.yml$
language: python
name: Sort dependencies in conda envs
types: [yaml]
Expand Down
3 changes: 3 additions & 0 deletions conda-envs/environment-dev-py37.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,16 @@ dependencies:
- libblas=*=*mkl
- mkl-service
- nbsphinx>=0.4
- numpy=1.15
- numpydoc>=0.9
- pandas=0.24
- pre-commit>=2.8.0
- pytest-cov>=2.5
- pytest>=3.0
- python-graphviz
- python=3.7
- recommonmark>=0.4
- scipy=1.2
- sphinx-autobuild>=0.7
- sphinx>=1.5
- watermark
7 changes: 7 additions & 0 deletions pymc3/tests/test_distributions.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@

from numpy import array, exp, inf, log
from numpy.testing import assert_allclose, assert_almost_equal, assert_equal
from packaging.version import parse
from scipy import __version__ as scipy_version
from scipy import integrate
from scipy.special import erf, logit

Expand Down Expand Up @@ -97,6 +99,8 @@
from pymc3.theanof import floatX
from pymc3.vartypes import continuous_types

SCIPY_VERSION = parse(scipy_version)


def get_lkj_cases():
"""
Expand Down Expand Up @@ -1163,6 +1167,9 @@ def test_binomial(self):

# Too lazy to propagate decimal parameter through the whole chain of deps
@pytest.mark.xfail(condition=(theano.config.floatX == "float32"), reason="Fails on float32")
@pytest.mark.xfail(
condition=(SCIPY_VERSION < parse("1.4.0")), reason="betabinom is new in Scipy 1.4.0"
)
def test_beta_binomial(self):
self.checkd(
BetaBinomial,
Expand Down
6 changes: 3 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
arviz>=0.9.0
dill
fastprogress>=0.2.0
numpy>=1.13.0
pandas>=0.18.0
numpy>=1.15.0
pandas>=0.24.0
patsy>=0.5.1
scipy>=0.18.1
scipy>=1.2.0
theano-pymc==1.0.14
typing-extensions>=3.7.4
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,5 +85,4 @@ def get_version():
python_requires=">=3.7",
install_requires=install_reqs,
tests_require=test_reqs,
test_suite="nose.collector",
)

0 comments on commit 34b05d8

Please sign in to comment.