Skip to content

Commit 25394d2

Browse files
authored
ci: update to use UV chor uv to @7 (#216)
* ci: Remove caching step for virtual environment in GitHub Actions workflow * update python * update to use uv * update install
1 parent 51d8542 commit 25394d2

File tree

8 files changed

+42
-83
lines changed

8 files changed

+42
-83
lines changed

.github/workflows/deploy-docs.yml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,14 @@ jobs:
2424
2525
2626
- name: Install the latest version of uv and set the python version
27-
uses: astral-sh/setup-uv@v5
27+
uses: astral-sh/setup-uv@v7
2828
with:
29-
enable-cache: true
30-
cache-dependency-glob: "**/pyproject.toml"
31-
python-version: "3.11"
29+
enable-cache: true
30+
cache-dependency-glob: "**/pyproject.toml"
31+
python-version: "3.11"
3232

3333
- name: Install dependencies
34-
run: UV=$(which uv) PIP=$(which pip) make install
34+
run: make install
3535

3636
- name: Publish documentation
37-
run: |
38-
mkdocs gh-deploy --force
37+
run: uv run mkdocs gh-deploy --force

.github/workflows/lint.yaml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,14 @@ jobs:
1616
- uses: actions/checkout@v4
1717

1818
- name: Install the latest version of uv and set the python version
19-
uses: astral-sh/setup-uv@v5
19+
uses: astral-sh/setup-uv@v7
2020
with:
2121
enable-cache: true
2222
cache-dependency-glob: "**/pyproject.toml"
2323
python-version: "3.11"
2424

2525
- name: Install dependencies
26-
run: UV=$(which uv) PIP=$(which pip) make install
26+
run: make install
2727

2828
- name: Run linting
29-
run: |
30-
UV=$(which uv) PIP=$(which pip) make lint
29+
run: make lint

.github/workflows/test-docs.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,14 @@ jobs:
2424
uses: actions/checkout@v4
2525

2626
- name: Install the latest version of uv and set the python version
27-
uses: astral-sh/setup-uv@v5
27+
uses: astral-sh/setup-uv@v7
2828
with:
2929
enable-cache: true
3030
cache-dependency-glob: "**/pyproject.toml"
3131
python-version: "3.11"
3232

3333
- name: Install dependencies
34-
run: UV=$(which uv) PIP=$(which pip) make install
34+
run: make install
3535

3636
- name: Build documentation (without strict mode due to known warnings)
3737
run: |

.github/workflows/test-sftp-e2e.yaml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,11 @@ jobs:
3030
- uses: actions/checkout@v4
3131

3232
- name: Install the latest version of uv and set the python version
33-
uses: astral-sh/setup-uv@v6
33+
uses: astral-sh/setup-uv@v7
3434
with:
3535
enable-cache: true
3636
cache-dependency-glob: "**/pyproject.toml"
3737
python-version: "3.11"
38-
activate-environment: true
3938

4039
- name: Generate SSH key pair (SSH key auth only)
4140
if: matrix.auth-type == 'ssh-key'
@@ -93,9 +92,7 @@ jobs:
9392
fi
9493
9594
- name: Install dependencies
96-
run: |
97-
uv lock
98-
uv --no-progress pip install -e ".[test, sftp]"
95+
run: uv sync --extra test --extra sftp
9996

10097
- name: Setup test data on SFTP server
10198
run: |

.github/workflows/test.yaml

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -34,34 +34,20 @@ jobs:
3434
steps:
3535
- uses: actions/checkout@v4
3636

37-
- name: Cache venv
38-
uses: actions/cache@v4
39-
with:
40-
path: .venv
41-
key: venv-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml') }}
42-
restore-keys: |
43-
venv-${{ runner.os }}-${{ matrix.python-version }}-
44-
4537
- name: Install the latest version of uv and set the python version
46-
uses: astral-sh/setup-uv@v6
38+
uses: astral-sh/setup-uv@v7
4739
with:
4840
enable-cache: true
4941
cache-dependency-glob: "**/pyproject.toml"
5042
python-version: ${{ matrix.python-version }}
51-
activate-environment: true
5243

5344
- name: Install dependencies (minimal)
5445
if: matrix.test-type == 'minimal'
55-
run: |
56-
uv lock
57-
uv --no-progress pip install -e ".[test]"
46+
run: uv sync --extra test
5847

5948
- name: Install dependencies (full)
6049
if: matrix.test-type == 'full'
61-
run: |
62-
uv lock
63-
uv lock
64-
make install UV="uv" PIP="pip" SYSTEM_PYTHON="python${{ matrix.python-version }}"
50+
run: make install
6551

6652
- name: Test minimal installation
6753
if: matrix.test-type == 'minimal'

.python-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.12

Makefile

Lines changed: 24 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,49 @@
11
# SPDX-FileCopyrightText: 2024 Deutsche Telekom AG
22
#
33
# SPDX-License-Identifier: CC0-1.0
4-
.PHONY: install test clean
4+
# Requires uv (https://docs.astral.sh/uv/). First-time: run 'make lock' then 'make install'.
5+
.PHONY: install test clean build lock lint documentation reuse-lint
56
SRC_DIR = ./wurzel
6-
TEST_DIR= ./tests
7+
TEST_DIR = ./tests
78
VENV = .venv
8-
SYSTEM_PYTHON?= python3.12
99
SHELL := bash
1010

11+
$(VENV)/.venv_created:
12+
@uv venv $(VENV)
13+
@touch $(VENV)/.venv_created
1114

12-
ifeq ($(OS),Windows_NT)
13-
PY ?= $(VENV)/Scripts/python.exe
14-
PIP ?= $(VENV)/Scripts/pip.exe
15-
UV ?= $(VENV)/Scripts/uv.exe
16-
else
17-
PY ?= $(VENV)/bin/python
18-
PIP ?= $(VENV)/bin/pip
19-
UV ?= $(VENV)/bin/uv
20-
endif
21-
15+
install: $(VENV)/.venv_created
16+
uv sync --all-extras
17+
uv run pre-commit install
2218

2319
build: install
24-
$(UV) pip install build
25-
$(PY) -m build .
26-
27-
$(VENV)/touchfile: pyproject.toml $(UV)
28-
$(UV) --no-progress pip install -r pyproject.toml --all-extras
29-
@$(shell if [ "$(OS)" = "Windows_NT" ]; then echo type nul > $(VENV)\\touchfile; else echo touch $(VENV)/touchfile; fi)
30-
$(PY):
31-
$(SYSTEM_PYTHON) -m venv $(VENV)
32-
33-
$(UV): $(PY)
34-
$(PIP) install --upgrade pip
35-
$(PIP) install uv
36-
37-
install: $(VENV)/touchfile
38-
$(UV) run pre-commit install
39-
40-
UNAME_S := $(shell uname)
20+
uv build
4121

4222
test: install
4323
@echo "🧪 Running tests..."
44-
ifeq ($(UNAME_S),Darwin)
45-
ifneq ($(GITHUB_ACTIONS),)
46-
@echo "Running tests on MacOS in GitHub pipeline"
47-
@echo "Skipping coverage check"
48-
# https://github.com/actions/runner-images/issues/9918
49-
# Docling coverage is not working when tests are skipped on MacOS
50-
$(UV) run pytest $(TEST_DIR) --cov-branch --cov-report term --cov-report html:reports --cov=$(SRC_DIR)
51-
else
52-
$(UV) run pytest $(TEST_DIR) --cov-branch --cov-report term --cov-report html:reports --cov-fail-under=90 --cov=$(SRC_DIR)
53-
endif
54-
else
55-
$(UV) run pytest $(TEST_DIR) --cov-branch --cov-report term --cov-report html:reports --cov-fail-under=90 --cov=$(SRC_DIR)
56-
endif
24+
@UNAME_S=$$(uname); \
25+
if [ "$$UNAME_S" = "Darwin" ] && [ -n "$$GITHUB_ACTIONS" ]; then \
26+
echo "Running tests on MacOS in GitHub pipeline"; \
27+
echo "Skipping coverage check"; \
28+
uv run pytest $(TEST_DIR) --cov-branch --cov-report term --cov-report html:reports --cov=$(SRC_DIR); \
29+
elif [ "$$UNAME_S" = "Darwin" ]; then \
30+
uv run pytest $(TEST_DIR) --cov-branch --cov-report term --cov-report html:reports --cov-fail-under=90 --cov=$(SRC_DIR); \
31+
else \
32+
uv run pytest $(TEST_DIR) --cov-branch --cov-report term --cov-report html:reports --cov-fail-under=90 --cov=$(SRC_DIR); \
33+
fi
5734

5835
lint: install
5936
@echo "🔍 Running lint checks..."
60-
$(UV) run pre-commit run --all-files
37+
uv run pre-commit run --all-files
6138

6239
clean:
6340
@echo "🧹 Cleaning up..."
6441
@rm -rf __pycache__ ${SRC_DIR}/*.egg-info **/__pycache__ .pytest_cache
65-
@rm -rf .coverage reports dist
42+
@rm -rf .coverage reports dist $(VENV)
6643

6744
documentation: install
6845
@echo "📚 Serving documentation..."
69-
$(UV) run mkdocs serve
46+
uv run mkdocs serve
7047

71-
.PHONY: reuse-lint
7248
reuse-lint:
73-
$(UV) run reuse lint
49+
uv run reuse lint

REUSE.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ path = [
2929
"**/requirements.txt",
3030
"**/*.pyc",
3131
"**/__pycache__/**",
32+
".python-version",
3233
]
3334
precedence = "override"
3435
SPDX-FileCopyrightText = "NONE"

0 commit comments

Comments
 (0)