|
1 | 1 | name: Sync uv.lock |
2 | 2 |
|
3 | 3 | on: |
4 | | - #pull_request: |
5 | 4 | schedule: |
6 | 5 | # Every Monday at 03:00 UTC; adjust as needed |
7 | 6 | - cron: "0 3 * * 1" |
8 | 7 | push: |
| 8 | + # to remove: test only |
| 9 | + tags: [uv-update-v1] |
| 10 | + |
9 | 11 | branches: [main] |
10 | 12 | paths: |
11 | 13 | - 'pyproject.toml' |
12 | 14 | - 'setup.py' |
13 | | - workflow_dispatch: # allow manual runs |
| 15 | + workflow_dispatch: |
14 | 16 |
|
15 | 17 | permissions: |
16 | 18 | contents: write |
17 | 19 |
|
18 | 20 | jobs: |
19 | 21 | 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 | + |
21 | 33 | steps: |
22 | 34 | - name: Checkout |
23 | 35 | uses: actions/checkout@v4 |
24 | 36 | 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 }} |
25 | 41 | fetch-depth: 0 |
26 | | - #token: ${{ secrets.UV_LOCK_PR_TOKEN }} |
27 | 42 |
|
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 }} |
29 | 61 | 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" |
34 | 97 |
|
35 | 98 | - name: Auto-commit changes |
36 | 99 | uses: stefanzweifel/git-auto-commit-action@v7 |
| 100 | + if: steps.check-changes.outputs.valid_changes == 'true' |
37 | 101 | with: |
38 | | - branch: update/uv-lockfiles-20059032135 |
39 | 102 | commit_message: "chore: update uv.lock" |
| 103 | + # to remove: test only |
| 104 | + branch: lluo/add_uv_sync_job |
40 | 105 | commit_options: "--no-verify --signoff" |
41 | 106 | file_pattern: uv.lock |
42 | 107 | commit_user_name: Torch-TensorRT Github Bot |
43 | 108 | commit_user_email: [email protected] |
44 | 109 | 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 |
73 | 110 |
|
74 | 111 | concurrency: |
75 | 112 | group: ${{ github.workflow }}-uv-update-${{ github.event.pull_request.number || github.ref_name }}-${{ github.event_name == 'workflow_dispatch' }} |
|
0 commit comments