forked from nunchaku-ai/nunchaku
-
Notifications
You must be signed in to change notification settings - Fork 0
153 lines (153 loc) · 5.43 KB
/
Copy pathnightly-build.yaml
File metadata and controls
153 lines (153 loc) · 5.43 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
name: Nightly Build
on:
schedule:
- cron: '0 8 * * *' # UTC time
workflow_dispatch:
permissions:
contents: write
jobs:
tag:
name: Check if main branch is a dev version
runs-on: ubuntu-latest
if: github.repository == 'nunchaku-ai/nunchaku'
outputs:
need_build: ${{ steps.check.outputs.need_build }}
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: Determine if build is needed
id: check
run: |
version="${{ steps.version.outputs.version }}"
need_build=false
if [[ "$version" == *dev* ]]; then
echo "Version contains 'dev'"
prefix="v$version"
tag=$(git tag --list "${prefix}*" --sort=-creatordate | head -n 1 || echo "")
if [ -z "$tag" ]; then
echo "No previous tag found."
need_build=true
else
base=$(git rev-parse "$tag")
head=$(git rev-parse HEAD)
if [ "$base" != "$head" ]; then
echo "New commits found since $tag"
need_build=true
else
echo "No new commits since $tag"
fi
fi
else
echo "Version does not contain 'dev'"
fi
echo "need_build=$need_build" >> "$GITHUB_OUTPUT"
- name: Set tag name
id: tag
if: steps.check.outputs.need_build == 'true'
run: |
today=$(date -u +"%Y%m%d")
tag_name="v${{ steps.version.outputs.version }}$today"
echo "tag_name=$tag_name"
echo "tag_name=$tag_name" >> "$GITHUB_OUTPUT"
- name: Create and push tag
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 or no new commits)
if: steps.check.outputs.need_build == 'false'
run: echo "Version is not a dev version or no new commits. Skipping tag."
linux-wheels:
name: Build the linux nightly wheels
runs-on: [self-hosted, linux-build]
needs: tag
if: needs.tag.outputs.need_build == 'true' && github.repository == 'nunchaku-ai/nunchaku'
strategy:
matrix:
python: ["3.10", "3.11", "3.12", "3.13"]
torch: ["2.8", "2.9", "2.10", "pre"]
cuda: ["12.8", "13.0"]
exclude:
- torch: "2.8"
cuda: "13.0"
steps:
- name: Checkout to the tag
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ needs.tag.outputs.tag_name }}
submodules: true
- name: Show current commit
run: git log -1 --oneline
- name: Build wheels
run: |
if [[ "${{ matrix.torch }}" == "pre" ]]; then
bash scripts/build_linux_wheel_torch_nightly.sh ${{ matrix.python }} ${{ matrix.torch }} ${{ matrix.cuda }}
else
bash scripts/build_linux_wheel.sh ${{ matrix.python }} ${{ matrix.torch }} ${{ matrix.cuda }}
fi
- name: Upload wheels to GitHub Release
uses: softprops/action-gh-release@v2
with:
files: dist/*.whl
name: Nunchaku Nightly ${{ needs.tag.outputs.tag_name }}
tag_name: ${{ needs.tag.outputs.tag_name }}
prerelease: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Clean up
if: always()
run: bash scripts/linux_cleanup.sh
windows-wheels:
name: Build the windows nightly wheels
runs-on: [self-hosted, win-build]
needs: tag
if: needs.tag.outputs.need_build == 'true' && github.repository == 'nunchaku-ai/nunchaku'
strategy:
matrix:
python: ["3.10", "3.11", "3.12", "3.13"]
torch: ["2.8", "2.9", "2.10", "pre"]
cuda: ["12.8", "13.0"]
exclude:
- torch: "2.8"
cuda: "13.0"
steps:
- name: Checkout to the tag
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ needs.tag.outputs.tag_name }}
submodules: true
- name: Show current commit
shell: cmd
run: git log -1 --oneline
- name: Build wheels
shell: cmd
run: |
call C:\Users\nunchaku\miniconda3\condabin\activate.bat activate
IF "${{ matrix.torch }}"=="pre" (
call scripts\build_windows_wheel_torch_nightly.cmd ${{ matrix.python }} ${{ matrix.torch }} ${{ matrix.cuda }} 8
) ELSE (
call scripts\build_windows_wheel.cmd ${{ matrix.python }} ${{ matrix.torch }} ${{ matrix.cuda }} 8
)
- name: Upload wheels to GitHub Release
uses: softprops/action-gh-release@v2
with:
files: dist/*.whl
name: Nunchaku Nightly ${{ needs.tag.outputs.tag_name }}
tag_name: ${{ needs.tag.outputs.tag_name }}
prerelease: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}