Bump version to 0.8.0 #83
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: Build Wheels | |
| on: | |
| push: | |
| branches: | |
| - main | |
| tags: | |
| - 'v*' | |
| pull_request: | |
| branches: | |
| - main | |
| release: | |
| types: [published] | |
| workflow_dispatch: | |
| jobs: | |
| build_wheels: | |
| name: Build wheels on ${{ matrix.os }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest] # Linux only for now | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Build wheels | |
| uses: pypa/cibuildwheel@v2.21 | |
| env: | |
| # Only build for Python 3.12+ | |
| CIBW_BUILD: "cp312-*" | |
| # Skip 32-bit builds and musl (Alpine) on Linux | |
| CIBW_SKIP: "*-win32 *-manylinux_i686 *-musllinux_*" | |
| # Install system dependencies before building (Linux) | |
| CIBW_BEFORE_ALL_LINUX: | | |
| yum install -y openmpi-devel | |
| # Install system dependencies before building (macOS) | |
| CIBW_BEFORE_ALL_MACOS: | | |
| brew install open-mpi | |
| # Ensure command line tools are available | |
| xcode-select --install 2>/dev/null || true | |
| # Install Python build dependencies including NEURON | |
| CIBW_BEFORE_BUILD_LINUX: pip install neuron==8.2.7 setuptools Cython numpy scipy && export NMODL_PYLIB=$(python -c "import sysconfig; print(sysconfig.get_config_var('LIBDIR'))")/libpython$(python -c "import sys; print(f'{sys.version_info.major}.{sys.version_info.minor}')").so && nrnivmodl myogen/simulator/nmodl_files && cp -r x86_64 myogen/simulator/nmodl_files/ | |
| CIBW_BEFORE_BUILD_MACOS: pip install neuron setuptools Cython numpy scipy && nrnivmodl myogen/simulator/nmodl_files && (cp -r x86_64 myogen/simulator/nmodl_files/ 2>/dev/null || cp -r arm64 myogen/simulator/nmodl_files/ || cp -r aarch64 myogen/simulator/nmodl_files/) | |
| # Use manylinux2014 (manylinux_2_17) | |
| CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014 | |
| # Custom repair to preserve NEURON mechanisms while adding proper platform tags | |
| # Standard tools (auditwheel/delocate) strip the architecture directories | |
| CIBW_REPAIR_WHEEL_COMMAND_LINUX: | | |
| python -c " | |
| import shutil, sys | |
| from pathlib import Path | |
| wheel = Path(sys.argv[1]) | |
| dest = Path(sys.argv[2]) | |
| # Rename to manylinux without modifying contents | |
| new_name = wheel.name.replace('linux_', 'manylinux_2_17_').replace('manylinux2014_', 'manylinux_2_17_') | |
| shutil.copy2(wheel, dest / new_name) | |
| " {wheel} {dest_dir} | |
| # macOS: Just copy wheel as-is (already has correct platform tag) | |
| CIBW_REPAIR_WHEEL_COMMAND_MACOS: "cp {wheel} {dest_dir}/" | |
| - name: Show built wheel names | |
| run: ls -lh wheelhouse/ | |
| - name: Upload wheels | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: wheels-${{ matrix.os }} | |
| path: wheelhouse/*.whl | |
| retention-days: 7 | |
| build_sdist: | |
| name: Build source distribution | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Install build dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install build | |
| - name: Build sdist | |
| run: python -m build --sdist --outdir dist/ | |
| - name: Upload sdist | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: sdist | |
| path: dist/*.tar.gz | |
| retention-days: 7 | |
| test_wheels: | |
| name: Test wheel on ${{ matrix.os }} | |
| needs: [build_wheels] | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest] # Match build_wheels matrix | |
| python-version: ["3.12"] | |
| steps: | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Download wheels | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: wheels-${{ matrix.os }} | |
| path: dist/ | |
| - name: Install system dependencies (Ubuntu) | |
| if: runner.os == 'Linux' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y openmpi-bin libopenmpi-dev | |
| - name: Install system dependencies (macOS) | |
| if: runner.os == 'macOS' | |
| run: | | |
| brew install open-mpi | |
| - name: Install NEURON | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install neuron${{ runner.os == 'Linux' && '==8.2.7' || '' }} | |
| - name: Install wheel | |
| run: | | |
| pip install dist/*.whl | |
| - name: Test import | |
| run: | | |
| python -c "import myogen; print('MyoGen imported successfully')" | |
| python -c "from myogen.simulator import Muscle, SurfaceEMG; print('Core components OK')" | |
| - name: Test NEURON components (Linux only) | |
| if: runner.os == 'Linux' | |
| run: | | |
| python -c "from myogen.simulator.neuron.populations import AlphaMN__Pool; print('NEURON components OK')" | |
| publish: | |
| name: Publish to PyPI | |
| needs: [build_wheels, build_sdist, test_wheels] | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'release' || (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')) | |
| permissions: | |
| id-token: write # Required for OIDC publishing | |
| contents: write # Required for uploading release assets | |
| steps: | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: dist/ | |
| merge-multiple: true | |
| - name: Upload artifacts to GitHub Release | |
| if: github.event_name == 'release' | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| files: dist/* | |
| - name: Publish to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| skip-existing: true |