-
Notifications
You must be signed in to change notification settings - Fork 274
159 lines (159 loc) · 5.41 KB
/
Copy pathrelease-build.yaml
File metadata and controls
159 lines (159 loc) · 5.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
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 == 'nunchaku-tech/nunchaku'
outputs:
tag_name: ${{ steps.set-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 "version=$version" >> "$GITHUB_OUTPUT"
- name: Check if tag exists
id: check-tag
run: |
tag_name="v${{ steps.version.outputs.version }}"
if git rev-parse "$tag_name" >/dev/null 2>&1; then
echo "Tag $tag_name already exists."
echo "exists=true" >> "$GITHUB_OUTPUT"
else
echo "Tag $tag_name does not exist."
echo "exists=false" >> "$GITHUB_OUTPUT"
fi
- name: Create and push tag if not exists
if: steps.check-tag.outputs.exists == 'false'
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"
- name: Set tag_name output
id: set-tag
run: |
echo "tag_name=v${{ steps.version.outputs.version }}" >> "$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", "3.13"]
torch: ["2.5", "2.6", "2.7", "2.8", "2.9"]
exclude:
- python: "3.13"
torch: "2.5"
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" || "${{ matrix.torch }}" == "2.8" ]]; then
cuda_version="12.8"
else
cuda_version="12.4"
fi
if [[ "${{ matrix.torch }}" == "2.9" ]]; then
bash scripts/build_linux_wheel_torch_nightly.sh ${{ matrix.python }} ${{ matrix.torch }} 12.8
else
bash scripts/build_linux_wheel.sh ${{ matrix.python }} ${{ matrix.torch }} $cuda_version
fi
- 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: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Upload wheels to HuggingFace Hub
env:
HF_TOKEN: ${{ secrets.HF_WHEEL_UPLOAD_TOKEN }}
run: |
pip install huggingface_hub
for whl in dist/*.whl; do
hf upload nunchaku-tech/nunchaku "$whl"
done
- 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", "3.13"]
torch: ["2.5", "2.6", "2.7", "2.8", "2.9"]
exclude:
- python: "3.13"
torch: "2.5"
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 }}
SET PYTHON_VERSION=${{ matrix.python }}
IF "%TORCH_VERSION%"=="2.7" (
SET CUDA_VERSION=12.8
) ELSE IF "%TORCH_VERSION%"=="2.8" (
SET CUDA_VERSION=12.8
) ELSE (
SET CUDA_VERSION=12.4
)
call C:\Users\muyangl\miniconda3\condabin\activate.bat activate
IF "%TORCH_VERSION%"=="2.9" (
call scripts\build_windows_wheel_torch_nightly.cmd %PYTHON_VERSION% %TORCH_VERSION% %CUDA_VERSION%
) ELSE (
call scripts\build_windows_wheel.cmd %PYTHON_VERSION% %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 }}
- name: Upload wheels to HuggingFace Hub
shell: cmd
env:
HF_TOKEN: ${{ secrets.HF_WHEEL_UPLOAD_TOKEN }}
run: |
call C:\Users\muyangl\miniconda3\condabin\activate.bat activate
pip install huggingface_hub
for %%w in (dist\*.whl) do (
hf upload nunchaku-tech/nunchaku "%%w"
)