"docs/source/vscode:/vscode.git/clone" did not exist on "cbaedda7ec67974547da3d6292d7fc5815911fe6"
Unverified Commit 8401d290 authored by Muyang Li's avatar Muyang Li Committed by GitHub
Browse files

chore: update the workflows (#416)

parent e4956c81
name: Clean Nightly Releases name: Clean Old Nightly Releases
on: on:
# schedule: schedule:
# - cron: '0 3 * * *' # Runs daily at 03:00 UTC - cron: '* 6 * * *'
workflow_dispatch: # Allows manual triggering workflow_dispatch:
permissions:
contents: write
jobs: jobs:
clean-nightly: cleanup:
name: Delete old nightly releases and tags
runs-on: ubuntu-latest runs-on: ubuntu-latest
permissions:
contents: write
packages: write
steps: steps:
- name: Set up GitHub CLI - name: List all nightly releases
uses: cli/cli-action@v2 id: list
run: |
gh release list --limit 100 --json tagName,isPrerelease,publishedAt \
--jq '.[] | select(.isPrerelease == true) | .tagName' > nightly_tags.txt
echo "Found $(wc -l < nightly_tags.txt) nightly releases."
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Authenticate GitHub CLI - name: Trim to old tags beyond latest 30
run: echo "${{ secrets.GITHUB_TOKEN }}" | gh auth login --with-token id: filter
run: |
tail -n +31 nightly_tags.txt > to_delete.txt || true
echo "Tags to delete:"
cat to_delete.txt || echo "(none)"
- name: Get and clean old nightly releases - name: Delete releases and tags
env:
GH_REPO: ${{ github.repository }}
run: | run: |
# Get all release titles that match the nightly pattern while read tag; do
mapfile -t releases < <( echo "Deleting release and tag: $tag"
gh release list --limit 1000 --json tagName,name,createdAt --jq ' gh release delete "$tag" -y || true
sort_by(.createdAt) | reverse | git push origin --delete "$tag" || true
map(select(.name | test("^Nunchaku Nightly v[0-9]+\\.[0-9]+\\.[0-9]+dev[0-9]{8}$"))) | done < to_delete.txt
map(.tagName)' env:
) GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Keep only the first 5 (latest), delete the rest - name: Done
if (( ${#releases[@]} > 5 )); then run: echo "Nightly cleanup completed."
for tag in "${releases[@]:5}"; do
echo "Deleting old release: $tag"
gh release delete "$tag" --yes
done
else
echo "Less than or equal to 5 nightly releases found. No cleanup needed."
fi
...@@ -10,7 +10,7 @@ permissions: ...@@ -10,7 +10,7 @@ permissions:
jobs: jobs:
tag: tag:
name: Tag Dev Branch if dev version name: Tag dev branch if dev version
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: github.repository == 'mit-han-lab/nunchaku' if: github.repository == 'mit-han-lab/nunchaku'
outputs: outputs:
...@@ -95,10 +95,8 @@ jobs: ...@@ -95,10 +95,8 @@ jobs:
if: needs.tag.outputs.need_build == 'true' && github.repository == 'mit-han-lab/nunchaku' if: needs.tag.outputs.need_build == 'true' && github.repository == 'mit-han-lab/nunchaku'
strategy: strategy:
matrix: matrix:
# python: ["3.10", "3.11", "3.12"] python: ["3.10", "3.11", "3.12"]
# torch: ["2.5", "2.6", "2.7"] torch: ["2.5", "2.6", "2.7"]
python: ["3.12"]
torch: ["2.7"]
steps: steps:
- name: Checkout to the tag - name: Checkout to the tag
...@@ -141,10 +139,8 @@ jobs: ...@@ -141,10 +139,8 @@ jobs:
if: needs.tag.outputs.need_build == 'true' && github.repository == 'mit-han-lab/nunchaku' if: needs.tag.outputs.need_build == 'true' && github.repository == 'mit-han-lab/nunchaku'
strategy: strategy:
matrix: matrix:
# python: [ "3.10", "3.11", "3.12" ] python: [ "3.10", "3.11", "3.12" ]
# torch: [ "2.5", "2.6", "2.7" ] torch: [ "2.5", "2.6", "2.7" ]
python: [ "3.10" ]
torch: [ "2.7" ]
steps: steps:
- name: Checkout to the tag - name: Checkout to the tag
......
name: Release Build
on:
workflow_dispatch:
permissions:
contents: write
jobs:
release:
name: Tag Main Branch and Create Release
runs-on: ubuntu-latest
if: github.repository == 'mit-han-lab/nunchaku'
outputs:
tag_name: ${{ steps.tag.outputs.tag_name }}
steps:
- name: Checkout main branch
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: main
- name: Extract version from __version__.py
id: version
run: |
version=$(grep '__version__' nunchaku/__version__.py | sed -E 's/.*"([^"]+)".*/\1/')
echo "Extracted version: $version"
echo "version=$version" >> "$GITHUB_OUTPUT"
- name: Create and push tag
id: tag
run: |
tag_name="v${{ steps.version.outputs.version }}"
git config user.name "github-actions"
git config user.email "github-actions@users.noreply.github.com"
git tag $tag_name
git push origin $tag_name
echo "tag_name=$tag_name" >> "$GITHUB_OUTPUT"
linux-wheels:
name: Build the linux release wheels
runs-on: [self-hosted, linux-build]
needs: release
strategy:
matrix:
python: ["3.10", "3.11", "3.12"]
torch: ["2.5", "2.6", "2.7"]
steps:
- name: Checkout to the tag
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ needs.release.outputs.tag_name }}
submodules: true
- name: Show current commit
run: git log -1 --oneline
- name: Build wheels
run: |
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
with:
files: dist/*.whl
name: Nunchaku ${{ needs.release.outputs.tag_name }}
tag_name: ${{ needs.release.outputs.tag_name }}
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Clean up
if: always()
run: bash scripts/linux_cleanup.sh
windows-wheels:
name: Build the windows release wheels
runs-on: [ self-hosted, windows-build ]
needs: release
strategy:
matrix:
python: [ "3.10", "3.11", "3.12" ]
torch: [ "2.5", "2.6", "2.7" ]
steps:
- name: Checkout to the tag
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ needs.release.outputs.tag_name }}
submodules: true
- name: Show current commit
run: git log -1 --oneline
- name: Build wheels
shell: cmd
run: |
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
with:
files: dist/*.whl
name: Nunchaku ${{ needs.release.outputs.tag_name }}
tag_name: ${{ needs.release.outputs.tag_name }}
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
...@@ -166,12 +166,8 @@ jobs: ...@@ -166,12 +166,8 @@ jobs:
which python which python
NUNCHAKU_TEST_CACHE_ROOT=${{ secrets.NUNCHAKU_TEST_CACHE_ROOT_AMPERE }} HF_TOKEN=${{ secrets.HF_TOKEN }} pytest -v tests/sana NUNCHAKU_TEST_CACHE_ROOT=${{ secrets.NUNCHAKU_TEST_CACHE_ROOT_AMPERE }} HF_TOKEN=${{ secrets.HF_TOKEN }} pytest -v tests/sana
clean-up: - name: clean up
if: always() && (github.event_name != 'issue_comment' || needs.check-comment.outputs.should_run == 'true') if: always() && (github.event_name != 'issue_comment' || needs.check-comment.outputs.should_run == 'true')
needs: [ run-tests ]
runs-on: [ self-hosted, ampere ]
steps:
- name: Clean up
run: | run: |
cd .. cd ..
rm -rf *nunchaku* *ComfyUI* rm -rf ComfyUI
...@@ -166,12 +166,8 @@ jobs: ...@@ -166,12 +166,8 @@ jobs:
which python which python
NUNCHAKU_TEST_CACHE_ROOT=${{ secrets.NUNCHAKU_TEST_CACHE_ROOT_BLACKWELL }} HF_TOKEN=${{ secrets.HF_TOKEN }} pytest -v tests/sana NUNCHAKU_TEST_CACHE_ROOT=${{ secrets.NUNCHAKU_TEST_CACHE_ROOT_BLACKWELL }} HF_TOKEN=${{ secrets.HF_TOKEN }} pytest -v tests/sana
clean-up: - name: clean up
if: always() && (github.event_name != 'issue_comment' || needs.check-comment.outputs.should_run == 'true') if: always() && (github.event_name != 'issue_comment' || needs.check-comment.outputs.should_run == 'true')
needs: [ run-tests ]
runs-on: [ self-hosted, blackwell ]
steps:
- name: Clean up
run: | run: |
cd .. cd ..
rm -rf *nunchaku* *ComfyUI* rm -rf ComfyUI
\ No newline at end of file
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