Skip to content

Commit eb47241

Browse files
committed
auto release
1 parent 22dbaaf commit eb47241

File tree

1 file changed

+349
-0
lines changed

1 file changed

+349
-0
lines changed
Lines changed: 349 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,349 @@
1+
name: Update SDK, Ray, and CUDA Versions & Runtime Image SHAs
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
new_sdk_version:
7+
description: 'New SDK version (e.g., 0.32.0)'
8+
required: false
9+
type: string
10+
default: ''
11+
new_ray_version:
12+
description: 'New Ray version (e.g., 2.48.0)'
13+
required: false
14+
type: string
15+
default: ''
16+
new_cuda_py311_sha:
17+
description: 'New CUDA Python 3.11 runtime image SHA (e.g., abc123...)'
18+
required: false
19+
type: string
20+
default: ''
21+
new_cuda_py312_sha:
22+
description: 'New CUDA Python 3.12 runtime image SHA (e.g., def456...)'
23+
required: false
24+
type: string
25+
default: ''
26+
new_cuda_version_py311:
27+
description: 'New CUDA version for Python 3.11 (e.g., cu121)'
28+
required: false
29+
type: string
30+
default: ''
31+
new_cuda_version_py312:
32+
description: 'New CUDA version for Python 3.12 (e.g., cu128)'
33+
required: false
34+
type: string
35+
default: ''
36+
37+
env:
38+
PR_BRANCH_NAME: ray-version-update-${{ github.run_id }}
39+
40+
jobs:
41+
update-versions:
42+
runs-on: ubuntu-latest
43+
permissions:
44+
contents: write
45+
pull-requests: write
46+
steps:
47+
- name: Checkout repository
48+
uses: actions/checkout@v4
49+
with:
50+
token: ${{ secrets.GITHUB_TOKEN }}
51+
fetch-depth: 0
52+
53+
- name: Set up Python
54+
uses: actions/setup-python@v5
55+
with:
56+
python-version: '3.11'
57+
58+
59+
- name: Configure git and create branch
60+
run: |
61+
git config --local user.email "[email protected]"
62+
git config --local user.name "GitHub Action"
63+
git checkout main
64+
git pull origin main
65+
git checkout -b ${{ env.PR_BRANCH_NAME }}
66+
67+
- name: Update constants.py
68+
run: |
69+
# Update Ray version if provided
70+
if [ -n "${{ github.event.inputs.new_ray_version }}" ]; then
71+
sed -i "s/RAY_VERSION = \"[^\"]*\"/RAY_VERSION = \"${{ github.event.inputs.new_ray_version }}\"/" src/codeflare_sdk/common/utils/constants.py
72+
73+
# Update comments with new Ray version and CUDA versions if both are provided
74+
if [ -n "${{ github.event.inputs.new_cuda_version_py311 }}" ]; then
75+
sed -i "s/\* For python 3.11:ray:[^\"]*/\* For python 3.11:ray:${{ github.event.inputs.new_ray_version }}-py311-${{ github.event.inputs.new_cuda_version_py311 }}/" src/codeflare_sdk/common/utils/constants.py
76+
fi
77+
if [ -n "${{ github.event.inputs.new_cuda_version_py312 }}" ]; then
78+
sed -i "s/\* For python 3.12:ray:[^\"]*/\* For python 3.12:ray:${{ github.event.inputs.new_ray_version }}-py312-${{ github.event.inputs.new_cuda_version_py312 }}/" src/codeflare_sdk/common/utils/constants.py
79+
fi
80+
fi
81+
82+
# Update runtime image SHAs if provided
83+
if [ -n "${{ github.event.inputs.new_cuda_py311_sha }}" ]; then
84+
sed -i "s/CUDA_PY311_RUNTIME_IMAGE = \"quay\.io\/modh\/ray@sha256:[^\"]*\"/CUDA_PY311_RUNTIME_IMAGE = \"quay.io\/modh\/ray@sha256:${{ github.event.inputs.new_cuda_py311_sha }}\"/" src/codeflare_sdk/common/utils/constants.py
85+
fi
86+
87+
if [ -n "${{ github.event.inputs.new_cuda_py312_sha }}" ]; then
88+
sed -i "s/CUDA_PY312_RUNTIME_IMAGE = \"quay\.io\/modh\/ray@sha256:[^\"]*\"/CUDA_PY312_RUNTIME_IMAGE = \"quay.io\/modh\/ray@sha256:${{ github.event.inputs.new_cuda_py312_sha }}\"/" src/codeflare_sdk/common/utils/constants.py
89+
fi
90+
91+
- name: Update pyproject.toml
92+
run: |
93+
# Update Ray dependency version in pyproject.toml if Ray version is provided
94+
if [ -n "${{ github.event.inputs.new_ray_version }}" ]; then
95+
sed -i "s/ray = {version = \"[^\"]*\", extras = \[\"data\", \"default\"\]}/ray = {version = \"${{ github.event.inputs.new_ray_version }}\", extras = [\"data\", \"default\"]}/" pyproject.toml
96+
fi
97+
98+
# Update SDK version in pyproject.toml if SDK version is provided
99+
if [ -n "${{ github.event.inputs.new_sdk_version }}" ]; then
100+
# Update both [project] and [tool.poetry] version fields
101+
sed -i "s/^version = \"[^\"]*\"/version = \"${{ github.event.inputs.new_sdk_version }}\"/" pyproject.toml
102+
fi
103+
104+
- name: Update documentation files
105+
run: |
106+
# Update documentation files with new Ray version and image tags if provided
107+
if [ -n "${{ github.event.inputs.new_ray_version }}" ] && [ -n "${{ github.event.inputs.new_cuda_version_py311 }}" ]; then
108+
find docs/ -name "*.rst" -exec sed -i "s/quay\.io\/modh\/ray:[0-9]\+\.[0-9]\+\.[0-9]\+-py311-cu[0-9]\+/quay.io\/modh\/ray:${{ github.event.inputs.new_ray_version }}-py311-${{ github.event.inputs.new_cuda_version_py311 }}/g" {} \;
109+
find docs/ -name "*.rst" -exec sed -i "s/quay\.io\/modh\/ray:[0-9]\+\.[0-9]\+\.[0-9]\+-py311-rocm[0-9]\+/quay.io\/modh\/ray:${{ github.event.inputs.new_ray_version }}-py311-rocm62/g" {} \;
110+
fi
111+
112+
if [ -n "${{ github.event.inputs.new_ray_version }}" ] && [ -n "${{ github.event.inputs.new_cuda_version_py312 }}" ]; then
113+
find docs/ -name "*.rst" -exec sed -i "s/quay\.io\/modh\/ray:[0-9]\+\.[0-9]\+\.[0-9]\+-py312-cu[0-9]\+/quay.io\/modh\/ray:${{ github.event.inputs.new_ray_version }}-py312-${{ github.event.inputs.new_cuda_version_py312 }}/g" {} \;
114+
fi
115+
116+
- name: Update notebook files
117+
run: |
118+
# Update notebook files with new Ray version and image tags if provided
119+
if [ -n "${{ github.event.inputs.new_ray_version }}" ] && [ -n "${{ github.event.inputs.new_cuda_version_py311 }}" ]; then
120+
find demo-notebooks/ -name "*.ipynb" -exec sed -i "s/quay\.io\/modh\/ray:[0-9]\+\.[0-9]\+\.[0-9]\+-py311-cu[0-9]\+/quay.io\/modh\/ray:${{ github.event.inputs.new_ray_version }}-py311-${{ github.event.inputs.new_cuda_version_py311 }}/g" {} \;
121+
fi
122+
123+
if [ -n "${{ github.event.inputs.new_ray_version }}" ] && [ -n "${{ github.event.inputs.new_cuda_version_py312 }}" ]; then
124+
find demo-notebooks/ -name "*.ipynb" -exec sed -i "s/quay\.io\/modh\/ray:[0-9]\+\.[0-9]\+\.[0-9]\+-py312-cu[0-9]\+/quay.io\/modh\/ray:${{ github.event.inputs.new_ray_version }}-py312-${{ github.event.inputs.new_cuda_version_py312 }}/g" {} \;
125+
fi
126+
127+
# Update notebook files with new Ray version only (for cases where CUDA version isn't specified)
128+
if [ -n "${{ github.event.inputs.new_ray_version }}" ] && [ -z "${{ github.event.inputs.new_cuda_version_py311 }}" ] && [ -z "${{ github.event.inputs.new_cuda_version_py312 }}" ]; then
129+
# Update Ray version in image tags while preserving existing CUDA versions
130+
find demo-notebooks/ -name "*.ipynb" -exec sed -i "s/quay\.io\/modh\/ray:[0-9]\+\.[0-9]\+\.[0-9]\+-py311-cu[0-9]\+/quay.io\/modh\/ray:${{ github.event.inputs.new_ray_version }}-py311-cu121/g" {} \;
131+
find demo-notebooks/ -name "*.ipynb" -exec sed -i "s/quay\.io\/modh\/ray:[0-9]\+\.[0-9]\+\.[0-9]\+-py312-cu[0-9]\+/quay.io\/modh\/ray:${{ github.event.inputs.new_ray_version }}-py312-cu128/g" {} \;
132+
fi
133+
134+
- name: Update YAML test files
135+
run: |
136+
# Update YAML files with new Ray version if provided
137+
if [ -n "${{ github.event.inputs.new_ray_version }}" ]; then
138+
find tests/ -name "*.yaml" -exec sed -i "s/rayVersion: [0-9]\+\.[0-9]\+\.[0-9]\+/rayVersion: ${{ github.event.inputs.new_ray_version }}/g" {} \;
139+
fi
140+
141+
# Update image tags in YAML files if Ray version and CUDA versions are provided
142+
if [ -n "${{ github.event.inputs.new_ray_version }}" ] && [ -n "${{ github.event.inputs.new_cuda_version_py311 }}" ]; then
143+
find tests/ -name "*.yaml" -exec sed -i "s/quay\.io\/modh\/ray:[0-9]\+\.[0-9]\+\.[0-9]\+-py311-cu[0-9]\+/quay.io\/modh\/ray:${{ github.event.inputs.new_ray_version }}-py311-${{ github.event.inputs.new_cuda_version_py311 }}/g" {} \;
144+
fi
145+
146+
- name: Update output YAML files
147+
run: |
148+
# Update output YAML files in demo-notebooks if Ray version and CUDA version are provided
149+
if [ -n "${{ github.event.inputs.new_ray_version }}" ] && [ -n "${{ github.event.inputs.new_cuda_version_py311 }}" ]; then
150+
find demo-notebooks/ -name "*.yaml" -exec sed -i "s/quay\.io\/modh\/ray:[0-9]\+\.[0-9]\+\.[0-9]\+-py311-cu[0-9]\+/quay.io\/modh\/ray:${{ github.event.inputs.new_ray_version }}-py311-${{ github.event.inputs.new_cuda_version_py311 }}/g" {} \;
151+
fi
152+
153+
- name: Validate updates
154+
run: |
155+
# Check if constants.py was updated correctly (only if Ray version was provided)
156+
if [ -n "${{ github.event.inputs.new_ray_version }}" ]; then
157+
if ! grep -q "RAY_VERSION = \"${{ github.event.inputs.new_ray_version }}\"" src/codeflare_sdk/common/utils/constants.py; then
158+
echo "✗ Ray version not found in constants.py"
159+
echo "Expected: RAY_VERSION = \"${{ github.event.inputs.new_ray_version }}\""
160+
echo "Found:"
161+
grep "RAY_VERSION" src/codeflare_sdk/common/utils/constants.py || echo " (not found)"
162+
exit 1
163+
fi
164+
165+
# Check if pyproject.toml was updated correctly
166+
if ! grep -q "ray = {version = \"${{ github.event.inputs.new_ray_version }}\"" pyproject.toml; then
167+
echo "✗ Ray version not found in pyproject.toml"
168+
echo "Expected: ray = {version = \"${{ github.event.inputs.new_ray_version }}\""
169+
echo "Found:"
170+
grep "ray = " pyproject.toml || echo " (not found)"
171+
exit 1
172+
fi
173+
fi
174+
175+
# Check if SDK version was updated correctly (only if SDK version was provided)
176+
if [ -n "${{ github.event.inputs.new_sdk_version }}" ]; then
177+
if ! grep -q "version = \"${{ github.event.inputs.new_sdk_version }}\"" pyproject.toml; then
178+
echo "✗ SDK version not found in pyproject.toml"
179+
echo "Expected: version = \"${{ github.event.inputs.new_sdk_version }}\""
180+
echo "Found:"
181+
grep "version = " pyproject.toml || echo " (not found)"
182+
exit 1
183+
fi
184+
fi
185+
186+
# Check if runtime images were updated (only if SHAs were provided)
187+
if [ -n "${{ github.event.inputs.new_cuda_py311_sha }}" ]; then
188+
if ! grep -q "quay.io/modh/ray@sha256:${{ github.event.inputs.new_cuda_py311_sha }}" src/codeflare_sdk/common/utils/constants.py; then
189+
echo "✗ Python 3.11 runtime image not found"
190+
echo "Expected: quay.io/modh/ray@sha256:${{ github.event.inputs.new_cuda_py311_sha }}"
191+
echo "Found:"
192+
grep "CUDA_PY311_RUNTIME_IMAGE" src/codeflare_sdk/common/utils/constants.py || echo " (not found)"
193+
exit 1
194+
fi
195+
fi
196+
197+
if [ -n "${{ github.event.inputs.new_cuda_py312_sha }}" ]; then
198+
if ! grep -q "quay.io/modh/ray@sha256:${{ github.event.inputs.new_cuda_py312_sha }}" src/codeflare_sdk/common/utils/constants.py; then
199+
echo "✗ Python 3.12 runtime image not found"
200+
echo "Expected: quay.io/modh/ray@sha256:${{ github.event.inputs.new_cuda_py312_sha }}"
201+
echo "Found:"
202+
grep "CUDA_PY312_RUNTIME_IMAGE" src/codeflare_sdk/common/utils/constants.py || echo " (not found)"
203+
exit 1
204+
fi
205+
fi
206+
207+
- name: Check for changes
208+
id: check-changes
209+
run: |
210+
if git diff --quiet; then
211+
echo "has-changes=false" >> $GITHUB_OUTPUT
212+
else
213+
echo "has-changes=true" >> $GITHUB_OUTPUT
214+
fi
215+
216+
- name: Commit changes
217+
if: steps.check-changes.outputs.has-changes == 'true'
218+
run: |
219+
git add .
220+
221+
# Build commit message based on what was updated
222+
COMMIT_MSG="Update Ray configuration"
223+
224+
if [ -n "${{ github.event.inputs.new_ray_version }}" ]; then
225+
COMMIT_MSG="$COMMIT_MSG
226+
227+
- Updated Ray version to ${{ github.event.inputs.new_ray_version }} in constants.py and pyproject.toml"
228+
fi
229+
230+
if [ -n "${{ github.event.inputs.new_sdk_version }}" ]; then
231+
COMMIT_MSG="$COMMIT_MSG
232+
- Updated SDK version to ${{ github.event.inputs.new_sdk_version }} in pyproject.toml"
233+
fi
234+
235+
if [ -n "${{ github.event.inputs.new_cuda_py311_sha }}" ]; then
236+
COMMIT_MSG="$COMMIT_MSG
237+
- Updated Python 3.11 CUDA runtime image SHA"
238+
fi
239+
240+
if [ -n "${{ github.event.inputs.new_cuda_py312_sha }}" ]; then
241+
COMMIT_MSG="$COMMIT_MSG
242+
- Updated Python 3.12 CUDA runtime image SHA"
243+
fi
244+
245+
if [ -n "${{ github.event.inputs.new_cuda_version_py311 }}" ] || [ -n "${{ github.event.inputs.new_cuda_version_py312 }}" ]; then
246+
COMMIT_MSG="$COMMIT_MSG
247+
- Updated documentation and notebook files with new CUDA versions"
248+
fi
249+
250+
COMMIT_MSG="$COMMIT_MSG
251+
252+
Parameters provided:
253+
- Ray version: ${{ github.event.inputs.new_ray_version }}
254+
- SDK version: ${{ github.event.inputs.new_sdk_version }}
255+
- Python 3.11 CUDA version: ${{ github.event.inputs.new_cuda_version_py311 }}
256+
- Python 3.12 CUDA version: ${{ github.event.inputs.new_cuda_version_py312 }}
257+
- Python 3.11 runtime SHA: ${{ github.event.inputs.new_cuda_py311_sha }}
258+
- Python 3.12 runtime SHA: ${{ github.event.inputs.new_cuda_py312_sha }}"
259+
260+
git commit -m "$COMMIT_MSG"
261+
262+
- name: Push changes
263+
if: steps.check-changes.outputs.has-changes == 'true'
264+
run: |
265+
git push origin ${{ env.PR_BRANCH_NAME }}
266+
267+
- name: Create Pull Request
268+
if: steps.check-changes.outputs.has-changes == 'true'
269+
run: |
270+
# Build PR title and body based on what was updated
271+
PR_TITLE="Update Ray configuration"
272+
if [ -n "${{ github.event.inputs.new_ray_version }}" ]; then
273+
PR_TITLE="Update Ray version to ${{ github.event.inputs.new_ray_version }}"
274+
fi
275+
if [ -n "${{ github.event.inputs.new_sdk_version }}" ]; then
276+
PR_TITLE="$PR_TITLE and SDK version to ${{ github.event.inputs.new_sdk_version }}"
277+
fi
278+
279+
PR_BODY="## Ray Configuration Update
280+
281+
This PR automatically updates Ray configuration across the repository.
282+
283+
### Changes Made:"
284+
285+
if [ -n "${{ github.event.inputs.new_ray_version }}" ]; then
286+
PR_BODY="$PR_BODY
287+
- **Ray Version**: Updated to \`${{ github.event.inputs.new_ray_version }}\`"
288+
fi
289+
290+
if [ -n "${{ github.event.inputs.new_sdk_version }}" ]; then
291+
PR_BODY="$PR_BODY
292+
- **SDK Version**: Updated to \`${{ github.event.inputs.new_sdk_version }}\`"
293+
fi
294+
295+
if [ -n "${{ github.event.inputs.new_cuda_version_py311 }}" ]; then
296+
PR_BODY="$PR_BODY
297+
- **Python 3.11 CUDA Version**: \`${{ github.event.inputs.new_cuda_version_py311 }}\`"
298+
fi
299+
300+
if [ -n "${{ github.event.inputs.new_cuda_version_py312 }}" ]; then
301+
PR_BODY="$PR_BODY
302+
- **Python 3.12 CUDA Version**: \`${{ github.event.inputs.new_cuda_version_py312 }}\`"
303+
fi
304+
305+
if [ -n "${{ github.event.inputs.new_cuda_py311_sha }}" ]; then
306+
PR_BODY="$PR_BODY
307+
- **Python 3.11 Runtime SHA**: \`${{ github.event.inputs.new_cuda_py311_sha }}\`"
308+
fi
309+
310+
if [ -n "${{ github.event.inputs.new_cuda_py312_sha }}" ]; then
311+
PR_BODY="$PR_BODY
312+
- **Python 3.12 Runtime SHA**: \`${{ github.event.inputs.new_cuda_py312_sha }}\`"
313+
fi
314+
315+
PR_BODY="$PR_BODY
316+
317+
### Files Updated:
318+
- \`src/codeflare_sdk/common/utils/constants.py\` - Ray version, comments, and runtime image SHAs
319+
- \`pyproject.toml\` - Ray dependency version (if Ray version provided)
320+
- Documentation files (\`.rst\`) - Updated Ray image tags (if versions provided)
321+
- Notebook files (\`.ipynb\`) - Updated Ray image tags (if versions provided)
322+
- YAML test files - Updated Ray version and image tags (if versions provided)
323+
324+
### Testing:
325+
Please run the test suite to ensure all changes work correctly:
326+
\`\`\`bash
327+
poetry install
328+
poetry run pytest
329+
\`\`\`
330+
331+
### Review Checklist:
332+
- [ ] Verify Ray version is correctly updated in all files
333+
- [ ] Check that runtime image SHAs are valid
334+
- [ ] Ensure documentation examples are updated
335+
- [ ] Run tests to verify compatibility"
336+
337+
# Create PR using GitHub CLI
338+
gh pr create \
339+
--title "$PR_TITLE" \
340+
--body "$PR_BODY" \
341+
--base main \
342+
--head ${{ env.PR_BRANCH_NAME }}
343+
env:
344+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
345+
346+
- name: Comment on workflow run
347+
if: steps.check-changes.outputs.has-changes == 'false'
348+
run: |
349+
echo "No changes were made. Please verify the input parameters."

0 commit comments

Comments
 (0)