Skip to content

Commit 8a01277

Browse files
authored
Merge pull request #113 from dh-tech/feature/uv-github-actions
Try using uv for unit test workflow
2 parents 3dd2b33 + a0f4b05 commit 8a01277

3 files changed

Lines changed: 32 additions & 20 deletions

File tree

.github/workflows/check.yml

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,23 +17,28 @@ jobs:
1717
uses: actions/setup-python@v5
1818
with:
1919
python-version: "3.12"
20-
cache: 'pip'
21-
cache-dependency-path: '**/pyproject.toml'
22-
- name: Install package with development dependencies
23-
run: pip install -e ".[dev]"
20+
21+
- name: Install uv
22+
uses: astral-sh/setup-uv@v5
23+
with:
24+
enable-cache: true
25+
cache-dependency-glob: "pyproject.toml"
26+
27+
- name: Install package with check dependencies
28+
run: uv sync --extra check
2429

2530
# check with ruff
2631
- name: Run ruff
27-
run: ruff check
32+
run: uv run ruff check
2833

2934
# check docs build
3035
- name: Check that documentation builds with no errors or warnings
31-
run: sphinx-build docs docs/_build --fail-on-warning
36+
run: uv run sphinx-build docs docs/_build --fail-on-warning
3237

3338
# check types with mypy
3439
- name: Check types in python src directory; install needed types
35-
run: mypy --install-types --non-interactive src
40+
run: uv run mypy --install-types --non-interactive src
3641

3742
# use treon to make sure that example notebooks run
3843
- name: Check jupyter notebooks with treon
39-
run: treon
44+
run: uv run treon

.github/workflows/unit_tests.yml

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,24 +26,31 @@ jobs:
2626
working-directory: .
2727

2828
steps:
29-
- uses: actions/checkout@v3
30-
- name: Set up Python ${{ matrix.python-version }}
31-
uses: actions/setup-python@v4
29+
- uses: actions/checkout@v4
30+
31+
# use github python action instead of uv to take advantage of caching
32+
- name: Set up Python ${{ matrix.python }}
33+
uses: actions/setup-python@v5
3234
with:
3335
python-version: ${{ matrix.python }}
34-
cache: 'pip'
35-
cache-dependency-path: '**/pyproject.toml'
36-
- name: Install package with dependencies
37-
run: pip install -e ".[test]"
36+
37+
- name: Install uv
38+
uses: astral-sh/setup-uv@v5
39+
with:
40+
enable-cache: true
41+
cache-dependency-glob: "pyproject.toml"
42+
43+
- name: Install package with dev and test dependencies
44+
run: uv sync --extra test
3845

3946
# for all versions but the one we use for code coverage, run normally
4047
- name: Run unit tests normally
41-
run: pytest
48+
run: uv run pytest
4249
if: ${{ matrix.python != env.COV_PYTHON_VERSION }}
4350

4451
# run code coverage in one version only
4552
- name: Run unit tests with code coverage reporting
46-
run: pytest --cov=undate
53+
run: uv run pytest --cov=undate
4754
if: ${{ matrix.python == env.COV_PYTHON_VERSION }}
4855
- name: Upload test coverage to Codecov
4956
uses: codecov/codecov-action@v3

pyproject.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,14 @@ classifiers = [
4949
[project.optional-dependencies]
5050
docs = ["sphinx>=7.0.0", "alabaster", "myst-parser", "myst-parser[linkify]"]
5151
test = ["pytest>=7.2", "pytest-ordering", "pytest-cov"]
52+
notebooks = ["jupyterlab", "pandas", "treon"]
53+
check = ["undate[docs]", "undate[notebooks]", "mypy", "ruff"]
5254
dev = [
53-
"ruff",
5455
"pre-commit>=2.20.0",
5556
"twine",
5657
"wheel",
5758
"build",
58-
"mypy",
59-
"treon",
59+
"undate[check]",
6060
"undate[docs]",
6161
"undate[test]",
6262
]

0 commit comments

Comments
 (0)