Add Python 3.14 support to MDF #2622
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| workflow_dispatch: | |
| pull_request: | |
| push: | |
| release: | |
| types: [published] | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| pre-commit: | |
| name: Format | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.10' | |
| - uses: pre-commit/action@v3.0.1 | |
| with: | |
| extra_args: --hook-stage manual --all-files | |
| tests: | |
| name: ${{ matrix.test-suite }}, py ${{ matrix.python-version }}, ${{ matrix.os }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ['3.10', '3.13'] | |
| os: [ubuntu-latest, macos-latest, windows-latest] | |
| test-suite: [core, actr, pytorch, neuroml, tensorflow, psyneulink] | |
| exclude: | |
| - os: windows-latest | |
| test-suite: tensorflow | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install uv and set the python version | |
| uses: astral-sh/setup-uv@v6 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install HDF5 for pytables on macos-14/latest | |
| if: ${{ matrix.runs-on == 'macos-latest' }} | |
| run: | | |
| brew install hdf5 | |
| - name: Install graphviz | |
| uses: ts-graphviz/setup-graphviz@v2 | |
| with: | |
| # Skip to run brew update command on macOS. | |
| macos-skip-brew-update: 'true' # default false | |
| - name: Install extras for ${{ matrix.test-suite }} | |
| shell: bash | |
| run: | | |
| uv sync --dev | |
| case "${{ matrix.test-suite }}" in | |
| pytorch) uv sync --extra "optional" --dev ;; | |
| neuroml) uv sync --extra "neuroml" --dev ;; | |
| tensorflow) uv sync --extra "tensorflow" --dev ;; | |
| psyneulink) uv sync --extra "psyneulink" --dev ;; | |
| esac | |
| - name: Run ${{ matrix.test-suite }} tests | |
| shell: bash | |
| run: | | |
| MARKER="${{ matrix.test-suite }}" | |
| if [ "${{ matrix.test-suite }}" = "core" ]; then | |
| MARKER="coremdf" | |
| fi | |
| uv run pytest -v -m "${MARKER}" tests/ | |
| docs: | |
| name: Build Documentation | |
| needs: tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.10' | |
| - name: Install uv and set the python version | |
| uses: astral-sh/setup-uv@v6 | |
| with: | |
| python-version: '3.10' | |
| - name: Generate and Build Docs | |
| run: | | |
| uv sync --group docs | |
| cd docs | |
| uv run generate.py | |
| cd sphinx | |
| uv run make clean | |
| uv run make html | |
| dist: | |
| name: Distribution build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Build sdist & wheel | |
| run: pipx run --spec build pyproject-build | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| path: dist | |
| - uses: pypa/gh-action-pypi-publish@v1.4.1 | |
| if: github.event_name == 'release' && github.event.action == 'published' | |
| with: | |
| user: __token__ | |
| password: ${{ secrets.pypi_password }} | |
| all-passed: | |
| runs-on: ubuntu-latest | |
| needs: | |
| - pre-commit | |
| - tests | |
| - docs | |
| - dist | |
| if: always() | |
| steps: | |
| - name: Fail if any dependency did not succeed | |
| run: | | |
| echo "Upstream results: ${{ join(needs.*.result, ', ') }}" | |
| # If any result is failure/cancelled/skipped, fail this job | |
| if [[ "${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') || contains(needs.*.result, 'skipped') }}" == "true" ]]; then | |
| exit 1 | |
| fi |