Skip to content

Commit 4f7a785

Browse files
committed
chore: use uv workflow
Signed-off-by: Ronan Abhamon <ronan.abhamon@vates.tech>
1 parent f3a538c commit 4f7a785

4 files changed

Lines changed: 808 additions & 23 deletions

File tree

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,24 @@
11
name: Setup Python env
2-
description: Setup Python and pip
2+
description: Setup Python and dependencies
3+
inputs:
4+
python-version:
5+
description: Python version to use
6+
required: true
37
runs:
4-
using: "composite"
8+
using: composite
59
steps:
6-
- name: Setup Python
10+
- name: Set up uv
11+
uses: astral-sh/setup-uv@v7
12+
with:
13+
enable-cache: true
14+
cache-dependency-glob: uv.lock
15+
version: "0.10.11"
16+
17+
- name: Set up Python
718
uses: actions/setup-python@v6
819
with:
9-
python-version: "3.14"
10-
cache: "pip"
20+
python-version: ${{ inputs.python-version }}
1121

1222
- name: Install dependencies
1323
shell: bash
14-
run: pip install --upgrade pip
24+
run: uv sync --all-extras --dev

‎.github/workflows/code-checkers.yml‎

Lines changed: 39 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,42 +2,64 @@ name: Code checkers
22

33
on: [push, pull_request]
44

5+
env:
6+
PYTHON_VERSIONS: '["3.8", "3.14"]'
7+
58
jobs:
9+
setup:
10+
name: Setup
11+
runs-on: ubuntu-latest
12+
outputs:
13+
python-versions: ${{ env.PYTHON_VERSIONS }}
14+
python-latest: ${{ steps.set-vars.outputs.python-latest }}
15+
steps:
16+
- id: set-vars
17+
run: |
18+
LATEST=$(echo '${{ env.PYTHON_VERSIONS }}' | jq -c '.[-1:]')
19+
echo "python-latest=$LATEST" >> $GITHUB_OUTPUT
20+
621
linting:
722
name: Linting
823
runs-on: ubuntu-latest
24+
needs: setup
25+
strategy:
26+
matrix:
27+
python-version: ${{ fromJSON(needs.setup.outputs.python-versions) }}
928
steps:
10-
- uses: actions/checkout@v4
29+
- uses: actions/checkout@v6
1130
- uses: ./.github/actions/setup-python-env
12-
13-
- name: Install Ruff
14-
run: pip install ruff
15-
16-
- name: Ruff check
17-
run: ruff check
31+
with:
32+
python-version: ${{ matrix.python-version }}
33+
- run: uv run ruff check
1834

1935
static-type-checking:
2036
name: Static type checking
2137
runs-on: ubuntu-latest
38+
needs: setup
39+
strategy:
40+
matrix:
41+
python-version: ${{ fromJSON(needs.setup.outputs.python-latest) }}
2242
steps:
23-
- uses: actions/checkout@v4
43+
- uses: actions/checkout@v6
2444
- uses: ./.github/actions/setup-python-env
25-
26-
- name: Install Mypy
27-
run: pip install mypy
45+
with:
46+
python-version: ${{ matrix.python-version }}
2847

2948
- name: Mypy check
30-
run: mypy
49+
run: uv run mypy
3150

3251
tests:
3352
name: Tests
3453
runs-on: ubuntu-latest
54+
needs: setup
55+
strategy:
56+
matrix:
57+
python-version: ${{ fromJSON(needs.setup.outputs.python-versions) }}
3558
steps:
36-
- uses: actions/checkout@v4
59+
- uses: actions/checkout@v6
3760
- uses: ./.github/actions/setup-python-env
38-
39-
- name: Install Pytest
40-
run: pip install pytest
61+
with:
62+
python-version: ${{ matrix.python-version }}
4163

4264
- name: Pytest check
43-
run: pytest
65+
run: uv run pytest

‎pyproject.toml‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,24 @@
1+
[project]
2+
name = "xcp-storage"
3+
dynamic = [
4+
"authors",
5+
"description",
6+
"license",
7+
"version"
8+
]
9+
requires-python = ">=3.7" # TODO(XCPNG-3032): Change it for modern python.
10+
11+
[build-system]
12+
requires = ["setuptools>=40"]
13+
build-backend = "setuptools.build_meta"
14+
15+
[dependency-groups]
16+
dev = [
17+
"mypy>=1.4.1",
18+
"pytest>=7.4.4",
19+
"ruff>=0.15.6",
20+
]
21+
122
[tool.mypy]
223
mypy_path = "stubs"
324
files = [

0 commit comments

Comments
 (0)