Repository navigation
65 lines (55 loc) · 2.2 KB
/
Copy pathpython-tests.yml
File metadata and controls
65 lines (55 loc) · 2.2 KB
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
name: python-tests
on:
push:
branches: [main]
pull_request:
workflow_dispatch:
permissions:
contents: read
jobs:
pytest:
name: pytest (Python ${{ matrix.python-version }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
# The oldest supported Python. Both legs install the latest releases: the dependency floors in
# python/pyproject.toml (numpy 1.21, pandas 1.3, scipy 1.7, cmdstanpy 1.2) are not verified yet.
# Once they are, pin them on this leg and change them in both files together.
# setup-python has no Python 3.9 build for Ubuntu 26.04 (ubuntu-latest), so this leg stays on 24.04.
- python-version: "3.9"
cmdstan: false
os: ubuntu-24.04
# The newest Python with the latest releases; this leg also installs CmdStan and runs the fits.
- python-version: "3.13"
cmdstan: true
os: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install denmark
run: pip install -e "python[test,plot]"
- name: Show versions
run: python -c "import sys, importlib.metadata as m; print(sys.version.split()[0], *(f'{p} {m.version(p)}' for p in ['numpy', 'pandas', 'scipy', 'cmdstanpy', 'matplotlib']))"
# CmdStan is built once per CmdStan release and cached; without it the fit tests skip.
- name: Find the latest CmdStan release
if: matrix.cmdstan
id: cmdstan
run: echo "version=$(gh api repos/stan-dev/cmdstan/releases/latest --jq .tag_name)" >> "$GITHUB_OUTPUT"
env:
GH_TOKEN: ${{ github.token }}
- name: Cache CmdStan
if: matrix.cmdstan
id: cache-cmdstan
uses: actions/cache@v4
with:
path: ~/.cmdstan
key: cmdstan-${{ runner.os }}-${{ steps.cmdstan.outputs.version }}-py
- name: Install CmdStan
if: matrix.cmdstan && steps.cache-cmdstan.outputs.cache-hit != 'true'
run: python -m cmdstanpy.install_cmdstan --cores 2
- name: Run tests
run: pytest -q python/tests