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+ # to remvoe: test only
9+ tags : [uv-update-v1]
10+ branches : [main]
11+ paths :
12+ - ' pyproject.toml'
13+ - ' setup.py'
14+ workflow_dispatch :
15+
16+ permissions :
17+ contents : write
18+
19+ jobs :
20+ sync-uv-lock :
21+ runs-on : linux.g5.4xlarge.nvidia.gpu
22+ if : ${{ ! contains(github.actor, 'pytorchbot') }}
23+ environment : pytorchbot-env
24+ container :
25+ image : pytorch/manylinux2_28-builder:cuda13.0
26+ options : --gpus all
27+ env :
28+ CUDA_VERSION : 13.0
29+ CUDA_HOME : /usr/local/cuda
30+
31+ steps :
32+ - name : Checkout
33+ uses : actions/checkout@v4
34+ with :
35+ token : ${{ secrets.GH_PYTORCHBOT_TOKEN }}
36+ fetch-depth : 0
37+
38+ - name : Install uv
39+ uses : astral-sh/setup-uv@v7
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 --refresh --prerelease=allow --verbose; 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+ echo "valid_changes=true" >> "$GITHUB_OUTPUT"
84+ echo "successfully validated the changes to uv.lock"
85+
86+ - name : Auto-commit changes
87+ uses : stefanzweifel/git-auto-commit-action@v7
88+ if : steps.validate-changes.outputs.valid_changes == 'true'
89+ with :
90+ commit_message : " chore: update uv.lock"
91+ branch : main
92+ commit_options : " --no-verify --signoff"
93+ file_pattern : uv.lock
94+ commit_user_name : Torch-TensorRT Github Bot
95+ commit_user_email : torch-tensorrt.github.bot@nvidia.com
96+ commit_author : Torch-TensorRT Github Bot <torch-tensorrt.github.bot@nvidia.com>
97+
98+ concurrency :
99+ group : ${{ github.workflow }}-uv-update-${{ github.event.pull_request.number || github.ref_name }}-${{ github.event_name == 'workflow_dispatch' }}
100+ cancel-in-progress : true
0 commit comments