Skip to content

Commit fc1b978

Browse files
authored
Add files via upload
Signed-off-by: Lala Sabathil <aiko@aitsys.dev>
1 parent 049517e commit fc1b978

File tree

1 file changed

+68
-0
lines changed

1 file changed

+68
-0
lines changed

.github/workflows/sync-uv.yml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: Sync UV
2+
on:
3+
workflow_call:
4+
inputs:
5+
groups:
6+
description: "Comma-separated list of groups to sync"
7+
required: false
8+
type: string
9+
default: ''
10+
extras:
11+
description: "Comma-separated list of extras to sync"
12+
required: false
13+
type: string
14+
default: ''
15+
frozen:
16+
description: "Whether to sync with frozen dependencies"
17+
required: false
18+
type: boolean
19+
default: true
20+
no_python_downloads:
21+
description: "Whether to avoid downloading Python versions"
22+
required: false
23+
type: boolean
24+
default: true
25+
26+
jobs:
27+
sync:
28+
runs-on: ubuntu-latest
29+
steps:
30+
- name: "Install uv"
31+
uses: astral-sh/setup-uv@v6
32+
with:
33+
enable-cache: true
34+
35+
- name: "Build groups args"
36+
id: groups
37+
run: |
38+
args=""
39+
if [ -n "${{ inputs.groups }}" ]; then
40+
IFS=',' read -ra GROUPS <<< "${{ inputs.groups }}"
41+
for group in "${GROUPS[@]}"; do
42+
group=$(echo "$group" | xargs)
43+
[ -n "$group" ] && args="$args --group $(printf %q "$group")"
44+
done
45+
fi
46+
echo "value=$args" >> $GITHUB_OUTPUT
47+
48+
- name: "Build extras args"
49+
id: extras
50+
run: |
51+
args=""
52+
if [ -n "${{ inputs.extras }}" ]; then
53+
IFS=',' read -ra EXTRAS <<< "${{ inputs.extras }}"
54+
for extra in "${EXTRAS[@]}"; do
55+
extra=$(echo "$extra" | xargs)
56+
[ -n "$extra" ] && args="$args --extra $(printf %q "$extra")"
57+
done
58+
fi
59+
echo "value=$args" >> $GITHUB_OUTPUT
60+
61+
- name: "Run UV sync"
62+
run: |
63+
cmd="uv sync${{ steps.groups.outputs.value }}${{ steps.extras.outputs.value }}"
64+
echo "Executing: $cmd"
65+
eval "$cmd"
66+
env:
67+
UV_NO_PYTHON_DOWNLOADS: ${{ inputs.no_python_downloads && '1' || '' }}
68+
UV_FROZEN: ${{ inputs.frozen && '1' || '' }}

0 commit comments

Comments
 (0)