|
5 | 5 | pull_request: |
6 | 6 | push: |
7 | 7 | release: |
8 | | - types: |
9 | | - - published |
| 8 | + types: [published] |
| 9 | + |
| 10 | +concurrency: |
| 11 | + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} |
| 12 | + cancel-in-progress: true |
10 | 13 |
|
11 | 14 | jobs: |
12 | 15 | pre-commit: |
13 | 16 | name: Format |
14 | 17 | runs-on: ubuntu-latest |
15 | 18 | steps: |
16 | | - - uses: actions/checkout@v4 |
17 | | - - uses: actions/setup-python@v5 |
18 | | - with: |
19 | | - python-version: "3.10" |
20 | | - - uses: pre-commit/action@v3.0.1 |
21 | | - with: |
22 | | - extra_args: --hook-stage manual --all-files |
23 | | - |
24 | | - checks: |
25 | | - name: Check Python ${{ matrix.python-version }} on ${{ matrix.runs-on }} |
26 | | - runs-on: ${{ matrix.runs-on }} |
| 19 | + - uses: actions/checkout@v4 |
| 20 | + - uses: actions/setup-python@v5 |
| 21 | + with: |
| 22 | + python-version: '3.10' |
| 23 | + - uses: pre-commit/action@v3.0.1 |
| 24 | + with: |
| 25 | + extra_args: --hook-stage manual --all-files |
| 26 | + |
| 27 | + tests: |
| 28 | + name: ${{ matrix.test-suite }}, py ${{ matrix.python-version }}, ${{ matrix.os }} |
| 29 | + runs-on: ${{ matrix.os }} |
27 | 30 | strategy: |
28 | 31 | fail-fast: false |
29 | 32 | matrix: |
30 | | - python-version: [ "3.9", "3.11", "3.12"] |
31 | | - runs-on: [ubuntu-latest, macos-latest, windows-latest] |
| 33 | + python-version: ['3.10', '3.13'] |
| 34 | + os: [ubuntu-latest, macos-latest, windows-latest] |
| 35 | + test-suite: [core, actr, pytorch, neuroml, tensorflow, psyneulink] |
32 | 36 | exclude: |
33 | | - - runs-on: macos-latest |
34 | | - python-version: "3.9" |
| 37 | + - os: windows-latest |
| 38 | + test-suite: tensorflow |
35 | 39 |
|
36 | 40 | steps: |
37 | | - - uses: actions/checkout@v4 |
38 | | - |
39 | | - - uses: actions/setup-python@v5 |
40 | | - with: |
41 | | - python-version: ${{ matrix.python-version }} |
42 | | - |
43 | | - # Rely on version of modelspec from PyPI as set by setup.cfg... |
44 | | - #- name: Install modelspec |
45 | | - # run: python -m pip install git+https://github.com/ModECI/modelspec.git@main |
46 | | - |
47 | | - # Rely on version of NeuroMLlite from PyPI as set by setup.py... |
48 | | - # - name: Install NeuroMLlite |
49 | | - # run: python -m pip install NeuroMLlite>=0.5.0 |
50 | | - |
51 | | - # Rely on version of PsyNeuLink from PyPI as set by setup.py... |
52 | | - #- name: Install specific PsyNeuLink branch |
53 | | - # run: python -m pip install git+https://github.com/ModECI/PsyNeuLink@devel |
54 | | - |
55 | | - - name: Install HDF5 for pytables on macos-14/latest |
56 | | - if: ${{ matrix.runs-on == 'macos-latest' }} |
57 | | - run: | |
58 | | - brew install hdf5 |
59 | | -
|
60 | | - - name: Install core package |
61 | | - run: | |
62 | | - pip install 'numpy<2.0.0' # due to lingering issues with other modules & numpy v2... |
63 | | - python -m pip install .[dev] |
64 | | -
|
65 | | - - name: Version info for installed packages |
66 | | - run: | |
67 | | - pip list |
68 | | -
|
69 | | - - name: Test core package |
70 | | - run: | |
71 | | - python -m pytest -m coremdf tests/ |
72 | | -
|
73 | | - - name: Install most optional dependencies |
74 | | - run: | |
75 | | - python -m pip install .[optional] |
76 | | -
|
77 | | - - name: Version info for optional installed packages |
78 | | - run: | |
79 | | - pip list |
80 | | -
|
81 | | - - name: Install graphviz |
82 | | - uses: ts-graphviz/setup-graphviz@v2 |
83 | | - with: |
84 | | - # Skip to run brew update command on macOS. |
85 | | - macos-skip-brew-update: 'true' # default false |
86 | | - |
87 | | - - name: Test interface ACT-R |
88 | | - run: | |
89 | | - python -m pytest -v -m "actr" tests/ |
90 | | -
|
91 | | - - name: Test interface PyTorch |
92 | | - run: | |
93 | | - python -m pytest -v -m "pytorch" tests/ |
94 | | -
|
95 | | - - name: Test interface NeuroML |
96 | | - run: | |
97 | | - python -m pip install .[neuroml] |
98 | | - python -m pytest -v -m "neuroml" tests/ |
99 | | -
|
100 | | - - name: Test interface TensorFlow |
101 | | - run: | |
102 | | - python -m pip install .[tensorflow] |
103 | | - dot -V |
104 | | - python -m pytest -v -m "tensorflow" tests/ |
105 | | -
|
106 | | - - name: Test interface PsyNeuLink |
107 | | - run: | |
108 | | - python -m pip install .[psyneulink] |
109 | | - python -m pytest -v -m "psyneulink" tests/ |
110 | | -
|
111 | | - - name: Build Documentation |
112 | | - run: | |
113 | | - cd docs |
114 | | - python generate.py |
115 | | - cd sphinx |
116 | | - make clean |
117 | | - make html |
118 | | -
|
119 | | - - name: Final version info for optional installed packages |
120 | | - run: | |
121 | | - pip list |
| 41 | + - uses: actions/checkout@v4 |
| 42 | + |
| 43 | + - name: Setup Python |
| 44 | + uses: actions/setup-python@v5 |
| 45 | + with: |
| 46 | + python-version: ${{ matrix.python-version }} |
| 47 | + |
| 48 | + - name: Install uv and set the python version |
| 49 | + uses: astral-sh/setup-uv@v6 |
| 50 | + with: |
| 51 | + python-version: ${{ matrix.python-version }} |
| 52 | + |
| 53 | + - name: Install HDF5 for pytables on macos-14/latest |
| 54 | + if: ${{ matrix.runs-on == 'macos-latest' }} |
| 55 | + run: | |
| 56 | + brew install hdf5 |
| 57 | +
|
| 58 | + - name: Install graphviz |
| 59 | + uses: ts-graphviz/setup-graphviz@v2 |
| 60 | + with: |
| 61 | + # Skip to run brew update command on macOS. |
| 62 | + macos-skip-brew-update: 'true' # default false |
| 63 | + |
| 64 | + - name: Install extras for ${{ matrix.test-suite }} |
| 65 | + shell: bash |
| 66 | + run: | |
| 67 | + uv sync --dev |
| 68 | + case "${{ matrix.test-suite }}" in |
| 69 | + pytorch) uv sync --extra "optional" --dev ;; |
| 70 | + neuroml) uv sync --extra "neuroml" --dev ;; |
| 71 | + tensorflow) uv sync --extra "tensorflow" --dev ;; |
| 72 | + psyneulink) uv sync --extra "psyneulink" --dev ;; |
| 73 | + esac |
| 74 | +
|
| 75 | + - name: Run ${{ matrix.test-suite }} tests |
| 76 | + shell: bash |
| 77 | + run: | |
| 78 | + MARKER="${{ matrix.test-suite }}" |
| 79 | + if [ "${{ matrix.test-suite }}" = "core" ]; then |
| 80 | + MARKER="coremdf" |
| 81 | + fi |
| 82 | + uv run pytest -v -m "${MARKER}" tests/ |
| 83 | +
|
| 84 | + docs: |
| 85 | + name: Build Documentation |
| 86 | + needs: tests |
| 87 | + runs-on: ubuntu-latest |
| 88 | + steps: |
| 89 | + - uses: actions/checkout@v4 |
| 90 | + - uses: actions/setup-python@v5 |
| 91 | + with: |
| 92 | + python-version: '3.10' |
| 93 | + - name: Install uv and set the python version |
| 94 | + uses: astral-sh/setup-uv@v6 |
| 95 | + with: |
| 96 | + python-version: '3.10' |
| 97 | + - name: Generate and Build Docs |
| 98 | + run: | |
| 99 | + uv sync --group docs |
| 100 | + cd docs |
| 101 | + uv run generate.py |
| 102 | + cd sphinx |
| 103 | + uv run make clean |
| 104 | + uv run make html |
122 | 105 |
|
123 | 106 | dist: |
124 | 107 | name: Distribution build |
125 | 108 | runs-on: ubuntu-latest |
126 | | - |
127 | 109 | steps: |
128 | | - - uses: actions/checkout@v4 |
129 | | - |
130 | | - - name: Build sdist and wheel |
131 | | - run: pipx run --spec build pyproject-build |
132 | | - |
133 | | - - uses: actions/upload-artifact@v4 |
134 | | - with: |
135 | | - path: dist |
136 | | - |
137 | | - - uses: pypa/gh-action-pypi-publish@v1.4.1 |
138 | | - if: github.event_name == 'release' && github.event.action == 'published' |
139 | | - with: |
140 | | - user: __token__ |
141 | | - # Remember to generate this and set it in "GitHub Secrets" |
142 | | - password: ${{ secrets.pypi_password }} |
| 110 | + - uses: actions/checkout@v4 |
| 111 | + - name: Build sdist & wheel |
| 112 | + run: pipx run --spec build pyproject-build |
| 113 | + - uses: actions/upload-artifact@v4 |
| 114 | + with: |
| 115 | + path: dist |
| 116 | + - uses: pypa/gh-action-pypi-publish@v1.4.1 |
| 117 | + if: github.event_name == 'release' && github.event.action == 'published' |
| 118 | + with: |
| 119 | + user: __token__ |
| 120 | + password: ${{ secrets.pypi_password }} |
| 121 | + |
| 122 | + all-passed: |
| 123 | + runs-on: ubuntu-latest |
| 124 | + needs: |
| 125 | + - pre-commit |
| 126 | + - tests |
| 127 | + - docs |
| 128 | + - dist |
| 129 | + if: always() |
| 130 | + steps: |
| 131 | + - name: Fail if any dependency did not succeed |
| 132 | + run: | |
| 133 | + echo "Upstream results: ${{ join(needs.*.result, ', ') }}" |
| 134 | + # If any result is failure/cancelled/skipped, fail this job |
| 135 | + if [[ "${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') || contains(needs.*.result, 'skipped') }}" == "true" ]]; then |
| 136 | + exit 1 |
| 137 | + fi |
0 commit comments