diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000..d6cf8778 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,35 @@ +name: Tests + +on: + push: + branches: [main] + pull_request: + workflow_dispatch: + +jobs: + test: + runs-on: ubuntu-latest + permissions: + contents: read + + steps: + - name: Checkout repo + uses: actions/checkout@v4 + + # PERFORMANCE: Cache pip dependencies to speed up CI runs + # Cache key is based on pyproject.toml hash since dev deps are defined there + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.13' + cache: 'pip' + cache-dependency-path: 'pyproject.toml' + + # Install the package with dev dependencies (pytest, pytest-mock, pytest-xdist) + - name: Install dependencies + run: pip install -e ".[dev]" + + # PERFORMANCE: -n auto enables parallel execution via pytest-xdist, + # distributing tests across available CPU cores for 40%+ faster runs + - name: Run tests + run: pytest tests/ -n auto diff --git a/pyproject.toml b/pyproject.toml index 484682a8..0dcef79a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -16,3 +16,9 @@ dev = [ "pytest-xdist>=3.0.0", "pytest-benchmark>=4.0.0", ] + +[tool.pytest.ini_options] +testpaths = ["tests"] +python_files = "test_*.py" +python_functions = "test_*" +addopts = "-v --strict-markers"