|
9 | 9 | branches: [master] |
10 | 10 |
|
11 | 11 | env: |
12 | | - PYTEST_ADDOPTS: "--cov=numpyro --cov-append" |
| 12 | + PYTEST_ADDOPTS: "--cov=numpyro --cov-append --cov-report=lcov" |
13 | 13 |
|
14 | 14 | jobs: |
15 | 15 | prek: |
16 | | - |
17 | 16 | runs-on: ubuntu-latest |
18 | | - |
19 | 17 | steps: |
20 | | - - uses: actions/checkout@v2 |
| 18 | + - uses: actions/checkout@v6 |
21 | 19 | - name: prek check |
22 | 20 | uses: j178/prek-action@v1 |
23 | 21 | with: |
24 | 22 | extra-args: --all-files --skip ruff --skip ruff-format --skip ty --skip mypy |
25 | 23 |
|
26 | | - |
27 | 24 | lint: |
28 | | - |
29 | 25 | runs-on: ubuntu-latest |
30 | 26 | strategy: |
31 | 27 | matrix: |
32 | 28 | python-version: ["3.11", "3.13"] |
33 | 29 |
|
34 | 30 | steps: |
35 | | - - uses: actions/checkout@v2 |
36 | | - - name: Set up Python ${{ matrix.python-version }} |
37 | | - uses: actions/setup-python@v2 |
| 31 | + - uses: actions/checkout@v6 |
| 32 | + - name: Install uv |
| 33 | + uses: astral-sh/setup-uv@v7 |
38 | 34 | with: |
| 35 | + enable-cache: true |
39 | 36 | python-version: ${{ matrix.python-version }} |
40 | 37 | - name: Install dependencies |
41 | 38 | run: | |
42 | 39 | sudo apt install -y pandoc gsfonts |
43 | | - python -m pip install --upgrade pip |
44 | | - pip install jaxlib |
45 | | - pip install jax |
46 | | - pip install '.[doc,test]' |
47 | | - pip install https://github.com/pyro-ppl/funsor/archive/master.zip |
48 | | - pip install -r docs/requirements.txt |
49 | | - pip freeze |
| 40 | + uv sync \ |
| 41 | + --upgrade \ |
| 42 | + --extra cpu \ |
| 43 | + --group ci \ |
| 44 | + --group docs \ |
| 45 | + --group test |
| 46 | + uv pip freeze |
50 | 47 | - name: Lint with mypy and ruff |
51 | 48 | run: | |
52 | | - make lint |
| 49 | + uv run make lint |
53 | 50 | - name: Build documentation |
54 | 51 | run: | |
55 | | - make docs |
| 52 | + uv run make docs |
56 | 53 | - name: Test documentation |
57 | 54 | run: | |
58 | | - make doctest |
59 | | - python -m doctest -v README.md |
60 | | -
|
| 55 | + uv run make doctest |
| 56 | + uv run python -m doctest -v README.md |
61 | 57 |
|
62 | 58 | test-modeling: |
63 | | - |
64 | 59 | runs-on: ubuntu-latest |
65 | 60 | needs: [lint, prek] |
66 | 61 | strategy: |
67 | 62 | matrix: |
68 | 63 | python-version: ["3.11", "3.13"] |
| 64 | + env: |
| 65 | + UV_PYTHON: ${{ matrix.python-version }} |
69 | 66 |
|
70 | 67 | steps: |
71 | | - - uses: actions/checkout@v2 |
72 | | - - name: Set up Python ${{ matrix.python-version }} |
73 | | - uses: actions/setup-python@v2 |
| 68 | + - uses: actions/checkout@v6 |
| 69 | + - name: Install uv |
| 70 | + uses: astral-sh/setup-uv@v7 |
74 | 71 | with: |
| 72 | + enable-cache: true |
75 | 73 | python-version: ${{ matrix.python-version }} |
76 | 74 | - name: Install dependencies |
77 | 75 | run: | |
78 | 76 | sudo apt install -y graphviz |
79 | | - python -m pip install --upgrade pip |
80 | | - # Keep track of pyro-api master branch |
81 | | - pip install https://github.com/pyro-ppl/pyro-api/archive/master.zip |
82 | | - pip install jaxlib |
83 | | - pip install jax |
84 | | - pip install https://github.com/pyro-ppl/funsor/archive/master.zip |
85 | | - pip install -e '.[dev,test]' |
86 | | - pip freeze |
| 77 | + uv sync \ |
| 78 | + --upgrade \ |
| 79 | + --extra cpu \ |
| 80 | + --group ci \ |
| 81 | + --group dev \ |
| 82 | + --group test |
| 83 | + uv pip freeze |
87 | 84 | - name: Test with pytest |
88 | 85 | run: | |
89 | | - CI=1 pytest -vs -k "not test_example" --durations=100 --ignore=test/infer/ --ignore=test/contrib/ |
| 86 | + CI=1 uv run pytest -vs -k "not test_example" --durations=100 --ignore=test/infer/ --ignore=test/contrib/ |
90 | 87 | - name: Test x64 |
91 | 88 | run: | |
92 | | - JAX_ENABLE_X64=1 pytest -vs test/test_distributions.py -k "powerLaw or Dagum" |
| 89 | + JAX_ENABLE_X64=1 uv run pytest -vs test/test_distributions.py -k "powerLaw or Dagum" |
93 | 90 | - name: Test tracer leak |
94 | 91 | if: matrix.python-version == '3.13' |
95 | 92 | env: |
96 | 93 | JAX_CHECK_TRACER_LEAKS: 1 |
97 | 94 | run: | |
98 | | - pytest -vs test/infer/test_mcmc.py::test_chain_inside_jit |
99 | | - pytest -vs test/infer/test_mcmc.py::test_chain_jit_args_smoke |
100 | | - pytest -vs test/infer/test_mcmc.py::test_reuse_mcmc_run |
101 | | - pytest -vs test/infer/test_mcmc.py::test_model_with_multiple_exec_paths |
102 | | - pytest -vs test/test_distributions.py::test_mean_var -k Gompertz |
103 | | -
|
| 95 | + uv run pytest -vs \ |
| 96 | + test/infer/test_mcmc.py::test_chain_inside_jit \ |
| 97 | + test/infer/test_mcmc.py::test_chain_jit_args_smoke \ |
| 98 | + test/infer/test_mcmc.py::test_model_with_multiple_exec_paths \ |
| 99 | + test/infer/test_mcmc.py::test_reuse_mcmc_run |
| 100 | + uv run pytest -vs test/test_distributions.py::test_mean_var -k Gompertz |
104 | 101 | - name: Coveralls |
105 | 102 | if: github.repository == 'pyro-ppl/numpyro' && matrix.python-version == '3.13' |
106 | 103 | uses: coverallsapp/github-action@v2 |
107 | 104 | with: |
108 | 105 | github-token: ${{ secrets.GITHUB_TOKEN }} |
109 | 106 | parallel: true |
110 | 107 | flag-name: test-modeling |
111 | | - |
| 108 | + file: coverage.lcov |
112 | 109 |
|
113 | 110 | test-inference: |
114 | | - |
115 | 111 | runs-on: ubuntu-latest |
116 | 112 | needs: [lint, prek] |
117 | 113 | strategy: |
118 | 114 | matrix: |
119 | 115 | python-version: ["3.11", "3.13"] |
| 116 | + env: |
| 117 | + UV_PYTHON: ${{ matrix.python-version }} |
120 | 118 |
|
121 | 119 | steps: |
122 | | - - uses: actions/checkout@v2 |
123 | | - - name: Set up Python ${{ matrix.python-version }} |
124 | | - uses: actions/setup-python@v2 |
| 120 | + - uses: actions/checkout@v6 |
| 121 | + - name: Install uv |
| 122 | + uses: astral-sh/setup-uv@v7 |
125 | 123 | with: |
| 124 | + enable-cache: true |
126 | 125 | python-version: ${{ matrix.python-version }} |
| 126 | + - name: Set up Python ${{ matrix.python-version }} |
| 127 | + run: uv python install ${{ matrix.python-version }} |
127 | 128 | - name: Install dependencies |
128 | 129 | run: | |
129 | | - python -m pip install --upgrade pip |
130 | | - # Keep track of pyro-api master branch |
131 | | - pip install https://github.com/pyro-ppl/pyro-api/archive/master.zip |
132 | | - pip install jaxlib |
133 | | - pip install jax |
134 | | - pip install https://github.com/pyro-ppl/funsor/archive/master.zip |
135 | | - pip install -e '.[dev,test]' |
136 | | - pip freeze |
| 130 | + uv sync \ |
| 131 | + --upgrade \ |
| 132 | + --extra cpu \ |
| 133 | + --group ci \ |
| 134 | + --group dev \ |
| 135 | + --group test |
| 136 | + uv pip freeze |
137 | 137 | - name: Test with pytest |
138 | 138 | run: | |
139 | | - pytest -vs --durations=20 test/infer/test_mcmc.py |
140 | | - pytest -vs --durations=20 test/infer --ignore=test/infer/test_mcmc.py --ignore=test/contrib/test_nested_sampling.py |
141 | | - pytest -vs --durations=20 test/contrib --ignore=test/contrib/stochastic_support/test_dcc.py |
| 139 | + uv run pytest -vs --durations=20 test/contrib --ignore=test/contrib/stochastic_support/test_dcc.py |
| 140 | + uv run pytest -vs --durations=20 test/infer --ignore=test/infer/test_mcmc.py --ignore=test/contrib/test_nested_sampling.py |
| 141 | + uv run pytest -vs --durations=20 test/infer/test_mcmc.py |
142 | 142 | - name: Test x64 |
143 | 143 | run: | |
144 | | - JAX_ENABLE_X64=1 pytest -vs test/infer/test_mcmc.py -k x64 |
| 144 | + JAX_ENABLE_X64=1 uv run pytest -vs test/infer/test_mcmc.py -k x64 |
145 | 145 | - name: Test chains |
146 | 146 | run: | |
147 | | - XLA_FLAGS="--xla_force_host_platform_device_count=2" pytest -vs test/infer/test_mcmc.py -k "chain or pmap or vmap" |
148 | | - XLA_FLAGS="--xla_force_host_platform_device_count=2" pytest -vs test/contrib/test_tfp.py -k "chain" |
149 | | - XLA_FLAGS="--xla_force_host_platform_device_count=2" pytest -vs test/contrib/stochastic_support/test_dcc.py |
150 | | - XLA_FLAGS="--xla_force_host_platform_device_count=2" pytest -vs test/infer/test_hmc_gibbs.py -k "chain" |
| 147 | + XLA_FLAGS="--xla_force_host_platform_device_count=2" uv run pytest -vs test/contrib/stochastic_support/test_dcc.py |
| 148 | + XLA_FLAGS="--xla_force_host_platform_device_count=2" uv run pytest -vs test/contrib/test_tfp.py -k "chain" |
| 149 | + XLA_FLAGS="--xla_force_host_platform_device_count=2" uv run pytest -vs test/infer/test_hmc_gibbs.py -k "chain" |
| 150 | + XLA_FLAGS="--xla_force_host_platform_device_count=2" uv run pytest -vs test/infer/test_mcmc.py -k "chain or pmap or vmap" |
151 | 151 | - name: Test custom prng |
152 | 152 | run: | |
153 | | - JAX_ENABLE_CUSTOM_PRNG=1 pytest -vs test/infer/test_mcmc.py |
| 153 | + JAX_ENABLE_CUSTOM_PRNG=1 uv run pytest -vs test/infer/test_mcmc.py |
154 | 154 | - name: Test nested sampling |
155 | 155 | run: | |
156 | | - JAX_ENABLE_X64=1 pytest -vs test/contrib/test_nested_sampling.py |
| 156 | + JAX_ENABLE_X64=1 uv run pytest -vs test/contrib/test_nested_sampling.py |
157 | 157 | - name: Coveralls |
158 | 158 | if: github.repository == 'pyro-ppl/numpyro' && matrix.python-version == '3.13' |
159 | 159 | uses: coverallsapp/github-action@v2 |
160 | 160 | with: |
161 | 161 | github-token: ${{ secrets.GITHUB_TOKEN }} |
162 | 162 | parallel: true |
163 | 163 | flag-name: test-inference |
164 | | - |
| 164 | + file: coverage.lcov |
165 | 165 |
|
166 | 166 | examples: |
167 | | - |
168 | 167 | runs-on: ubuntu-latest |
169 | 168 | needs: [lint, prek] |
170 | 169 | strategy: |
171 | 170 | matrix: |
172 | 171 | python-version: ["3.13"] |
| 172 | + env: |
| 173 | + UV_PYTHON: ${{ matrix.python-version }} |
173 | 174 |
|
174 | 175 | steps: |
175 | | - - uses: actions/checkout@v2 |
176 | | - - name: Set up Python ${{ matrix.python-version }} |
177 | | - uses: actions/setup-python@v2 |
| 176 | + - uses: actions/checkout@v6 |
| 177 | + - name: Install uv |
| 178 | + uses: astral-sh/setup-uv@v7 |
178 | 179 | with: |
| 180 | + enable-cache: true |
| 181 | + update-path: true |
179 | 182 | python-version: ${{ matrix.python-version }} |
180 | 183 | - name: Install dependencies |
181 | 184 | run: | |
182 | | - python -m pip install --upgrade pip |
183 | | - pip install jaxlib |
184 | | - pip install jax |
185 | | - pip install https://github.com/pyro-ppl/funsor/archive/master.zip |
186 | | - pip install -e '.[dev,examples,test]' |
187 | | - pip freeze |
| 185 | + uv sync \ |
| 186 | + --upgrade \ |
| 187 | + --extra cpu \ |
| 188 | + --group ci \ |
| 189 | + --group dev \ |
| 190 | + --group examples \ |
| 191 | + --group test |
| 192 | + uv pip freeze |
188 | 193 | - name: Test with pytest |
189 | 194 | run: | |
190 | | - CI=1 XLA_FLAGS="--xla_force_host_platform_device_count=2" pytest -vs -k test_example |
| 195 | + CI=1 XLA_FLAGS="--xla_force_host_platform_device_count=2" uv run pytest -vs -k test_example |
191 | 196 | - name: Coveralls |
192 | 197 | if: github.repository == 'pyro-ppl/numpyro' && matrix.python-version == '3.13' |
193 | 198 | uses: coverallsapp/github-action@v2 |
194 | 199 | with: |
195 | 200 | github-token: ${{ secrets.GITHUB_TOKEN }} |
196 | 201 | parallel: true |
197 | 202 | flag-name: examples |
198 | | - |
| 203 | + file: coverage.lcov |
199 | 204 |
|
200 | 205 | finish: |
201 | | - |
202 | 206 | needs: [test-modeling, test-inference, examples] |
203 | 207 | runs-on: ubuntu-latest |
| 208 | + if: github.repository == 'pyro-ppl/numpyro' |
204 | 209 | steps: |
205 | 210 | - name: Coveralls finished |
206 | 211 | uses: coverallsapp/github-action@v2 |
207 | 212 | with: |
208 | 213 | github-token: ${{ secrets.GITHUB_TOKEN }} |
209 | 214 | parallel-finished: true |
210 | 215 | carryforward: "test-modeling,test-inference,examples" |
211 | | - |
|
0 commit comments