Skip to content

Commit 673a77c

Browse files
committed
auto release
1 parent 22dbaaf commit 673a77c

File tree

1 file changed

+230
-0
lines changed

1 file changed

+230
-0
lines changed
Lines changed: 230 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,230 @@
1+
name: Update Ray Version
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
new_ray_version:
7+
description: 'New Ray version (e.g., 2.48.0)'
8+
required: true
9+
type: string
10+
new_cuda_py311_sha:
11+
description: 'New CUDA Python 3.11 runtime image SHA (e.g., abc123...)'
12+
required: true
13+
type: string
14+
new_cuda_py312_sha:
15+
description: 'New CUDA Python 3.12 runtime image SHA (e.g., def456...)'
16+
required: true
17+
type: string
18+
new_cuda_version_py311:
19+
description: 'New CUDA version for Python 3.11 (e.g., cu121)'
20+
required: true
21+
type: string
22+
default: 'cu121'
23+
new_cuda_version_py312:
24+
description: 'New CUDA version for Python 3.12 (e.g., cu128)'
25+
required: true
26+
type: string
27+
default: 'cu128'
28+
29+
env:
30+
PR_BRANCH_NAME: ray-version-update-${{ github.run_id }}
31+
32+
jobs:
33+
update-ray-version:
34+
runs-on: ubuntu-latest
35+
permissions:
36+
contents: write
37+
pull-requests: write
38+
steps:
39+
- name: Checkout repository
40+
uses: actions/checkout@v4
41+
with:
42+
token: ${{ secrets.GITHUB_TOKEN }}
43+
fetch-depth: 0
44+
45+
- name: Set up Python
46+
uses: actions/setup-python@v5
47+
with:
48+
python-version: '3.11'
49+
50+
- name: Create update branch
51+
run: |
52+
git config --local user.email "[email protected]"
53+
git config --local user.name "GitHub Action"
54+
git checkout -b ${{ env.PR_BRANCH_NAME }}
55+
56+
- name: Update constants.py
57+
run: |
58+
echo "Updating constants.py with new Ray version and runtime images..."
59+
60+
# Update Ray version
61+
sed -i "s/RAY_VERSION = \"[^\"]*\"/RAY_VERSION = \"${{ github.event.inputs.new_ray_version }}\"/" src/codeflare_sdk/common/utils/constants.py
62+
63+
# Update comments with new Ray version and CUDA versions
64+
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
65+
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
66+
67+
# Update runtime image SHAs
68+
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
69+
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
70+
71+
echo "Constants.py updated successfully"
72+
73+
- name: Update pyproject.toml
74+
run: |
75+
echo "Updating pyproject.toml with new Ray version..."
76+
# Update Ray dependency version in pyproject.toml
77+
sed -i "s/ray = {version = \"[^\"]*\", extras = \[\"data\", \"default\"\]}/ray = {version = \"${{ github.event.inputs.new_ray_version }}\", extras = [\"data\", \"default\"]}/" pyproject.toml
78+
echo "pyproject.toml updated successfully"
79+
80+
- name: Update documentation files
81+
run: |
82+
# Update documentation files with new Ray version and image tags
83+
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" {} \;
84+
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" {} \;
85+
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" {} \;
86+
87+
- name: Update notebook files
88+
run: |
89+
# Update notebook files with new Ray version and image tags
90+
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" {} \;
91+
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" {} \;
92+
93+
- name: Update YAML test files
94+
run: |
95+
# Update YAML files with new Ray version
96+
find tests/ -name "*.yaml" -exec sed -i "s/rayVersion: [0-9]\+\.[0-9]\+\.[0-9]\+/rayVersion: ${{ github.event.inputs.new_ray_version }}/g" {} \;
97+
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" {} \;
98+
99+
- name: Update output YAML files
100+
run: |
101+
# Update output YAML files in demo-notebooks
102+
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" {} \;
103+
104+
- name: Validate updates
105+
run: |
106+
echo "Validating updates..."
107+
108+
# Check if constants.py was updated correctly
109+
if grep -q "RAY_VERSION = \"${{ github.event.inputs.new_ray_version }}\"" src/codeflare_sdk/common/utils/constants.py; then
110+
echo "✓ Ray version updated in constants.py"
111+
else
112+
echo "✗ Ray version not found in constants.py"
113+
exit 1
114+
fi
115+
116+
# Check if pyproject.toml was updated correctly
117+
if grep -q "ray = {version = \"${{ github.event.inputs.new_ray_version }}\"" pyproject.toml; then
118+
echo "✓ Ray version updated in pyproject.toml"
119+
else
120+
echo "✗ Ray version not found in pyproject.toml"
121+
exit 1
122+
fi
123+
124+
# Check if runtime images were updated
125+
if grep -q "quay.io/modh/ray@sha256:${{ github.event.inputs.new_cuda_py311_sha }}" src/codeflare_sdk/common/utils/constants.py; then
126+
echo "✓ Python 3.11 runtime image updated"
127+
else
128+
echo "✗ Python 3.11 runtime image not found"
129+
exit 1
130+
fi
131+
132+
if grep -q "quay.io/modh/ray@sha256:${{ github.event.inputs.new_cuda_py312_sha }}" src/codeflare_sdk/common/utils/constants.py; then
133+
echo "✓ Python 3.12 runtime image updated"
134+
else
135+
echo "✗ Python 3.12 runtime image not found"
136+
exit 1
137+
fi
138+
139+
echo "All validations passed!"
140+
141+
- name: Check for changes
142+
id: check-changes
143+
run: |
144+
if git diff --quiet; then
145+
echo "No changes detected"
146+
echo "has-changes=false" >> $GITHUB_OUTPUT
147+
else
148+
echo "Changes detected"
149+
echo "has-changes=true" >> $GITHUB_OUTPUT
150+
echo "Summary of changes:"
151+
git diff --stat
152+
fi
153+
154+
- name: Commit changes
155+
if: steps.check-changes.outputs.has-changes == 'true'
156+
run: |
157+
git add .
158+
git commit -m "Update Ray version to ${{ github.event.inputs.new_ray_version }}
159+
160+
- Updated Ray version in constants.py and pyproject.toml
161+
- Updated CUDA runtime image SHAs for Python 3.11 and 3.12
162+
- Updated documentation files with new Ray image tags
163+
- Updated notebook files with new Ray image tags
164+
- Updated YAML test files with new Ray version
165+
166+
Changes include:
167+
- Ray version: ${{ github.event.inputs.new_ray_version }}
168+
- Python 3.11 CUDA version: ${{ github.event.inputs.new_cuda_version_py311 }}
169+
- Python 3.12 CUDA version: ${{ github.event.inputs.new_cuda_version_py312 }}
170+
- Python 3.11 runtime SHA: ${{ github.event.inputs.new_cuda_py311_sha }}
171+
- Python 3.12 runtime SHA: ${{ github.event.inputs.new_cuda_py312_sha }}"
172+
173+
- name: Push changes
174+
if: steps.check-changes.outputs.has-changes == 'true'
175+
run: |
176+
git push origin ${{ env.PR_BRANCH_NAME }}
177+
178+
- name: Create Pull Request
179+
if: steps.check-changes.outputs.has-changes == 'true'
180+
uses: peter-evans/create-pull-request@v5
181+
with:
182+
token: ${{ secrets.GITHUB_TOKEN }}
183+
base: main
184+
head: ${{ env.PR_BRANCH_NAME }}
185+
title: "Update Ray version to ${{ github.event.inputs.new_ray_version }}"
186+
body: |
187+
## Ray Version Update
188+
189+
This PR automatically updates the Ray version and related runtime images across the repository.
190+
191+
### Changes Made:
192+
- **Ray Version**: Updated to `${{ github.event.inputs.new_ray_version }}`
193+
- **Python 3.11 CUDA Version**: `${{ github.event.inputs.new_cuda_version_py311 }}`
194+
- **Python 3.12 CUDA Version**: `${{ github.event.inputs.new_cuda_version_py312 }}`
195+
- **Python 3.11 Runtime SHA**: `${{ github.event.inputs.new_cuda_py311_sha }}`
196+
- **Python 3.12 Runtime SHA**: `${{ github.event.inputs.new_cuda_py312_sha }}`
197+
198+
### Files Updated:
199+
- `src/codeflare_sdk/common/utils/constants.py` - Ray version, comments, and runtime image SHAs
200+
- `pyproject.toml` - Ray dependency version
201+
- Documentation files (`.rst`) - Updated Ray image tags
202+
- Notebook files (`.ipynb`) - Updated Ray image tags
203+
- YAML test files - Updated Ray version and image tags
204+
205+
### Testing:
206+
Please run the test suite to ensure all changes work correctly:
207+
```bash
208+
poetry install
209+
poetry run pytest
210+
```
211+
212+
### Review Checklist:
213+
- [ ] Verify Ray version is correctly updated in all files
214+
- [ ] Check that runtime image SHAs are valid
215+
- [ ] Ensure documentation examples are updated
216+
- [ ] Run tests to verify compatibility
217+
labels: |
218+
automated
219+
ray-version-update
220+
draft: false
221+
222+
- name: Comment on workflow run
223+
if: steps.check-changes.outputs.has-changes == 'false'
224+
run: |
225+
echo "No changes were made. This could mean:"
226+
echo "1. The Ray version is already up to date"
227+
echo "2. The input parameters didn't match any existing patterns"
228+
echo "3. There was an issue with the update process"
229+
echo ""
230+
echo "Please verify the input parameters and try again."

0 commit comments

Comments
 (0)