diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..6f86e63 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,35 @@ +name: Lint + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + lint: + name: Lint & Type Check + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-python@v5 + with: + python-version: "3.12" + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -e ".[dev]" + + - name: Ruff check + run: ruff check . + + - name: Ruff format check + run: ruff format --check . + + - name: isort check + run: isort --check . + + - name: Pyright + run: pyright diff --git a/.github/workflows/ci.yml b/.github/workflows/tests-integration.yml similarity index 68% rename from .github/workflows/ci.yml rename to .github/workflows/tests-integration.yml index 0a36051..3c04037 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/tests-integration.yml @@ -1,4 +1,4 @@ -name: CI +name: Integration Tests on: push: @@ -7,56 +7,8 @@ on: branches: [main] jobs: - lint: - name: Lint & Type Check - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - uses: actions/setup-python@v5 - with: - python-version: "3.12" - - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install -e ".[dev]" - - - name: Ruff check - run: ruff check . - - - name: Ruff format check - run: ruff format --check . - - - name: isort check - run: isort --check . - - - name: Pyright - run: pyright - - test-unit: - name: Unit Tests (Python ${{ matrix.python-version }}) - runs-on: ubuntu-latest - strategy: - matrix: - python-version: ["3.12", "3.13"] - steps: - - uses: actions/checkout@v4 - - - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install -e ".[dev]" - - - name: Run unit tests - run: pytest tests/ -v --ignore=tests/integration/ - test-integration: - name: Integration Tests (NC ${{ matrix.nextcloud-version }}) + name: NC ${{ matrix.nextcloud-version }} runs-on: ubuntu-latest strategy: fail-fast: false @@ -115,7 +67,15 @@ jobs: NEXTCLOUD_URL: http://localhost:8080 NEXTCLOUD_USER: admin NEXTCLOUD_PASSWORD: admin - run: pytest tests/integration/ -v -m integration + run: pytest tests/integration/ -v -m integration --cov=nextcloud_mcp --cov-report=xml:coverage-integration.xml + + - name: Upload coverage + uses: codecov/codecov-action@v5 + with: + files: coverage-integration.xml + flags: integration,nc${{ matrix.nextcloud-version }} + token: ${{ secrets.CODECOV_TOKEN }} + fail_ci_if_error: false - name: Dump Nextcloud logs on failure if: failure() diff --git a/.github/workflows/tests-unit.yml b/.github/workflows/tests-unit.yml new file mode 100644 index 0000000..77135fa --- /dev/null +++ b/.github/workflows/tests-unit.yml @@ -0,0 +1,37 @@ +name: Unit Tests + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + test-unit: + name: Python ${{ matrix.python-version }} + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.12", "3.13"] + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -e ".[dev]" + + - name: Run unit tests + run: pytest tests/ -v --ignore=tests/integration/ --cov=nextcloud_mcp --cov-report=xml:coverage-unit.xml + + - name: Upload coverage + uses: codecov/codecov-action@v5 + with: + files: coverage-unit.xml + flags: unit,py${{ matrix.python-version }} + token: ${{ secrets.CODECOV_TOKEN }} + fail_ci_if_error: false diff --git a/README.md b/README.md index 213102f..a1d6b62 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,10 @@ # Nextcloud MCP Server +[![Lint](https://github.com/cloud-py-api/nextcloud-mcp-server/actions/workflows/lint.yml/badge.svg)](https://github.com/cloud-py-api/nextcloud-mcp-server/actions/workflows/lint.yml) +[![Unit Tests](https://github.com/cloud-py-api/nextcloud-mcp-server/actions/workflows/tests-unit.yml/badge.svg)](https://github.com/cloud-py-api/nextcloud-mcp-server/actions/workflows/tests-unit.yml) +[![Integration Tests](https://github.com/cloud-py-api/nextcloud-mcp-server/actions/workflows/tests-integration.yml/badge.svg)](https://github.com/cloud-py-api/nextcloud-mcp-server/actions/workflows/tests-integration.yml) +[![codecov](https://codecov.io/gh/cloud-py-api/nextcloud-mcp-server/graph/badge.svg)](https://codecov.io/gh/cloud-py-api/nextcloud-mcp-server) + > **Experimental** — This repository is fully maintained by AI (Claude). It serves as an experiment in autonomous AI-driven open-source development. An [MCP (Model Context Protocol)](https://modelcontextprotocol.io/) server that exposes Nextcloud APIs as tools for AI assistants. Connect any MCP-compatible client (Claude Desktop, Claude Code, etc.) to your Nextcloud instance and let AI manage files, read notifications, interact with Talk, and more. diff --git a/pyproject.toml b/pyproject.toml index c8bd869..30e63c0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -33,6 +33,7 @@ optional-dependencies.dev = [ "pyright>=1.1", "pytest>=8", "pytest-asyncio>=0.24", + "pytest-cov>=6", "ruff>=0.8", ] scripts.nextcloud-mcp = "nextcloud_mcp.__main__:main"