try to start macos windows #19
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 and Publish to PyPI | ||
| on: | ||
| push: | ||
| tags: | ||
| - 'v*' | ||
| jobs: | ||
| build_wheels: | ||
| name: Build wheels | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| matrix: | ||
| os: [ubuntu-latest, macos-13, macos-14, windows-latest] | ||
| runs-on: ${{ matrix.os }} | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Build wheels | ||
| uses: pypa/cibuildwheel@v2.16.2 | ||
| env: | ||
| # 🔥 支援多 Python | ||
| CIBW_BUILD: "cp310-* cp311-* cp312-*" | ||
| # 🔥 不 build PyPy / musllinux | ||
| CIBW_SKIP: "pp* *musllinux*" | ||
| # 🔥 固定 torch 版本(避免 ABI 地雷) | ||
| CIBW_BEFORE_BUILD: "pip install torch==2.2.2" | ||
| # 🔥 Linux repair(你的強化版) | ||
| CIBW_REPAIR_WHEEL_COMMAND_LINUX: > | ||
| LD_LIBRARY_PATH=$(python -c 'import torch, os; print(os.path.join(torch.__path__[0], "lib"))'):$LD_LIBRARY_PATH | ||
| auditwheel repair | ||
| --exclude libtorch*.so | ||
| --exclude libc10*.so | ||
| --exclude libgomp*.so | ||
| -w {dest_dir} {wheel} | ||
| - name: Store wheels | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: cibw-wheels-${{ matrix.os }} | ||
| path: ./wheelhouse/*.whl | ||
| build_sdist: | ||
| name: Build sdist | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Build sdist | ||
| run: pipx run build --sdist | ||
| - uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: cibw-sdist | ||
| path: dist/*.tar.gz | ||
| upload_pypi: | ||
| needs: [build_wheels, build_sdist] | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| id-token: write | ||
| steps: | ||
| - name: Download all | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| pattern: cibw-* | ||
| path: dist | ||
| merge-multiple: true | ||
| - name: Publish to PyPI | ||
| uses: pypa/gh-action-pypi-publish@release/v1 | ||
| with: | ||
| skip-existing: true | ||
| verbose: true | ||