1+ name : Sync uv.lock
2+
3+ on :
4+ schedule :
5+ # Every Monday at 03:00 UTC; adjust as needed
6+ - cron : " 0 3 * * 1"
7+ push :
8+ tags : [uv-update-v1]
9+ branches : [main]
10+ paths :
11+ - ' pyproject.toml'
12+ - ' setup.py'
13+
14+ permissions :
15+ contents : write
16+
17+ jobs :
18+ sync-uv-lock :
19+ runs-on : linux.g5.4xlarge.nvidia.gpu
20+ if : ${{ ! contains(github.actor, 'pytorchbot') }}
21+ # environment: pytorchbot-env
22+ container :
23+ image : pytorch/manylinux2_28-builder:cuda13.0
24+ options : --gpus all
25+ env :
26+ CUDA_VERSION : 13.0
27+ CUDA_HOME : /usr/local/cuda
28+
29+ steps :
30+ - name : Checkout
31+ uses : actions/checkout@v4
32+ with :
33+ # to remove: test only
34+ ref : lluo/add_uv_sync_job
35+ # token: ${{ secrets.GH_PYTORCHBOT_TOKEN }}
36+ fetch-depth : 0
37+
38+ - name : Install uv
39+ uses : astral-sh/setup-uv@v3
40+ with :
41+ version : " latest"
42+
43+ - name : Install bazel
44+ run : |
45+ set -euo pipefail
46+ set -x
47+ curl -L https://github.com/bazelbuild/bazelisk/releases/download/v1.26.0/bazelisk-linux-amd64 \
48+ -o bazelisk-linux-amd64 \
49+ && mv bazelisk-linux-amd64 /usr/local/bin/bazel \
50+ && chmod +x /usr/local/bin/bazel
51+ bazel --version
52+
53+ - name : UV lock and check for changes
54+ id : check-changes
55+ working-directory : ${{ github.workspace }}
56+ run : |
57+ set -euo pipefail
58+ set -x
59+ git config --global safe.directory "$GITHUB_WORKSPACE"
60+
61+ if ! uv lock; then
62+ echo "Error: Failed to update uv.lock"
63+ exit 1
64+ fi
65+ echo "successfully ran uv lock"
66+ if git diff --quiet uv.lock; then
67+ echo "No changes to uv.lock"
68+ exit 0
69+ fi
70+ echo "has_changes=true" >> "$GITHUB_OUTPUT"
71+ echo "there is changes to the uv.lock file"
72+
73+ - name : Validate the changes
74+ id : validate-changes
75+ if : steps.check-changes.outputs.has_changes == 'true'
76+ run : |
77+ set -euo pipefail
78+ set -x
79+ if ! uv sync --frozen; then
80+ echo "Error: Failed to run uv sync --frozen"
81+ exit 1
82+ fi
83+ if uv run -m pip check; then
84+ echo "Error: Failed to run uv run -m pip check"
85+ exit 1
86+ fi
87+ echo "valid_changes=true" >> "$GITHUB_OUTPUT"
88+ echo "successfully validated the changes to uv.lock"
89+
90+ - name : Auto-commit changes
91+ uses : stefanzweifel/git-auto-commit-action@v7
92+ if : steps.check-changes.outputs.valid_changes == 'true'
93+ with :
94+ commit_message : " chore: update uv.lock"
95+ # to remove: test only
96+ branch : lluo/add_uv_sync_job
97+ commit_options : " --no-verify --signoff"
98+ file_pattern : uv.lock
99+ commit_user_name : Torch-TensorRT Github Bot
100+ commit_user_email :
[email protected] 101+ commit_author :
Torch-TensorRT Github Bot <[email protected] > 102+
103+ concurrency :
104+ group : ${{ github.workflow }}-uv-update-${{ github.event.pull_request.number || github.ref_name }}-${{ github.event_name == 'workflow_dispatch' }}
105+ cancel-in-progress : true
0 commit comments