Files
flash-attention-prebuild-wh…/.github/workflows/build.yml
T
Junya Morioka 2f3b1245f7 refactor: consolidate self-hosted workflows with auto-detection
- Merge _build_manylinux_self_host.yml into _build_linux_self_host.yml
- Add automatic package manager detection (apt-get/dnf) for both x86_64 and ARM64
- Add environment check steps to all self-hosted workflows
- Update build.yml to use unified workflow with container-image parameter
- Remove duplicate build_wheels_manylinux_self_hosted job
- Update test workflows to use consolidated workflow
- Remove manylinux_self_hosted matrix configuration
- Set manylinux container image for ARM64 test workflow
2025-12-21 04:06:56 +09:00

244 lines
9.8 KiB
YAML

name: Build wheels and upload to GitHub Releases
on:
push:
tags:
- "v*"
jobs:
create_releases:
name: Create Releases
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Create Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create "${{ github.ref_name }}" \
--title "${{ github.ref_name }}" \
--notes "TBD"
create_matrix:
name: Create Matrix
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.create_matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v4
- name: Create Matrix
id: create_matrix
run: |
python create_matrix.py | tee /tmp/matrix.json
echo "matrix=$(cat /tmp/matrix.json)" >> $GITHUB_OUTPUT
# #########################################################
# Linux
# #########################################################
# ################ GitHub-hosted runner ################
build_wheels_linux:
name: Build Linux x86_64
needs: [create_releases, create_matrix]
if: ${{ fromjson(needs.create_matrix.outputs.matrix).linux }}
strategy:
fail-fast: false
matrix:
flash-attn-version: ${{ fromjson(needs.create_matrix.outputs.matrix).linux.flash-attn-version }}
python-version: ${{ fromjson(needs.create_matrix.outputs.matrix).linux.python-version }}
torch-version: ${{ fromjson(needs.create_matrix.outputs.matrix).linux.torch-version }}
cuda-version: ${{ fromjson(needs.create_matrix.outputs.matrix).linux.cuda-version }}
exclude: ${{ fromjson(needs.create_matrix.outputs.matrix).exclude }}
uses: ./.github/workflows/_build_linux.yml
with:
flash-attn-version: ${{ matrix.flash-attn-version }}
python-version: ${{ matrix.python-version }}
torch-version: ${{ matrix.torch-version }}
cuda-version: ${{ matrix.cuda-version }}
secrets: inherit
build_wheels_linux_arm64:
name: Build Linux ARM64
needs: [create_releases, create_matrix]
if: ${{ fromjson(needs.create_matrix.outputs.matrix).linux_arm64 }}
strategy:
fail-fast: false
matrix:
flash-attn-version: ${{ fromjson(needs.create_matrix.outputs.matrix).linux_arm64.flash-attn-version }}
python-version: ${{ fromjson(needs.create_matrix.outputs.matrix).linux_arm64.python-version }}
torch-version: ${{ fromjson(needs.create_matrix.outputs.matrix).linux_arm64.torch-version }}
cuda-version: ${{ fromjson(needs.create_matrix.outputs.matrix).linux_arm64.cuda-version }}
exclude: ${{ fromjson(needs.create_matrix.outputs.matrix).exclude }}
uses: ./.github/workflows/_build_linux.yml
with:
flash-attn-version: ${{ matrix.flash-attn-version }}
python-version: ${{ matrix.python-version }}
torch-version: ${{ matrix.torch-version }}
cuda-version: ${{ matrix.cuda-version }}
runner: "ubuntu-22.04-arm"
secrets: inherit
# ################ Self-hosted runner ################
build_wheels_linux_self_hosted:
name: Build Linux (self-hosted)
needs: [create_releases, create_matrix]
if: ${{ fromjson(needs.create_matrix.outputs.matrix).linux_self_hosted }}
strategy:
fail-fast: false
matrix:
flash-attn-version: ${{ fromjson(needs.create_matrix.outputs.matrix).linux_self_hosted.flash-attn-version }}
python-version: ${{ fromjson(needs.create_matrix.outputs.matrix).linux_self_hosted.python-version }}
torch-version: ${{ fromjson(needs.create_matrix.outputs.matrix).linux_self_hosted.torch-version }}
cuda-version: ${{ fromjson(needs.create_matrix.outputs.matrix).linux_self_hosted.cuda-version }}
exclude: ${{ fromjson(needs.create_matrix.outputs.matrix).exclude }}
uses: ./.github/workflows/_build_linux_self_host.yml
with:
flash-attn-version: ${{ matrix.flash-attn-version }}
python-version: ${{ matrix.python-version }}
torch-version: ${{ matrix.torch-version }}
cuda-version: ${{ matrix.cuda-version }}
runner: '["self-hosted", "x64"]'
container-image: "quay.io/pypa/manylinux_2_28_x86_64"
secrets: inherit
build_wheels_linux_arm64_self_hosted:
name: Build Linux ARM64 (self-hosted)
needs: [create_releases, create_matrix]
if: ${{ fromjson(needs.create_matrix.outputs.matrix).linux_arm64_self_hosted }}
strategy:
fail-fast: false
matrix:
flash-attn-version: ${{ fromjson(needs.create_matrix.outputs.matrix).linux_arm64_self_hosted.flash-attn-version }}
python-version: ${{ fromjson(needs.create_matrix.outputs.matrix).linux_arm64_self_hosted.python-version }}
torch-version: ${{ fromjson(needs.create_matrix.outputs.matrix).linux_arm64_self_hosted.torch-version }}
cuda-version: ${{ fromjson(needs.create_matrix.outputs.matrix).linux_arm64_self_hosted.cuda-version }}
exclude: ${{ fromjson(needs.create_matrix.outputs.matrix).exclude }}
uses: ./.github/workflows/_build_linux_arm_self_host.yml
with:
flash-attn-version: ${{ matrix.flash-attn-version }}
python-version: ${{ matrix.python-version }}
torch-version: ${{ matrix.torch-version }}
cuda-version: ${{ matrix.cuda-version }}
runner: '["self-hosted-arm", "arm64"]'
container-image: "quay.io/pypa/manylinux_2_28_aarch64"
secrets: inherit
# #########################################################
# Windows
# #########################################################
build_wheels_windows:
name: Build Windows
needs: [create_releases, create_matrix]
if: ${{ fromjson(needs.create_matrix.outputs.matrix).windows }}
strategy:
fail-fast: false
matrix:
flash-attn-version: ${{ fromjson(needs.create_matrix.outputs.matrix).windows.flash-attn-version }}
python-version: ${{ fromjson(needs.create_matrix.outputs.matrix).windows.python-version }}
torch-version: ${{ fromjson(needs.create_matrix.outputs.matrix).windows.torch-version }}
cuda-version: ${{ fromjson(needs.create_matrix.outputs.matrix).windows.cuda-version }}
exclude: ${{ fromjson(needs.create_matrix.outputs.matrix).exclude }}
uses: ./.github/workflows/_build_windows.yml
with:
flash-attn-version: ${{ matrix.flash-attn-version }}
python-version: ${{ matrix.python-version }}
torch-version: ${{ matrix.torch-version }}
cuda-version: ${{ matrix.cuda-version }}
secrets: inherit
build_wheels_windows_code_build:
name: Build Windows (AWS CodeBuild)
needs: [create_releases, create_matrix]
if: ${{ fromjson(needs.create_matrix.outputs.matrix).windows_code_build }}
strategy:
fail-fast: false
matrix:
flash-attn-version: ${{ fromjson(needs.create_matrix.outputs.matrix).windows_code_build.flash-attn-version }}
python-version: ${{ fromjson(needs.create_matrix.outputs.matrix).windows_code_build.python-version }}
torch-version: ${{ fromjson(needs.create_matrix.outputs.matrix).windows_code_build.torch-version }}
cuda-version: ${{ fromjson(needs.create_matrix.outputs.matrix).windows_code_build.cuda-version }}
exclude: ${{ fromjson(needs.create_matrix.outputs.matrix).exclude }}
uses: ./.github/workflows/_build_windows_code_build.yml
with:
flash-attn-version: ${{ matrix.flash-attn-version }}
python-version: ${{ matrix.python-version }}
torch-version: ${{ matrix.torch-version }}
cuda-version: ${{ matrix.cuda-version }}
secrets: inherit
update_release_notes:
name: Update Release Notes
needs:
- build_wheels_linux
- build_wheels_linux_arm64
- build_wheels_linux_self_hosted
- build_wheels_linux_arm64_self_hosted
- build_wheels_windows
- build_wheels_windows_code_build
if: always()
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.14
- name: Install dependencies
run: pip install pandas
- name: Generate Release Notes
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release view "${{ github.ref_name }}" --json assets > /tmp/assets.json
python create_release_note.py /tmp/assets.json > /tmp/release_notes.md
gh release edit "${{ github.ref_name }}" --notes-file /tmp/release_notes.md
update_docs:
name: Update Docs
needs:
- build_wheels_linux
- build_wheels_linux_arm64
- build_wheels_linux_self_hosted
- build_wheels_linux_arm64_self_hosted
- build_wheels_windows
- build_wheels_windows_code_build
permissions:
contents: write
if: always()
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.14
- name: Install dependencies
run: pip install pandas
- name: Update docs
run: |
gh release view "${{ github.ref_name }}" --json assets > /tmp/assets.json
python create_release_history.py \
--assets /tmp/assets.json \
--tag "${{ github.ref_name }}" \
--repo "${{ github.repository }}" \
--output docs/release_history.md
python create_packages.py --assets /tmp/assets.json --output docs/packages.md
- name: Commit and push docs updates
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
if git diff --quiet; then
echo "No docs updates to commit."
exit 0
fi
git commit -am "docs: update docs for ${{ github.ref_name }}"
git push origin HEAD:"${DEFAULT_BRANCH}"