Unverified Commit e4956c81 authored by Muyang Li's avatar Muyang Li Committed by GitHub
Browse files

chore: better nightly build (#414)

* update nightly-build.yaml

* use matrix for building

* chore: upgrade the nightly-build.yaml

* chore: start debugging the workflow

* start debugging

* better nightly build
parent 5a47351b
......@@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-latest
if: github.repository == 'mit-han-lab/nunchaku'
outputs:
is_dev: ${{ steps.check.outputs.is_dev }}
need_build: ${{ steps.check.outputs.need_build }}
tag_name: ${{ steps.tag.outputs.tag_name }}
steps:
- name: Checkout dev branch
......@@ -34,14 +34,42 @@ jobs:
id: check
run: |
if [[ "${{ steps.version.outputs.version }}" == *dev* ]]; then
echo "is_dev=true" >> "$GITHUB_OUTPUT"
echo "need_build=true" >> "$GITHUB_OUTPUT"
else
echo "is_dev=false" >> "$GITHUB_OUTPUT"
echo "need_build=false" >> "$GITHUB_OUTPUT"
fi
- name: Get latest tag with same version prefix
id: last_tag
if: steps.check.outputs.need_build == 'true'
run: |
prefix="v${{ steps.version.outputs.version }}"
tag=$(git tag --list "${prefix}*" --sort=-creatordate | head -n 1 || echo "")
echo "latest_tag=$tag" >> "$GITHUB_OUTPUT"
- name: Check if current commit is new
id: check_commit_diff
if: steps.check.outputs.need_build == 'true'
run: |
tag=${{ steps.last_tag.outputs.latest_tag }}
if [ -z "$tag" ]; then
echo "No previous tag found."
echo "need_build=true" >> "$GITHUB_OUTPUT"
else
base=$(git rev-parse "$tag")
head=$(git rev-parse HEAD)
if [ "$base" = "$head" ]; then
echo "No new commits since $tag"
echo "need_build=false" >> "$GITHUB_OUTPUT"
else
echo "New commits found since $tag"
echo "need_build=true" >> "$GITHUB_OUTPUT"
fi
fi
- name: Set tag name
id: tag
if: steps.check.outputs.is_dev == 'true'
if: steps.check.outputs.need_build == 'true'
run: |
today=$(date -u +"%Y%m%d")
tag_name="v${{ steps.version.outputs.version }}$today"
......@@ -49,22 +77,29 @@ jobs:
echo "tag_name=$tag_name" >> "$GITHUB_OUTPUT"
- name: Create and push tag
if: steps.check.outputs.is_dev == 'true'
if: steps.check.outputs.need_build == 'true'
run: |
git config user.name "github-actions"
git config user.email "github-actions@users.noreply.github.com"
git tag ${{ steps.tag.outputs.tag_name }}
git push origin ${{ steps.tag.outputs.tag_name }}
- name: Skip tagging (version is not dev)
if: steps.check.outputs.is_dev == 'false'
- name: Skip tagging (version is not dev or no new commits)
if: steps.check.outputs.need_build == 'false'
run: echo "Version is not a dev version. Skipping tag."
linux-wheels:
name: Build the linux nightly wheels
runs-on: [self-hosted, linux-build]
needs: tag
if: needs.tag.outputs.is_dev == 'true' && github.repository == 'mit-han-lab/nunchaku'
if: needs.tag.outputs.need_build == 'true' && github.repository == 'mit-han-lab/nunchaku'
strategy:
matrix:
# python: ["3.10", "3.11", "3.12"]
# torch: ["2.5", "2.6", "2.7"]
python: ["3.12"]
torch: ["2.7"]
steps:
- name: Checkout to the tag
uses: actions/checkout@v4
......@@ -78,7 +113,12 @@ jobs:
- name: Build wheels
run: |
bash scripts/build_all_linux_wheels.sh
if [[ "${{ matrix.torch }}" == "2.7" ]]; then
cuda_version="12.8"
else
cuda_version="12.4"
fi
bash scripts/build_linux_wheel.sh ${{ matrix.python }} ${{ matrix.torch }} $cuda_version
- name: Upload wheels to GitHub Release
uses: softprops/action-gh-release@v2
......@@ -91,24 +131,21 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Clean up
if: always() && github.repository == 'mit-han-lab/nunchaku'
run: bash scripts/linux_cleanup.sh
linux-clean-up:
if: always() && github.repository == 'mit-han-lab/nunchaku'
needs: [ linux-wheels ]
runs-on: [ self-hosted, linux-build ]
steps:
- name: Clean up
run: |
cd ..
rm -rf *nunchaku*
windows-wheels:
name: Build the windows nightly wheels
runs-on: [self-hosted, windows-build]
runs-on: [ self-hosted, windows-build ]
needs: tag
if: needs.tag.outputs.is_dev == 'true' && github.repository == 'mit-han-lab/nunchaku'
if: needs.tag.outputs.need_build == 'true' && github.repository == 'mit-han-lab/nunchaku'
strategy:
matrix:
# python: [ "3.10", "3.11", "3.12" ]
# torch: [ "2.5", "2.6", "2.7" ]
python: [ "3.10" ]
torch: [ "2.7" ]
steps:
- name: Checkout to the tag
uses: actions/checkout@v4
......@@ -121,9 +158,16 @@ jobs:
run: git log -1 --oneline
- name: Build wheels
shell: cmd
run: |
C:\Users\muyang\miniconda3\condabin\activate.bat activate
scripts\build_all_windows_wheels.cmd
SET TORCH_VERSION=${{ matrix.torch }}
IF "%TORCH_VERSION%"=="2.7" (
SET CUDA_VERSION=12.8
) ELSE (
SET CUDA_VERSION=12.4
)
call C:\Users\muyangl\miniconda3\condabin\activate.bat activate
call scripts\build_windows_wheel.cmd ${{ matrix.python }} %TORCH_VERSION% %CUDA_VERSION%
- name: Upload wheels to GitHub Release
uses: softprops/action-gh-release@v2
......@@ -134,14 +178,3 @@ jobs:
prerelease: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
windows-clean-up:
if: always() && github.repository == 'mit-han-lab/nunchaku'
needs: [ windows-wheels ]
runs-on: [ self-hosted, windows-build ]
steps:
- name: Clean up
run: |
cd ..
powershell -Command "Remove-Item -Recurse -Force *nunchaku*"
name: Window Build Test
on:
workflow_dispatch:
inputs:
test_target:
description: 'What to test: "pr" or "branch"'
required: true
type: choice
options:
- pr
- branch
pr_number:
description: 'Pull Request Number (only if test_target == "pr")'
required: false
branch_name:
description: 'Branch name (only if test_target == "branch")'
default: 'main'
required: false
jobs:
windows-wheels:
name: Build the windows nightly wheels
runs-on: [self-hosted, windows-build]
steps:
- name: Checkout to the tag
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: dev
submodules: true
- name: Show current commit
run: git log -1 --oneline
- name: Build wheels
run: |
C:\Users\muyang\miniconda3\condabin\activate.bat activate
scripts\build_windows_wheel.cmd 3.10 2.7 12.8
# window-clean-up:
# if: always()
# needs: [ windows-wheels ]
# runs-on: [ self-hosted, windows-build ]
#
# steps:
# - name: Clean up
# run: |
# cd ..
# rm -rf *nunchaku*
......@@ -47,7 +47,6 @@ if exist build rd /s /q build
:: set up Visual Studio compilation environment
call "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\Common7\Tools\VsDevCmd.bat" -startdir=none -arch=x64 -host_arch=x64
set DISTUTILS_USE_SDK=1
set MAX_JOBS=4
:: build wheels
python -m build --wheel --no-isolation
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment