Skip to content

Commit 0c6094a

Browse files
committed
update ci workflow
- use tox to run tests and lint. - clean the workflow
1 parent 876d0a8 commit 0c6094a

File tree

3 files changed

+89
-42
lines changed

3 files changed

+89
-42
lines changed

.github/workflows/ci.yml

Lines changed: 36 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,45 @@ on:
55
types: [opened, synchronize, reopened]
66

77
jobs:
8-
tests:
8+
lint:
9+
name: Run linting
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v3
14+
15+
- name: Install the latest version of uv
16+
uses: astral-sh/setup-uv@v6
17+
with:
18+
version: "latest"
19+
enable-cache: false
20+
21+
- name: setup python
22+
uses: actions/setup-python@v5
23+
with:
24+
python-version-file: "pyproject.toml"
25+
26+
- name: run linting
27+
run: uvx --with=tox-uv tox -e linting
28+
29+
test:
930
name: Run tests
1031
runs-on: ubuntu-latest
1132
steps:
1233
- name: Checkout
1334
uses: actions/checkout@v3
14-
- name: Setup Python
15-
uses: actions/setup-python@v3
35+
36+
- name: Install the latest version of uv
37+
uses: astral-sh/setup-uv@v6
38+
with:
39+
version: "latest"
40+
enable-cache: false
41+
42+
- name: setup python
43+
uses: actions/setup-python@v5
1644
with:
17-
python-version: '3.8'
18-
- name: Install uv
19-
run: python -m pip install --upgrade uv
20-
- name: Install dependencies
21-
run: uv sync --dev
22-
- name: Run tests
23-
working-directory: webapp
24-
run: uv run python manage.py test --settings=vokou.settings.testing
45+
python-version-file: "pyproject.toml"
46+
47+
- name: run testing
48+
run: uvx --with=tox-uv tox -e testing
49+

.github/workflows/lint.yml

Lines changed: 0 additions & 17 deletions
This file was deleted.

pyproject.toml

Lines changed: 53 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "voko"
33
version = "0.1.0"
44
description = "VOKO webapp"
5-
requires-python = ">=3.8"
5+
requires-python = ">=3.8,<3.9"
66
dependencies = [
77
"django-extensions==3.1.2",
88
"django-bootstrap5==23.3",
@@ -29,29 +29,68 @@ dependencies = [
2929
"freezegun>=1.5.5",
3030
]
3131

32-
[project.optional-dependencies]
33-
dev = [
34-
"fake-factory==0.7.4",
35-
"factory-boy==3.2.1",
36-
"mock==1.0.1",
37-
"django-debug-toolbar==3.8.1",
38-
"flake8==3.8.4",
39-
"debugpy==1.6.6",
40-
]
41-
4232
[build-system]
4333
requires = ["hatchling"]
4434
build-backend = "hatchling.build"
4535

4636
[tool.hatch.build.targets.wheel]
4737
packages = ["webapp"]
4838

49-
[tool.uv]
50-
dev-dependencies = [
39+
[dependency-groups]
40+
dev = [
41+
{ include-group = "test" },
42+
{ include-group = "lint" },
43+
]
44+
test = [
5145
"fake-factory==0.7.4",
5246
"factory-boy==3.2.1",
5347
"mock==1.0.1",
5448
"django-debug-toolbar==3.8.1",
55-
"flake8==3.8.4",
5649
"debugpy==1.6.6",
5750
]
51+
lint = [
52+
"ruff>=0.8.4",
53+
]
54+
55+
[tool.pytest.ini_options]
56+
addopts = [
57+
"--durations=10",
58+
]
59+
60+
[tool.mypy]
61+
warn_unused_configs = true
62+
63+
[tool.ruff]
64+
line-length = 120
65+
66+
[tool.ruff.lint]
67+
select = ["ALL"]
68+
69+
[tool.ruff.lint.flake8-annotations]
70+
allow-star-arg-any = true
71+
72+
[tool.ruff.lint.pydocstyle]
73+
convention = "google"
74+
75+
# Tox configuration for testing with Django and linting with ruff
76+
[tool.tox]
77+
min_version = "4.22"
78+
requires = [
79+
"tox>=4.22",
80+
"tox-uv",
81+
]
82+
env_list = [
83+
"testing",
84+
"linting",
85+
]
86+
87+
[tool.tox.env.testing]
88+
runner = "uv-venv-lock-runner"
89+
dependency_groups = [ "test" ]
90+
change_dir = "webapp"
91+
commands = [ [ "python", "manage.py", "test", "--settings=vokou.settings.testing", { replace = "posargs", default = [], extend = true } ] ]
92+
93+
[tool.tox.env.linting]
94+
runner = "uv-venv-lock-runner"
95+
dependency_groups = [ "lint" ]
96+
commands = [ [ "ruff", "check", { replace = "posargs", default = [ "webapp" ], extend = true } ] ]

0 commit comments

Comments
 (0)