diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 099059d..99c7666 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -19,71 +19,34 @@ jobs: --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 # ######################################################### build_wheels_linux: name: Build Linux - needs: create_releases + needs: [create_releases, create_matrix] + if: ${{ fromjson(needs.create_matrix.outputs.matrix).linux }} strategy: fail-fast: false matrix: - flash-attn-version: - - "2.6.3" - - "2.7.4.post1" - - "2.8.3" - python-version: - # - "3.9" - - "3.10" - - "3.11" - - "3.12" - - "3.13" - torch-version: - # - "2.5.1" - # - "2.6.0" - # - "2.7.1" - # - "2.8.0" - - "2.9.0" - # https://developer.nvidia.com/cuda-toolkit-archive - cuda-version: - # - "12.4.1" - # - "12.6.3" - # - "12.8.1" - # - "12.9.1" - - "13.0.1" - exclude: - # torch < 2.2 does not support Python 3.12 - - python-version: "3.12" - torch-version: "2.0.1" - - python-version: "3.12" - torch-version: "2.1.2" - # torch 2.0.1 does not support CUDA 12.x - - torch-version: "2.0.1" - cuda-version: "12.1.1" - - torch-version: "2.0.1" - cuda-version: "12.4.1" - - torch-version: "2.0.1" - cuda-version: "12.6.3" - - torch-version: "2.0.1" - cuda-version: "12.8.1" - # torch 2.6.0 does not support CUDA 12.1 - - torch-version: "2.6.0" - cuda-version: "12.1.1" - # torch 2.7.0 does not support CUDA 12.4 - - torch-version: "2.7.0" - cuda-version: "12.4.1" - # torch < 2.8 does not support CUDA 12.9 - - torch-version: "2.5.1" - cuda-version: "12.9.1" - - torch-version: "2.6.3" - cuda-version: "12.9.1" - - torch-version: "2.7.1" - cuda-version: "12.9.1" - # flash-attn 2.7.4 does not build in GitHub Hosted Runner - - flash-attn-version: "2.7.4" - # torch >= 2.9 does not support Python 3.9 - - torch-version: "2.9.0" - python-version: "3.9" + 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 }} @@ -92,159 +55,76 @@ jobs: cuda-version: ${{ matrix.cuda-version }} secrets: inherit - # build_wheels_linux_self_hosted: - # name: Build Linux (self-hosted) - # needs: create_releases - # strategy: - # fail-fast: false - # matrix: - # flash-attn-version: ["2.8.3"] - # python-version: ["3.10", "3.11", "3.12"] - # torch-version: ["2.5.1", "2.6.0", "2.7.1", "2.8.0"] - # # https://developer.nvidia.com/cuda-toolkit-archive - # cuda-version: ["12.4.1", "12.8.1", "12.9.1"] - # exclude: - # # torch < 2.2 does not support Python 3.12 - # - python-version: "3.12" - # torch-version: "2.0.1" - # - python-version: "3.12" - # torch-version: "2.1.2" - # # torch 2.0.1 does not support CUDA 12.x - # - torch-version: "2.0.1" - # cuda-version: "12.1.1" - # - torch-version: "2.0.1" - # cuda-version: "12.4.1" - # - torch-version: "2.0.1" - # cuda-version: "12.6.3" - # - torch-version: "2.0.1" - # cuda-version: "12.8.1" - # # torch 2.6.0 does not support CUDA 12.1 - # - torch-version: "2.6.0" - # cuda-version: "12.1.1" - # # torch 2.7.0 does not support CUDA 12.4 - # - torch-version: "2.7.0" - # cuda-version: "12.4.1" - # # torch < 2.8 does not support CUDA 12.9 - # - torch-version: "2.5.1" - # cuda-version: "12.9.1" - # - torch-version: "2.6.3" - # cuda-version: "12.9.1" - # - torch-version: "2.7.1" - # cuda-version: "12.9.1" - # 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 }} - # secrets: inherit + 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 }} + secrets: inherit # ######################################################### # Windows # ######################################################### - # build_wheels_windows: - # name: Build Windows - # needs: create_releases - # strategy: - # fail-fast: false - # matrix: - # flash-attn-version: ["2.8.3"] - # python-version: ["3.11", "3.12", "3.13"] - # torch-version: ["2.9.0.dev20250909"] - # # https://developer.nvidia.com/cuda-toolkit-archive - # cuda-version: ["12.6.3", "12.8.1"] - # exclude: - # # torch < 2.2 does not support Python 3.12 - # - python-version: "3.12" - # torch-version: "2.0.1" - # - python-version: "3.12" - # torch-version: "2.1.2" - # # torch 2.0.1 does not support CUDA 12.x - # - torch-version: "2.0.1" - # cuda-version: "12.1.1" - # - torch-version: "2.0.1" - # cuda-version: "12.4.1" - # - torch-version: "2.0.1" - # cuda-version: "12.6.3" - # - torch-version: "2.0.1" - # cuda-version: "12.8.1" - # # torch 2.6.0 does not support CUDA 12.1 - # - torch-version: "2.6.0" - # cuda-version: "12.1.1" - # # torch 2.7.0 does not support CUDA 12.4 - # - torch-version: "2.7.0" - # cuda-version: "12.4.1" - # # torch < 2.8 does not support CUDA 12.9 - # - torch-version: "2.5.1" - # cuda-version: "12.9.1" - # - torch-version: "2.6.3" - # cuda-version: "12.9.1" - # - torch-version: "2.7.1" - # cuda-version: "12.9.1" - # 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: + 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 - # strategy: - # fail-fast: false - # matrix: - # flash-attn-version: ["2.7.4", "2.8.2"] - # python-version: ["3.10", "3.11", "3.12"] - # torch-version: ["2.7.1", "2.8.0"] - # # https://developer.nvidia.com/cuda-toolkit-archive - # cuda-version: ["12.8.1"] - # exclude: - # # torch < 2.2 does not support Python 3.12 - # - python-version: "3.12" - # torch-version: "2.0.1" - # - python-version: "3.12" - # torch-version: "2.1.2" - # # torch 2.0.1 does not support CUDA 12.x - # - torch-version: "2.0.1" - # cuda-version: "12.1.1" - # - torch-version: "2.0.1" - # cuda-version: "12.4.1" - # - torch-version: "2.0.1" - # cuda-version: "12.6.3" - # - torch-version: "2.0.1" - # cuda-version: "12.8.1" - # # torch 2.6.0 does not support CUDA 12.1 - # - torch-version: "2.6.0" - # cuda-version: "12.1.1" - # # torch 2.7.0 does not support CUDA 12.4 - # - torch-version: "2.7.0" - # cuda-version: "12.4.1" - # # torch < 2.8 does not support CUDA 12.9 - # - torch-version: "2.5.1" - # cuda-version: "12.9.1" - # - torch-version: "2.6.3" - # cuda-version: "12.9.1" - # - torch-version: "2.7.1" - # cuda-version: "12.9.1" - # 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 + 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_self_hosted - # - build_wheels_windows - # - build_wheels_windows_code_build - permissions: - contents: write + - build_wheels_linux_self_hosted + - build_wheels_windows + - build_wheels_windows_code_build if: always() runs-on: ubuntu-latest steps: @@ -265,17 +145,22 @@ jobs: python create_release_note.py /tmp/assets.json > /tmp/release_notes.md gh release edit "${{ github.ref_name }}" --notes-file /tmp/release_notes.md - - name: Update README history and packages - run: | - cat /tmp/release_notes.md | python insert_history.py \ - --notes - \ - --tag "${{ github.ref_name }}" \ - --repo "${{ github.repository }}" - python generate_packages_table.py --update-readme - + update_readme: + name: Update README + needs: + - build_wheels_linux + - build_wheels_linux_self_hosted + - build_wheels_windows + - build_wheels_windows_code_build + permissions: + contents: write + if: always() + runs-on: ubuntu-latest + env: + DEFAULT_BRANCH: ${{ github.event.repository.default_branch }} + steps: + - uses: actions/checkout@v4 - name: Commit and push README updates - env: - DEFAULT_BRANCH: ${{ github.event.repository.default_branch }} run: | git config --global user.name "github-actions[bot]" git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" @@ -285,3 +170,12 @@ jobs: fi git commit -am "docs: update README for ${{ github.ref_name }}" git push origin HEAD:"${DEFAULT_BRANCH}" + + - name: Update README history and packages + run: | + gh release view "${{ github.ref_name }}" --json assets > /tmp/assets.json + python insert_history_to_readme.py \ + --assets /tmp/assets.json \ + --tag "${{ github.ref_name }}" \ + --repo "${{ github.repository }}" + python insert_packages_to_readme.py --update