Skip to content

Commit ecb8d28

Browse files
committed
modify
1 parent 176ed6a commit ecb8d28

File tree

2 files changed

+75
-143
lines changed

2 files changed

+75
-143
lines changed

.github/workflows/uv-update.yml

Lines changed: 75 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,75 +1,112 @@
11
name: Sync uv.lock
22

33
on:
4-
#pull_request:
54
schedule:
65
# Every Monday at 03:00 UTC; adjust as needed
76
- cron: "0 3 * * 1"
87
push:
8+
# to remove: test only
9+
tags: [uv-update-v1]
10+
911
branches: [main]
1012
paths:
1113
- 'pyproject.toml'
1214
- 'setup.py'
13-
workflow_dispatch: # allow manual runs
15+
workflow_dispatch:
1416

1517
permissions:
1618
contents: write
1719

1820
jobs:
1921
sync-uv-lock:
20-
runs-on: ubuntu-latest
22+
runs-on: linux.g5.4xlarge.nvidia.gpu
23+
if: ${{ ! contains(github.actor, 'pytorchbot') }}
24+
# uncomment for run in main branch
25+
#environment: pytorchbot-env
26+
container:
27+
image: pytorch/manylinux2_28-builder:cuda13.0
28+
options: --gpus all
29+
env:
30+
CUDA_VERSION: 13.0
31+
CUDA_HOME: /usr/local/cuda
32+
2133
steps:
2234
- name: Checkout
2335
uses: actions/checkout@v4
2436
with:
37+
# to remove: test only
38+
ref: lluo/add_uv_sync_job
39+
# uncomment for actual run in main branch
40+
#token: ${{ secrets.GH_PYTORCHBOT_TOKEN }}
2541
fetch-depth: 0
26-
#token: ${{ secrets.UV_LOCK_PR_TOKEN }}
2742

28-
- name: Fake the changes to the uv.lock file
43+
- name: Install uv
44+
uses: astral-sh/setup-uv@v3
45+
with:
46+
version: "latest"
47+
48+
- name: Install bazel
49+
run: |
50+
set -euo pipefail
51+
set -x
52+
curl -L https://github.com/bazelbuild/bazelisk/releases/download/v1.26.0/bazelisk-linux-amd64 \
53+
-o bazelisk-linux-amd64 \
54+
&& mv bazelisk-linux-amd64 /usr/local/bin/bazel \
55+
&& chmod +x /usr/local/bin/bazel
56+
bazel --version
57+
58+
- name: UV lock and check for changes
59+
id: check-changes
60+
working-directory: ${{ github.workspace }}
2961
run: |
30-
git config --global --add safe.directory "${GITHUB_WORKSPACE}"
31-
git fetch origin update/uv-lockfiles-20059032135
32-
git checkout update/uv-lockfiles-20059032135
33-
echo "fake changes to uv.lock" > uv.lock
62+
set -euo pipefail
63+
set -x
64+
git config --global safe.directory "$GITHUB_WORKSPACE"
65+
66+
if ! uv lock; then
67+
echo "Error: Failed to update uv.lock"
68+
exit 1
69+
fi
70+
echo "successfully ran uv lock"
71+
if git diff --quiet uv.lock; then
72+
echo "No changes to uv.lock"
73+
exit 0
74+
fi
75+
echo "has_changes=true" >> "$GITHUB_OUTPUT"
76+
echo "there is changes to the uv.lock file"
77+
# to remove: test only
78+
git diff uv.lock
79+
cat uv.lock
80+
81+
- name: Validate the changes
82+
id: validate-changes
83+
if: steps.check-changes.outputs.has_changes == 'true'
84+
run: |
85+
set -euo pipefail
86+
set -x
87+
if ! uv sync --frozen; then
88+
echo "Error: Failed to run uv sync --frozen"
89+
exit 1
90+
fi
91+
# if uv run -m pip check; then
92+
# echo "Error: Failed to run uv run -m pip check"
93+
# exit 1
94+
# fi
95+
echo "valid_changes=true" >> "$GITHUB_OUTPUT"
96+
echo "successfully validated the changes to uv.lock"
3497
3598
- name: Auto-commit changes
3699
uses: stefanzweifel/git-auto-commit-action@v7
100+
if: steps.check-changes.outputs.valid_changes == 'true'
37101
with:
38-
branch: update/uv-lockfiles-20059032135
39102
commit_message: "chore: update uv.lock"
103+
# to remove: test only
104+
branch: lluo/add_uv_sync_job
40105
commit_options: "--no-verify --signoff"
41106
file_pattern: uv.lock
42107
commit_user_name: Torch-TensorRT Github Bot
43108
commit_user_email: [email protected]
44109
commit_author: Torch-TensorRT Github Bot <[email protected]>
45-
# - name: Create Pull Request
46-
# if: steps.check-changes.outputs.has_changes == 'true'
47-
# uses: peter-evans/create-pull-request@v5
48-
# with:
49-
# token: ${{ secrets.UV_LOCK_PR_TOKEN }}
50-
# commit-message: "chore: update uv.lock"
51-
# base: ${{ github.event_name == 'pull_request' && github.base_ref || github.ref_name }}
52-
# title: "uv.lock file updates"
53-
# body: |
54-
# ## Summary
55-
# Automated update of UV lockfiles to ensure all dependencies are current.
56-
57-
# ### Changes include:
58-
# - Updated dependency versions in `uv.lock`
59-
60-
# ### Next Steps:
61-
# - Review the updated dependencies
62-
# - Run CI to ensure no breaking changes
63-
# - Merge if all tests pass
64-
65-
# ---
66-
67-
# *Auto-generated by [uv-update](.github/workflows/uv-update.yml) workflow*
68-
# branch: "update/uv-lockfiles-${{ github.run_id }}"
69-
# delete-branch: true
70-
# assignees: ""
71-
# reviewers: ""
72-
# draft: false
73110

74111
concurrency:
75112
group: ${{ github.workflow }}-uv-update-${{ github.event.pull_request.number || github.ref_name }}-${{ github.event_name == 'workflow_dispatch' }}

.github/workflows/uv-update_final.yml

Lines changed: 0 additions & 105 deletions
This file was deleted.

0 commit comments

Comments
 (0)