Skip to content
This repository has been archived by the owner on Sep 2, 2024. It is now read-only.

chore: add Github actions test pipeline #2

Merged
merged 1 commit into from
Apr 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: CI

on:
push:
branches:
- main
pull_request:

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 }} test
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
__pycache__/
.coverage
64 changes: 39 additions & 25 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" },
]
Expand All @@ -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"]

Expand Down Expand Up @@ -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"]