Skip to content

Commit a3c7044

Browse files
ValerianReyclaude
andcommitted
refactor: Extract uv setup into reusable local action
Create `.github/actions/setup-uv` to factorize the repeated uv setup configuration across workflows. This includes the caching settings and makes it easier to maintain consistent uv setup. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 72caebd commit a3c7044

4 files changed

Lines changed: 23 additions & 28 deletions

File tree

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Setup uv
2+
description: Setup uv with caching enabled
3+
4+
inputs:
5+
python-version:
6+
description: 'Python version to use'
7+
required: false
8+
default: '3.14'
9+
10+
runs:
11+
using: composite
12+
steps:
13+
- name: Set up uv
14+
uses: astral-sh/setup-uv@v5
15+
with:
16+
python-version: ${{ inputs.python-version }}
17+
enable-cache: true
18+
cache-dependency-glob: "**/pyproject.toml"

.github/workflows/build-deploy-docs.yml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,7 @@ jobs:
2020
- name: Checkout repository
2121
uses: actions/checkout@v4
2222

23-
- name: Set up uv
24-
uses: astral-sh/setup-uv@v5
25-
with:
26-
python-version: '3.14'
27-
enable-cache: true
28-
cache-dependency-glob: "**/pyproject.toml"
23+
- uses: ./.github/actions/setup-uv
2924

3025
- uses: ./.github/actions/install-deps
3126
with:

.github/workflows/release.yml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,7 @@ jobs:
1616
- name: Checkout repository
1717
uses: actions/checkout@v4
1818

19-
- name: Set up uv
20-
uses: astral-sh/setup-uv@v5
21-
with:
22-
python-version: '3.14'
23-
enable-cache: true
24-
cache-dependency-glob: "**/pyproject.toml"
19+
- uses: ./.github/actions/setup-uv
2520

2621
- name: Build
2722
run: uv build

.github/workflows/tests.yml

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,9 @@ jobs:
3737
- name: Checkout repository
3838
uses: actions/checkout@v4
3939

40-
- name: Set up uv
41-
uses: astral-sh/setup-uv@v5
40+
- uses: ./.github/actions/setup-uv
4241
with:
4342
python-version: ${{ matrix.python-version || '3.14' }}
44-
enable-cache: true
45-
cache-dependency-glob: "**/pyproject.toml"
4643

4744
- uses: ./.github/actions/install-deps
4845
with:
@@ -66,12 +63,7 @@ jobs:
6663
- name: Checkout repository
6764
uses: actions/checkout@v4
6865

69-
- name: Set up uv
70-
uses: astral-sh/setup-uv@v5
71-
with:
72-
python-version: '3.14'
73-
enable-cache: true
74-
cache-dependency-glob: "**/pyproject.toml"
66+
- uses: ./.github/actions/setup-uv
7567

7668
- uses: ./.github/actions/install-deps
7769
with:
@@ -88,12 +80,7 @@ jobs:
8880
- name: Checkout repository
8981
uses: actions/checkout@v4
9082

91-
- name: Set up uv
92-
uses: astral-sh/setup-uv@v5
93-
with:
94-
python-version: '3.14'
95-
enable-cache: true
96-
cache-dependency-glob: "**/pyproject.toml"
83+
- uses: ./.github/actions/setup-uv
9784

9885
- uses: ./.github/actions/install-deps
9986
with:

0 commit comments

Comments
 (0)