Skip to content

Commit e91c2f9

Browse files
committed
refactor(github-actions): refactor Python setup into a reusable action and update Dependabot configuration
1 parent 25a6194 commit e91c2f9

File tree

4 files changed

+27
-88
lines changed

4 files changed

+27
-88
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: "Setup Python and uv"
2+
description: "Setup Python and uv with caching"
3+
runs:
4+
using: "composite"
5+
steps:
6+
- name: Set up Python
7+
uses: actions/setup-python@v6
8+
with:
9+
python-version-file: "pyproject.toml"
10+
- name: Install uv
11+
uses: astral-sh/setup-uv@v7
12+
with:
13+
enable-cache: auto
14+
version: 0.9.*
15+
- name: Install dependencies
16+
shell: bash
17+
run: uv sync --locked --all-extras --dev
18+
- name: Minimize cache
19+
shell: bash
20+
run: uv cache prune --ci

.github/dependabot.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,11 @@ updates:
77
open-pull-requests-limit: 10
88

99
- package-ecosystem: "docker"
10-
target-branch: "dev"
1110
directory: "/"
1211
schedule:
1312
interval: "weekly"
1413

1514
- package-ecosystem: "uv"
16-
target-branch: "dev"
1715

1816
directory: "/"
1917
schedule:

.github/workflows/lint.yml

Lines changed: 7 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -2,103 +2,26 @@ name: checks
22
on:
33
pull_request:
44
workflow_dispatch:
5-
65
jobs:
7-
setup:
8-
runs-on: ubuntu-latest
9-
steps:
10-
- uses: actions/checkout@v5
11-
- name: "Set up Python"
12-
uses: actions/setup-python@v6
13-
with:
14-
python-version-file: "pyproject.toml"
15-
- name: Install uv
16-
uses: astral-sh/setup-uv@v7
17-
with:
18-
enable-cache: true
19-
version: 0.8.*
20-
- name: Install dependencies
21-
run: uv sync --locked
22-
- name: Cache dependencies
23-
uses: actions/cache/save@v4
24-
with:
25-
path: |
26-
.venv
27-
~/.cache/uv
28-
key: ${{ runner.os }}-uv-${{ hashFiles('uv.lock') }}
29-
306
lint:
317
runs-on: ubuntu-latest
32-
needs: setup
338
steps:
349
- uses: actions/checkout@v5
35-
- name: "Set up Python"
36-
uses: actions/setup-python@v6
37-
with:
38-
python-version-file: "pyproject.toml"
39-
- name: Install uv
40-
uses: astral-sh/setup-uv@v7
41-
with:
42-
enable-cache: true
43-
version: 0.8.*
44-
- name: Restore dependencies
45-
uses: actions/cache/restore@v4
46-
with:
47-
path: |
48-
.venv
49-
~/.cache/uv
50-
key: ${{ runner.os }}-uv-${{ hashFiles('uv.lock') }}
51-
fail-on-cache-miss: true
52-
- name: Run linting
53-
run: |
10+
- uses: ./.github/actions/setup-python
11+
- run: |
5412
uv run ruff check --fix
5513
uv run ruff format
5614
5715
typecheck:
5816
runs-on: ubuntu-latest
59-
needs: setup
6017
steps:
6118
- uses: actions/checkout@v5
62-
- name: "Set up Python"
63-
uses: actions/setup-python@v6
64-
with:
65-
python-version-file: "pyproject.toml"
66-
- name: Install uv
67-
uses: astral-sh/setup-uv@v7
68-
with:
69-
enable-cache: true
70-
version: 0.8.*
71-
- name: Restore dependencies
72-
uses: actions/cache/restore@v4
73-
with:
74-
path: |
75-
.venv
76-
~/.cache/uv
77-
key: ${{ runner.os }}-uv-${{ hashFiles('uv.lock') }}
78-
fail-on-cache-miss: true
79-
- name: Run type checking
80-
run: uv run ty check
19+
- uses: ./.github/actions/setup-python
20+
- run: uv run ty check
21+
8122
vulture:
8223
runs-on: ubuntu-latest
83-
needs: setup
8424
steps:
8525
- uses: actions/checkout@v5
86-
- name: "Set up Python"
87-
uses: actions/setup-python@v6
88-
with:
89-
python-version-file: "pyproject.toml"
90-
- name: Install uv
91-
uses: astral-sh/setup-uv@v7
92-
with:
93-
enable-cache: true
94-
version: 0.8.*
95-
- name: Restore dependencies
96-
uses: actions/cache/restore@v4
97-
with:
98-
path: |
99-
.venv
100-
~/.cache/uv
101-
key: ${{ runner.os }}-uv-${{ hashFiles('uv.lock') }}
102-
fail-on-cache-miss: true
103-
- name: Run vulture
104-
run: uv run vulture --min-confidence 100 --exclude ".venv" .
26+
- uses: ./.github/actions/setup-python
27+
- run: uv run vulture --min-confidence 100 --exclude ".venv" .

pyproject.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ ignore = [
2828
"T10", # debugger
2929
"TID", # flake8-tidy-imports
3030
"D100",
31-
"D101",
32-
"D102",
3331
"D103",
3432
"D104",
3533
"D105",

0 commit comments

Comments
 (0)