Skip to content

Commit

Permalink
Add coveralls to CI (#1925)
Browse files Browse the repository at this point in the history
* Add coveralls to CI

* Do not run coverage for docs

* add coveralls badge to README

* add github token for coveralls

* try to set PYTEST_ADDOPTS globally

* Use editable installation in CI for coverage
  • Loading branch information
fehiepsi authored Dec 4, 2024
1 parent d66d27c commit d8bc7f7
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
24 changes: 21 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ on:
pull_request:
branches: [ master ]

env:
PYTEST_ADDOPTS: "--cov=numpyro"

jobs:
lint:

Expand Down Expand Up @@ -67,14 +70,19 @@ jobs:
pip install jaxlib
pip install jax
pip install https://github.com/pyro-ppl/funsor/archive/master.zip
pip install .[dev,test]
pip install -e .[dev,test]
pip freeze
- name: Test with pytest
run: |
CI=1 pytest -vs -k "not test_example" --durations=100 --ignore=test/infer/ --ignore=test/contrib/
- name: Test x64
run: |
JAX_ENABLE_X64=1 pytest -vs test/test_distributions.py -k powerLaw
- name: Coveralls
if: github.repository == 'pyro-ppl/numpyro' && matrix.python-version == '3.10'
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}


test-inference:
Expand All @@ -99,7 +107,7 @@ jobs:
pip install jaxlib
pip install jax
pip install https://github.com/pyro-ppl/funsor/archive/master.zip
pip install .[dev,test]
pip install -e .[dev,test]
pip freeze
- name: Test with pytest
run: |
Expand All @@ -121,6 +129,11 @@ jobs:
- name: Test nested sampling
run: |
JAX_ENABLE_X64=1 pytest -vs test/contrib/test_nested_sampling.py
- name: Coveralls
if: github.repository == 'pyro-ppl/numpyro' && matrix.python-version == '3.10'
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}


examples:
Expand All @@ -143,8 +156,13 @@ jobs:
pip install jaxlib
pip install jax
pip install https://github.com/pyro-ppl/funsor/archive/master.zip
pip install .[dev,examples,test]
pip install -e .[dev,examples,test]
pip freeze
- name: Test with pytest
run: |
CI=1 XLA_FLAGS="--xla_force_host_platform_device_count=2" pytest -vs -k test_example
- name: Coveralls
if: github.repository == 'pyro-ppl/numpyro' && matrix.python-version == '3.10'
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[![Build Status](https://github.com/pyro-ppl/numpyro/workflows/CI/badge.svg)](https://github.com/pyro-ppl/numpyro/actions)
[![Coverage Status](https://coveralls.io/repos/github/pyro-ppl/numpyro/badge.svg)](https://coveralls.io/github/pyro-ppl/numpyro)
[![Documentation Status](https://readthedocs.org/projects/numpyro/badge/?version=latest)](https://numpyro.readthedocs.io/en/latest/?badge=latest)
[![Latest Version](https://badge.fury.io/py/numpyro.svg)](https://pypi.python.org/pypi/numpyro)

Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
"matplotlib",
"optax>=0.0.6",
"pylab-sdk", # jaxns dependency
"pytest-cov",
"pyyaml", # flax dependency
"requests", # pylab dependency
"tensorflow_probability>=0.18.0",
Expand Down

0 comments on commit d8bc7f7

Please sign in to comment.