Add CPU wheel build workflows for Linux & Windows#111
Add CPU wheel build workflows for Linux & Windows#111SpaceTimee wants to merge 2 commits intoJamePeng:mainfrom
Conversation
Add GitHub Actions workflows for CPU-only Python wheels.
There was a problem hiding this comment.
Pull request overview
Adds GitHub Actions workflows to build and publish CPU-only Python wheels on Windows and Linux.
Changes:
- Introduce a Windows CPU wheel build workflow using
uv+python -m build. - Introduce a Linux CPU wheel build workflow using
uv buildwith OpenBLAS enabled. - Add wheel renaming to append
+cpu.<avxver>local version metadata and publish artifacts via GitHub Releases.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| .github/workflows/build-wheels-cpu-win.yml | New workflow to build CPU-only wheels on Windows across a Python-version matrix and publish to a release. |
| .github/workflows/build-wheels-cpu-linux.yml | New workflow to build CPU-only wheels on Linux (OpenBLAS) across a Python-version matrix and publish to a release. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| - name: Get Current Date | ||
| id: get-date | ||
| run: | | ||
| $currentDate = Get-Date -UFormat "%Y%m%d" | ||
| Write-Output "BUILD_DATE=$currentDate" >> $env:GITHUB_ENV | ||
|
|
||
| - name: Create Git Tag | ||
| run: | | ||
| git config user.name "github-actions" | ||
| git config user.email "github-actions@github.com" | ||
| git tag "v${{ env.TAG_VERSION }}-cpu-${{ env.AVXVER }}-win-${{ env.BUILD_DATE }}" | ||
| git push origin "v${{ env.TAG_VERSION }}-cpu-${{ env.AVXVER }}-win-${{ env.BUILD_DATE }}" | ||
|
|
||
| - name: Create Release | ||
| if: always() && env.TAG_VERSION != '' | ||
| uses: softprops/action-gh-release@v2 | ||
| with: | ||
| files: dist/* |
There was a problem hiding this comment.
The Create Git Tag step will deterministically conflict in the current matrix setup: each Python-version job tries to create and push the exact same tag (v<TAG_VERSION>-cpu-<AVXVER>-win-<BUILD_DATE>). The first job to push will win; subsequent jobs will fail (and a workflow re-run on the same day/version will also fail because the tag already exists). Prefer removing the manual git tag/git push and letting softprops/action-gh-release manage the tag, or gate tag/release creation to a single matrix entry and use artifacts + a separate release job to publish all wheels under one tag/release.
| - name: Get Current Date | |
| id: get-date | |
| run: | | |
| $currentDate = Get-Date -UFormat "%Y%m%d" | |
| Write-Output "BUILD_DATE=$currentDate" >> $env:GITHUB_ENV | |
| - name: Create Git Tag | |
| run: | | |
| git config user.name "github-actions" | |
| git config user.email "github-actions@github.com" | |
| git tag "v${{ env.TAG_VERSION }}-cpu-${{ env.AVXVER }}-win-${{ env.BUILD_DATE }}" | |
| git push origin "v${{ env.TAG_VERSION }}-cpu-${{ env.AVXVER }}-win-${{ env.BUILD_DATE }}" | |
| - name: Create Release | |
| if: always() && env.TAG_VERSION != '' | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: dist/* | |
| - name: Upload Built Wheels | |
| if: always() && env.TAG_VERSION != '' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: wheels-${{ matrix.pyver }}-${{ matrix.releasetag }} | |
| path: dist/* | |
| if-no-files-found: error | |
| release: | |
| name: Create Windows CPU Release | |
| needs: build_wheels | |
| runs-on: windows-2022 | |
| defaults: | |
| run: | |
| shell: pwsh | |
| env: | |
| AVXVER: Basic | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| submodules: "recursive" | |
| - name: Download Built Wheels | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: dist | |
| pattern: wheels-* | |
| merge-multiple: true | |
| - name: Get Package Version | |
| run: | | |
| $version = (Select-String -Path "setup.py" -Pattern 'version\s*=\s*"([^"]+)"').Matches[0].Groups[1].Value | |
| Write-Output "TAG_VERSION=$version" >> $env:GITHUB_ENV | |
| - name: Get Current Date | |
| run: | | |
| $currentDate = Get-Date -UFormat "%Y%m%d" | |
| Write-Output "BUILD_DATE=$currentDate" >> $env:GITHUB_ENV | |
| - name: Create Release | |
| if: always() && env.TAG_VERSION != '' | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: dist/**/* |
| - name: Create Git Tag | ||
| run: | | ||
| git config user.name "github-actions" | ||
| git config user.email "github-actions@github.com" | ||
| git tag "v${{ env.TAG_VERSION }}-cpu-${{ env.AVXVER }}-linux-${{ env.BUILD_DATE }}" | ||
| git push origin "v${{ env.TAG_VERSION }}-cpu-${{ env.AVXVER }}-linux-${{ env.BUILD_DATE }}" | ||
|
|
There was a problem hiding this comment.
The Create Git Tag step will conflict with the job matrix: every Python-version run will attempt to create/push the same tag (v<TAG_VERSION>-cpu-<AVXVER>-linux-<BUILD_DATE>). This will cause the later matrix jobs to fail, and re-running the workflow on the same day/version will also fail if the tag already exists. Consider removing the explicit git tag/git push and relying on softprops/action-gh-release to create/update the tag, or gate tag/release creation to a single matrix entry and publish all wheels from a dedicated release job that downloads artifacts from the build matrix.
| - name: Create Git Tag | |
| run: | | |
| git config user.name "github-actions" | |
| git config user.email "github-actions@github.com" | |
| git tag "v${{ env.TAG_VERSION }}-cpu-${{ env.AVXVER }}-linux-${{ env.BUILD_DATE }}" | |
| git push origin "v${{ env.TAG_VERSION }}-cpu-${{ env.AVXVER }}-linux-${{ env.BUILD_DATE }}" |
|
Hi, Thank you very much for your submission. |
Add GitHub Actions workflows for CPU-only Python wheels.