Skip to content

Commit

Permalink
ci(tests): fix linting and test envs
Browse files Browse the repository at this point in the history
add environments for linting & testing to avoid pre-commit hooks in ci
  • Loading branch information
Olaf Haag committed Nov 8, 2023
1 parent cffd3f5 commit e6db576
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 14 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ jobs:
- name: Install Hatch
run: pip install --upgrade hatch

- name: Run tests
run: hatch run cov

- name: Run linting
run: hatch run style
run: hatch run lint:style

- name: Run type-checking
run: hatch run typing
run: hatch run lint:typing

- name: Run tests
run: hatch run test:cov
34 changes: 25 additions & 9 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,18 @@ dependencies = [
]

[project.optional-dependencies]
tests = [
test = [
"pytest",
"pytest-xdist",
"coverage[toml]>=6.5",
]
lint = [
"black>=23.3.0",
"mypy>=1.5.1",
"ruff>=0.0.285",
]
dev = [
"readyplayerme.meshops[tests]",
"readyplayerme.meshops[test, lint]",
"pre-commit",
]

Expand All @@ -58,13 +64,6 @@ packages = ["src/readyplayerme"]
description = "Python virtual environment in project dir to quickly get up and running in an IDE like VSCode."
type = "virtual"
path = ".venv"
dependencies = [
"black>=23.3.0",
"mypy>=1.5.1",
"ruff>=0.0.285",
"coverage[toml]>=6.5",
"pytest",
]
features = [
"dev",
]
Expand Down Expand Up @@ -100,6 +99,22 @@ all = [
"cov",
]

[tool.hatch.envs.lint]
description = "Python virtual environment to be used in CI to run linting and type checking."
# Note: This still inherits the path from the default env, so it will use the same venv.
features = [
"lint",
]
post-install-commands = []

[tool.hatch.envs.test]
description = "Python virtual environment to be used in CI to run tests."
# Note: This still inherits the path from the default env, so it will use the same venv.
features = [
"test",
]
post-install-commands = []

[[tool.hatch.envs.all.matrix]]
python = ["3.10", "3.11"]

Expand Down Expand Up @@ -227,6 +242,7 @@ warn_unused_ignores = true
disallow_any_generics = true
check_untyped_defs = true
no_implicit_reexport = true
plugins = ["numpy.typing.mypy_plugin"]

[[tool.mypy.overrides]]
module = "readyplayerme.*"
Expand Down

0 comments on commit e6db576

Please sign in to comment.