-
Notifications
You must be signed in to change notification settings - Fork 897
352 lines (295 loc) · 11.4 KB
/
Copy pathhotfix-release.yaml
File metadata and controls
352 lines (295 loc) · 11.4 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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
name: Hotfix Release (Post Version)
on:
workflow_dispatch:
inputs:
base_version:
description: 'Base version to create hotfix from (e.g., 0.3.9)'
required: true
type: string
post_number:
description: 'Post release number (e.g., 1 for .post1)'
required: true
type: string
description:
description: 'Brief description of the hotfix'
required: true
type: string
env:
SCCACHE_GHA_ENABLED: "true"
jobs:
prepare-hotfix:
runs-on: ubuntu-22.04
permissions:
contents: write
outputs:
hotfix_version: ${{ steps.create_hotfix.outputs.hotfix_version }}
hotfix_tag: ${{ steps.create_hotfix.outputs.hotfix_tag }}
steps:
- name: Checkout source
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Validate inputs
run: |
# Validate version format
if ! [[ "${{ github.event.inputs.base_version }}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Error: Invalid version format. Expected format: X.Y.Z"
exit 1
fi
# Validate post number
if ! [[ "${{ github.event.inputs.post_number }}" =~ ^[0-9]+$ ]]; then
echo "Error: Post number must be a positive integer"
exit 1
fi
- name: Create hotfix version
id: create_hotfix
run: |
BASE_VERSION="${{ github.event.inputs.base_version }}"
POST_NUMBER="${{ github.event.inputs.post_number }}"
HOTFIX_VERSION="${BASE_VERSION}.post${POST_NUMBER}"
HOTFIX_TAG="v${HOTFIX_VERSION}"
echo "Hotfix version: $HOTFIX_VERSION"
echo "Hotfix tag: $HOTFIX_TAG"
# Check if tag already exists
if git rev-parse "$HOTFIX_TAG" >/dev/null 2>&1; then
echo "Error: Tag $HOTFIX_TAG already exists"
exit 1
fi
# Update pyproject.toml with hotfix version
sed -i "s/version = \".*\"/version = \"$HOTFIX_VERSION\"/" mooncake-wheel/pyproject.toml
echo "hotfix_version=$HOTFIX_VERSION" >> $GITHUB_OUTPUT
echo "hotfix_tag=$HOTFIX_TAG" >> $GITHUB_OUTPUT
- name: Configure Git
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
- name: Create hotfix branch
run: |
BRANCH_NAME="hotfix/${{ steps.create_hotfix.outputs.hotfix_version }}"
git checkout -b "$BRANCH_NAME"
git add mooncake-wheel/pyproject.toml
git commit -m "Hotfix ${{ steps.create_hotfix.outputs.hotfix_version }}: ${{ github.event.inputs.description }}
Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>"
git push origin "$BRANCH_NAME"
- name: Create and push tag
run: |
git tag ${{ steps.create_hotfix.outputs.hotfix_tag }}
git push origin ${{ steps.create_hotfix.outputs.hotfix_tag }}
build-cuda:
needs: prepare-hotfix
runs-on: ubuntu-22.04
permissions:
contents: write
strategy:
matrix:
python-version: ['3.10', '3.11', '3.12', '3.13']
env:
BUILD_WITH_EP: "1"
EP_TORCH_VERSIONS: "2.9.0;2.9.1;2.10.0"
TORCH_CUDA_ARCH_LIST: "8.0;9.0"
steps:
- name: Checkout source
uses: actions/checkout@v4
with:
ref: ${{ needs.prepare-hotfix.outputs.hotfix_tag }}
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Free up disk space
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf /opt/hostedtoolcache/CodeQL
sudo rm -rf /usr/local/lib/android
df -h
- name: Install CUDA Toolkit
uses: Jimver/cuda-toolkit@v0.2.24
with:
cuda: '12.8.1'
linux-local-args: '["--toolkit"]'
method: 'network'
sub-packages: '["nvcc", "nvrtc-dev"]'
non-cuda-sub-packages: '["libcusparse-dev", "libcublas-dev", "libcusolver-dev"]'
- name: Run sccache-cache
uses: mozilla-actions/sccache-action@v0.0.9
- name: Configure sccache
uses: actions/github-script@v7
with:
script: |
core.exportVariable('ACTIONS_RESULTS_URL', process.env.ACTIONS_RESULTS_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
- name: Run sccache stat for check
shell: bash
run: ${SCCACHE_PATH} --show-stats
- name: Configure project
run: |
sudo apt update -y
sudo bash -x dependencies.sh -y
mkdir build
cd build
cmake .. -DBUILD_UNIT_TESTS=OFF -DUSE_HTTP=ON -DUSE_ETCD=ON -DUSE_CUDA=ON -DWITH_EP=ON -DSTORE_USE_ETCD=ON -DENABLE_SCCACHE=ON -DCMAKE_BUILD_TYPE=Release
shell: bash
- name: Build project
run: |
export LIBRARY_PATH=/usr/local/cuda/lib64/stubs:LIBRARY_PATH
cd build
make -j
sudo make install
shell: bash
- name: Build nvlink_allocator.so
run: |
export PATH=/usr/local/nvidia/bin:/usr/local/nvidia/lib64:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda/lib64/stubs:$LD_LIBRARY_PATH
export LIBRARY_PATH=/usr/local/cuda/lib64/stubs:$LIBRARY_PATH
mkdir -p build/mooncake-transfer-engine/nvlink-allocator
cd mooncake-transfer-engine/nvlink-allocator
bash build.sh ../../build/mooncake-transfer-engine/nvlink-allocator/
shell: bash
- name: Generate Python version tag
id: generate_tag_release
run: |
echo "python_version_tag=$(echo ${{ matrix.python-version }} | tr -d '.')" >> $GITHUB_OUTPUT
shell: bash
- name: Build Python wheel
run: |
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
PYTHON_VERSION=${{ matrix.python-version }} OUTPUT_DIR=dist-py${{ steps.generate_tag_release.outputs.python_version_tag }} ./scripts/build_wheel.sh
- name: Upload Python wheel artifact
uses: actions/upload-artifact@v4
with:
name: mooncake-wheel-cuda-py${{ steps.generate_tag_release.outputs.python_version_tag }}
path: mooncake-wheel/dist-py${{ steps.generate_tag_release.outputs.python_version_tag }}/*.whl
build-non-cuda:
needs: prepare-hotfix
runs-on: ubuntu-22.04
permissions:
contents: write
strategy:
matrix:
python-version: ['3.10', '3.11', '3.12', '3.13']
env:
BUILD_WITH_EP: "0"
NON_CUDA_BUILD: "1"
steps:
- name: Checkout source
uses: actions/checkout@v4
with:
ref: ${{ needs.prepare-hotfix.outputs.hotfix_tag }}
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Free up disk space
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf /opt/hostedtoolcache/CodeQL
- name: Run sccache-cache
uses: mozilla-actions/sccache-action@v0.0.9
- name: Configure sccache
uses: actions/github-script@v7
with:
script: |
core.exportVariable('ACTIONS_RESULTS_URL', process.env.ACTIONS_RESULTS_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
- name: Run sccache stat for check
shell: bash
run: ${SCCACHE_PATH} --show-stats
- name: Configure project
run: |
sudo apt update -y
sudo bash -x dependencies.sh -y
mkdir build
cd build
cmake .. -DUSE_HTTP=ON -DUSE_ETCD=ON -DUSE_CUDA=OFF -DWITH_EP=OFF -DSTORE_USE_ETCD=ON -DENABLE_SCCACHE=ON -DCMAKE_BUILD_TYPE=Release
shell: bash
- name: Build project
run: |
cd build
make -j
sudo make install
shell: bash
- name: Generate Python version tag
id: generate_tag_release
run: |
echo "python_version_tag=$(echo ${{ matrix.python-version }} | tr -d '.')" >> $GITHUB_OUTPUT
shell: bash
- name: Build Python wheel
run: |
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
PYTHON_VERSION=${{ matrix.python-version }} OUTPUT_DIR=dist-py${{ steps.generate_tag_release.outputs.python_version_tag }} ./scripts/build_wheel.sh
- name: Upload Python wheel artifact
uses: actions/upload-artifact@v4
with:
name: mooncake-wheel-non-cuda-py${{ steps.generate_tag_release.outputs.python_version_tag }}
path: mooncake-wheel/dist-py${{ steps.generate_tag_release.outputs.python_version_tag }}/*.whl
publish-hotfix:
needs: [prepare-hotfix, build-cuda, build-non-cuda]
runs-on: ubuntu-22.04
permissions:
contents: write
id-token: write
steps:
- name: Checkout source
uses: actions/checkout@v4
with:
ref: ${{ needs.prepare-hotfix.outputs.hotfix_tag }}
- name: Download all wheel artifacts
uses: actions/download-artifact@v4
with:
path: mooncake-wheel/dist-all
- name: Prepare wheels for release
run: |
mkdir -p mooncake-wheel/dist-release
find mooncake-wheel/dist-all -name "*.whl" -exec cp {} mooncake-wheel/dist-release/ \;
echo "Collected wheels for hotfix release:"
ls -la mooncake-wheel/dist-release/
- name: Generate release notes
id: release_notes
run: |
cat > release_notes.md << 'EOF'
# Mooncake ${{ needs.prepare-hotfix.outputs.hotfix_version }} (Hotfix)
🔧 **This is a hotfix release addressing critical bugs.**
## What's Fixed
${{ github.event.inputs.description }}
## Installation
### CUDA version (default):
```bash
pip install --upgrade mooncake-transfer-engine
```
### Non-CUDA version:
```bash
pip install --upgrade mooncake-transfer-engine-non-cuda
```
## Python Support
- Python 3.10, 3.11, 3.12, 3.13
## Documentation
- [GitHub Repository](https://github.com/kvcache-ai/Mooncake)
- [Documentation](https://kvcache-ai.github.io/Mooncake/)
---
*This hotfix was released on $(date -u +"%Y-%m-%d")*
EOF
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ needs.prepare-hotfix.outputs.hotfix_tag }}
name: Hotfix ${{ needs.prepare-hotfix.outputs.hotfix_version }}
body_path: release_notes.md
files: mooncake-wheel/dist-release/*.whl
draft: false
prerelease: false
- name: Publish package to PyPI
if: github.repository == 'kvcache-ai/Mooncake'
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: mooncake-wheel/dist-release/
password: ${{ secrets.PYPI_API_TOKEN }}