|
| 1 | +name: Build Windows Wheel |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + tags: |
| 8 | + - v* |
| 9 | + pull_request: |
| 10 | + workflow_dispatch: |
| 11 | + |
| 12 | +permissions: |
| 13 | + contents: read |
| 14 | + |
| 15 | +jobs: |
| 16 | + build-wheel: |
| 17 | + runs-on: windows-latest |
| 18 | + |
| 19 | + strategy: |
| 20 | + matrix: |
| 21 | + python-version: [ "3.12", "3.11", "3.10" ] |
| 22 | + |
| 23 | + steps: |
| 24 | + - name: Checkout repository code |
| 25 | + # zh: 检出仓库代码 |
| 26 | + uses: actions/checkout@v3 |
| 27 | + |
| 28 | + - name: Set up Python ${{ matrix.python-version }} |
| 29 | + # zh: 设置 Python ${{ matrix.python-version }} |
| 30 | + uses: actions/setup-python@v5 |
| 31 | + with: |
| 32 | + python-version: ${{ matrix.python-version }} |
| 33 | + |
| 34 | + - name: Verify Python version |
| 35 | + # zh: 验证 Python 版本 |
| 36 | + run: python --version |
| 37 | + |
| 38 | + - name: Set up Rust |
| 39 | + # zh: 设置 Rust |
| 40 | + uses: actions-rs/toolchain@v1 |
| 41 | + with: |
| 42 | + toolchain: stable |
| 43 | + override: true |
| 44 | + |
| 45 | + - name: Verify Rust version |
| 46 | + # zh: 验证 Rust 版本 |
| 47 | + run: rustc --version |
| 48 | + |
| 49 | + - name: Install dependencies |
| 50 | + # zh: 安装依赖 |
| 51 | + run: | |
| 52 | + python -m pip install --upgrade pip setuptools wheel Cython build |
| 53 | + # python -m pip install -r requirements.txt # zh: 根据项目实际需求调整 |
| 54 | + |
| 55 | + - name: Build Wheel |
| 56 | + # zh: 构建 Wheel |
| 57 | + run: python -m build --wheel |
| 58 | + |
| 59 | + - name: Find and upload Wheel file |
| 60 | + # zh: 查找并上传 Wheel 文件 |
| 61 | + uses: actions/upload-artifact@v4 |
| 62 | + with: |
| 63 | + name: built-wheel-${{ matrix.python-version }} |
| 64 | + path: | |
| 65 | + dist/*.whl |
| 66 | +
|
| 67 | +# - name: Publish to PyPI |
| 68 | +# # zh: 发布到 PyPI |
| 69 | +# uses: PyO3/maturin-action@v1 |
| 70 | +# if: startsWith(github.ref, 'refs/tags/') |
| 71 | +# with: |
| 72 | +# command: upload |
| 73 | +# args: --skip-existing * |
| 74 | +# env: |
| 75 | +# MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }} |
| 76 | + |
| 77 | +# - name: Upload Wheel to GitHub Releases |
| 78 | +# # zh: 上传 Wheel 到 GitHub Releases |
| 79 | +# if: startsWith(github.ref, 'refs/tags/') |
| 80 | +# uses: actions/upload-release-asset@v1 |
| 81 | +# env: |
| 82 | +# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 83 | +# with: |
| 84 | +# upload_url: ${{ github.event.release.upload_url }} |
| 85 | +# asset_path: ./dist/*.whl |
| 86 | +# asset_name: your_package_name-${{ matrix.python-version }}.whl # zh: 请替换为实际的 wheel 文件名 |
| 87 | +# asset_content_type: application/octet-stream |
0 commit comments