Skip to content

Commit 6bf6775

Browse files
committed
Change the scripts so that it runs with uv
1 parent e71f5c0 commit 6bf6775

File tree

2 files changed

+92
-5
lines changed

2 files changed

+92
-5
lines changed

.github/workflows/uv-renewal.yaml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
---
2+
# This GitHub action is meant to update the pipfile.locks
3+
name: uv.locks Renewal Action
4+
5+
on: # yamllint disable-line rule:truthy
6+
# Triggers the workflow every Wednesday at 1am UTC
7+
schedule:
8+
- cron: "0 1 * * 3"
9+
workflow_dispatch: # for manual trigger workflow from GH Web UI
10+
inputs:
11+
branch:
12+
description: 'Specify branch'
13+
required: false
14+
default: 'main'
15+
python_version:
16+
description: 'Select Python version to update uv.lock'
17+
required: false
18+
default: '3.11'
19+
type: choice
20+
options:
21+
- '3.12'
22+
- '3.11'
23+
update_optional_dirs:
24+
description: 'Include optional directories in update'
25+
required: false
26+
default: 'false'
27+
type: choice
28+
options:
29+
- 'true'
30+
- 'false'
31+
32+
jobs:
33+
build:
34+
runs-on: ubuntu-latest
35+
permissions:
36+
contents: write
37+
env:
38+
BRANCH: ${{ github.event.inputs.branch || 'main' }}
39+
PYTHON_VERSION: ${{ github.event.inputs.python_version || '3.11' }}
40+
INCLUDE_OPT_DIRS: ${{ github.event.inputs.update_optional_dirs || 'false' }}
41+
steps:
42+
# Checkout the specified branch from the specified organization
43+
- name: Checkout code from the specified branch
44+
uses: actions/checkout@v4
45+
with:
46+
ref: ${{ env.BRANCH }}
47+
token: ${{ secrets.GITHUB_TOKEN }}
48+
49+
# Configure Git
50+
- name: Configure Git
51+
run: |
52+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
53+
git config --global user.name "GitHub Actions"
54+
55+
# Setup Python environment with the specified version (or default to '3.11')
56+
- name: Setup Python environment
57+
uses: actions/setup-python@v5
58+
with:
59+
python-version: ${{ env.PYTHON_VERSION }}
60+
61+
# Install uv
62+
- name: Install uv
63+
run: pip install uv
64+
65+
# Run makefile recipe to refresh uv.lock and push changes back to the branch
66+
- name: Run make refresh-pipfilelock-files and push the changes back to the branch
67+
run: |
68+
uv lock --python ${{ env.PYTHON_VERSION }}
69+
git add uv.lock
70+
git commit -m "Update uv.lock files by uvlock-renewal.yaml action"
71+
git push origin ${{ env.BRANCH }}

scripts/sync-requirements-txt.sh

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,24 @@ set -Eeuxo pipefail
55
# Namely, Konflux (https://konflux-ci.dev/), and Cachi2 (https://github.com/containerbuildsystem/cachi2).
66

77
# The following will create an extra requirement.txt file for every Pipfile.lock we have.
8-
micropipenv --version || pip install micropipenv
9-
find . -name Pipfile.lock -execdir bash -c '
10-
echo "# Generated by /scripts/sync-requirements-txt.sh from Pipfile.lock" > requirements.txt &&
11-
echo >> requirements.txt &&
12-
micropipenv requirements >> requirements.txt' \;
8+
uv --version || pip install uv
9+
cd jupyter
10+
find . -name "requirements.txt" -type f > files.txt
11+
cd ..
12+
while read -r file; do
13+
14+
echo "Processing $file"
15+
path="${file#./*}"
16+
image_name="${path%/*/*}"
17+
python_version="${path%/*}"
18+
python_version="${python_version##*-}"
19+
20+
if [[ "$path" == *"rocm/"* ]]; then
21+
image_name="${image_name#*/}-rocm"
22+
fi
23+
24+
uv pip compile --format requirements.txt --python ${python_version} -o jupyter/${path} --generate-hashes --group jupyter-${image_name}-image --python-platform linux --no-annotate -q
25+
26+
done < jupyter/files.txt
27+
28+
rm jupyter/files.txt

0 commit comments

Comments
 (0)