diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..f2a29cc --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,33 @@ +name: CI + +on: + push: + branches: + - main + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + tests: + name: Run tests on ${{ matrix.python-version }} + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] + steps: + - uses: actions/checkout@v4 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - name: Setup Hatch + run: pipx install hatch + + - name: Run tests + run: | + hatch env run -e tests -i py=${{ matrix.python-version }} tests:test diff --git a/.gitignore b/.gitignore index c18dd8d..c1e64c1 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ __pycache__/ +.coverage diff --git a/pyproject.toml b/pyproject.toml index 98a6c94..91f02b9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,11 +5,11 @@ build-backend = "hatchling.build" [project] name = "django-healthy" dynamic = ["version"] -description = '' +description = "Simple health checking for django applications" readme = "README.md" requires-python = ">=3.8" license = "MIT" -keywords = [] +keywords = ["django"] authors = [ { name = "Christian Hartung", email = "christian.hartung@olist.com" }, ] @@ -35,6 +35,29 @@ Documentation = "https://github.com/olist/django-healthy#readme" Issues = "https://github.com/olist/django-healthy/issues" Source = "https://github.com/olist/django-healthy" +[tool.coverage.run] +source_pkgs = ["healthy", "tests"] +branch = true +parallel = true +omit = [ + "src/healthy/__about__.py", +] + +[tool.coverage.paths] +healthy = ["src/healthy", "*/django-healthy/src/healthy"] +tests = ["tests", "*/django-healthy/tests"] + +[tool.coverage.report] +exclude_lines = [ + "no cov", + "if __name__ == .__main__.:", + "if TYPE_CHECKING:", +] + +[tool.pytest.ini_options] +DJANGO_SETTINGS_MODULE = "tests.settings" +pythonpath = [".", "src"] + [tool.hatch.build.targets.wheel] packages = ["src/healthy"] @@ -63,32 +86,23 @@ cov = [ [[tool.hatch.envs.all.matrix]] python = ["3.8", "3.9", "3.10", "3.11", "3.12"] +[tool.hatch.envs.tests.overrides] +matrix.django.dependencies = [ + { value = "django>=4.2,<5.0", if = ["4.2"] }, + { value = "django>=5.0,<5.1", if = ["5.0"] }, +] + +[[tool.hatch.envs.tests.matrix]] +django = ["4.2"] +python = ["3.8", "3.9", "3.10", "3.11", "3.12"] + +[[tool.hatch.envs.tests.matrix]] +django = ["5.0"] +python = ["3.10", "3.11", "3.12"] + [tool.hatch.envs.types] dependencies = [ "mypy>=1.0.0", ] [tool.hatch.envs.types.scripts] check = "mypy --install-types --non-interactive {args:src/healthy tests}" - -[tool.coverage.run] -source_pkgs = ["healthy", "tests"] -branch = true -parallel = true -omit = [ - "src/healthy/__about__.py", -] - -[tool.coverage.paths] -healthy = ["src/healthy", "*/django-healthy/src/healthy"] -tests = ["tests", "*/django-healthy/tests"] - -[tool.coverage.report] -exclude_lines = [ - "no cov", - "if __name__ == .__main__.:", - "if TYPE_CHECKING:", -] - -[tool.pytest.ini_options] -DJANGO_SETTINGS_MODULE = "tests.settings" -pythonpath = [".", "src"]