-
Notifications
You must be signed in to change notification settings - Fork 53
Refactor GitHub Actions workflows for package building and publishing #256
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
9de97cd
604d0a0
5d2d5e9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,52 +1,57 @@ | ||
| name: Build wheels | ||
| name: Build package artifacts | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| runs-on: | ||
| description: "The runner to use for the build" | ||
| required: true | ||
| type: string | ||
| default: ubuntu-22.04 | ||
| python-version: | ||
| description: "The Python version to use for the build" | ||
| required: true | ||
| type: string | ||
| cuda-version: | ||
| description: "The CUDA version to use for the build" | ||
| required: true | ||
| type: string | ||
| torch-version: | ||
| description: "The PyTorch version to use for the build" | ||
| required: true | ||
| type: string | ||
| cxx11_abi: | ||
| description: "Enable torch flag C++11 ABI (TRUE/FALSE)" | ||
| required: true | ||
| required: false | ||
| type: string | ||
| default: "3.10" | ||
| upload-to-release: | ||
| description: "Upload wheel to this release" | ||
| description: "Upload artifacts to this release" | ||
| required: false | ||
| type: boolean | ||
| default: false | ||
| release-version: | ||
| description: "Upload wheel to this release" | ||
| required: false | ||
| type: string | ||
| arch: | ||
| description: "Target a single compute capability. Leave empty to use project default" | ||
| description: "Release tag to upload artifacts to" | ||
| required: false | ||
| type: string | ||
|
|
||
| jobs: | ||
| build-wheels: | ||
| uses: ./.github/workflows/_build.yml | ||
| with: | ||
| runs-on: ${{ inputs.runs-on }} | ||
| python-version: ${{ inputs.python-version }} | ||
| cuda-version: ${{ inputs.cuda-version }} | ||
| torch-version: ${{ inputs.torch-version }} | ||
| cxx11_abi: ${{ inputs.cxx11_abi }} | ||
| upload-to-release: ${{ inputs.upload-to-release }} | ||
| release-version: ${{ inputs.release-version }} | ||
| arch: ${{ inputs.arch }} | ||
| build-package: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| ref: ${{ inputs.release-version || github.ref }} | ||
|
|
||
| - name: Set up Python | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: ${{ inputs.python-version }} | ||
|
|
||
| - name: Install build dependencies | ||
| run: | | ||
| python -m pip install --upgrade pip | ||
| pip install build | ||
|
|
||
| - name: Build sdist and wheel | ||
| run: python -m build | ||
|
|
||
| - name: List built artifacts | ||
| run: ls -l dist | ||
|
|
||
| - name: Upload workflow artifacts | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: package-artifacts | ||
| path: dist/* | ||
|
|
||
| - name: Upload release assets | ||
| if: inputs.upload-to-release && inputs.release-version != '' | ||
| uses: softprops/action-gh-release@v2 | ||
| with: | ||
| tag_name: ${{ inputs.release-version }} | ||
| files: dist/* | ||
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -32,15 +32,12 @@ jobs: | |||||||||
|
|
||||||||||
| - name: Install dependencies | ||||||||||
| run: | | ||||||||||
| pip install ninja packaging wheel twine | ||||||||||
| pip install setuptools==75.8.0 | ||||||||||
| pip install torch --index-url https://download.pytorch.org/whl/cpu | ||||||||||
| python -m pip install --upgrade pip | ||||||||||
| pip install build twine | ||||||||||
|
|
||||||||||
| - name: Build core package | ||||||||||
| env: | ||||||||||
| FLASH_SPARSE_ATTENTION_SKIP_CUDA_BUILD: "TRUE" | ||||||||||
| - name: Build package artifacts | ||||||||||
|
||||||||||
| - name: Build package artifacts | |
| - name: Build package artifacts | |
| env: | |
| FLASH_SPARSE_ATTENTION_SKIP_CUDA_BUILD: "TRUE" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The condition
inputs.release-version != ''can behave unexpectedly if the input is unset (GitHub Actions inputs can benulldepending on the trigger), which may allow this step to run with an empty/invalidtag_name. Prefer a truthiness check such asif: inputs.upload-to-release && inputs.release-version(or explicitly guard both!= ''and!= null) to ensure a valid tag is always provided when uploading release assets.