From 1fd181337c8457db101447071ecdd38a9c810094 Mon Sep 17 00:00:00 2001 From: Alexander Piskun Date: Tue, 24 Mar 2026 06:45:41 +0000 Subject: [PATCH 1/4] Add code coverage with Codecov integration and README badges --- .github/workflows/ci.yml | 20 ++++++++++++++++++-- README.md | 3 +++ pyproject.toml | 1 + 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0a36051..c3cdfcc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -53,7 +53,15 @@ jobs: pip install -e ".[dev]" - name: Run unit tests - run: pytest tests/ -v --ignore=tests/integration/ + run: pytest tests/ -v --ignore=tests/integration/ --cov=nextcloud_mcp --cov-report=xml:coverage-unit.xml + + - name: Upload unit test coverage + if: matrix.python-version == '3.12' + uses: codecov/codecov-action@v5 + with: + files: coverage-unit.xml + flags: unit + fail_ci_if_error: false test-integration: name: Integration Tests (NC ${{ matrix.nextcloud-version }}) @@ -115,7 +123,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 integration test coverage + if: matrix.nextcloud-version == '33' + uses: codecov/codecov-action@v5 + with: + files: coverage-integration.xml + flags: integration + fail_ci_if_error: false - name: Dump Nextcloud logs on failure if: failure() diff --git a/README.md b/README.md index 213102f..284f8ce 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,8 @@ # Nextcloud MCP Server +[![CI](https://github.com/cloud-py-api/nextcloud-mcp-server/actions/workflows/ci.yml/badge.svg)](https://github.com/cloud-py-api/nextcloud-mcp-server/actions/workflows/ci.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" From a824bfaec03245c92c5c0f93b17a0db27fa2ab50 Mon Sep 17 00:00:00 2001 From: Alexander Piskun Date: Tue, 24 Mar 2026 06:48:03 +0000 Subject: [PATCH 2/4] Upload coverage from all matrix jobs, not just one --- .github/workflows/ci.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c3cdfcc..0843b85 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -56,11 +56,10 @@ jobs: run: pytest tests/ -v --ignore=tests/integration/ --cov=nextcloud_mcp --cov-report=xml:coverage-unit.xml - name: Upload unit test coverage - if: matrix.python-version == '3.12' uses: codecov/codecov-action@v5 with: files: coverage-unit.xml - flags: unit + flags: unit,py${{ matrix.python-version }} fail_ci_if_error: false test-integration: @@ -126,11 +125,10 @@ jobs: run: pytest tests/integration/ -v -m integration --cov=nextcloud_mcp --cov-report=xml:coverage-integration.xml - name: Upload integration test coverage - if: matrix.nextcloud-version == '33' uses: codecov/codecov-action@v5 with: files: coverage-integration.xml - flags: integration + flags: integration,nc${{ matrix.nextcloud-version }} fail_ci_if_error: false - name: Dump Nextcloud logs on failure From 7e014d0d13a102fe618b6fc5a180c10e819ca176 Mon Sep 17 00:00:00 2001 From: Alexander Piskun Date: Tue, 24 Mar 2026 06:50:06 +0000 Subject: [PATCH 3/4] Split CI into separate lint, unit test, and integration test workflows --- .github/workflows/lint.yml | 35 +++++++++++ .../{ci.yml => tests-integration.yml} | 61 +------------------ .github/workflows/tests-unit.yml | 36 +++++++++++ README.md | 4 +- 4 files changed, 77 insertions(+), 59 deletions(-) create mode 100644 .github/workflows/lint.yml rename .github/workflows/{ci.yml => tests-integration.yml} (66%) create mode 100644 .github/workflows/tests-unit.yml 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 66% rename from .github/workflows/ci.yml rename to .github/workflows/tests-integration.yml index 0843b85..0dc4a98 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/tests-integration.yml @@ -1,4 +1,4 @@ -name: CI +name: Integration Tests on: push: @@ -7,63 +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/ --cov=nextcloud_mcp --cov-report=xml:coverage-unit.xml - - - name: Upload unit test coverage - uses: codecov/codecov-action@v5 - with: - files: coverage-unit.xml - flags: unit,py${{ matrix.python-version }} - fail_ci_if_error: false - test-integration: - name: Integration Tests (NC ${{ matrix.nextcloud-version }}) + name: NC ${{ matrix.nextcloud-version }} runs-on: ubuntu-latest strategy: fail-fast: false @@ -124,7 +69,7 @@ jobs: NEXTCLOUD_PASSWORD: admin run: pytest tests/integration/ -v -m integration --cov=nextcloud_mcp --cov-report=xml:coverage-integration.xml - - name: Upload integration test coverage + - name: Upload coverage uses: codecov/codecov-action@v5 with: files: coverage-integration.xml diff --git a/.github/workflows/tests-unit.yml b/.github/workflows/tests-unit.yml new file mode 100644 index 0000000..d7e6ece --- /dev/null +++ b/.github/workflows/tests-unit.yml @@ -0,0 +1,36 @@ +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 }} + fail_ci_if_error: false diff --git a/README.md b/README.md index 284f8ce..a1d6b62 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ # Nextcloud MCP Server -[![CI](https://github.com/cloud-py-api/nextcloud-mcp-server/actions/workflows/ci.yml/badge.svg)](https://github.com/cloud-py-api/nextcloud-mcp-server/actions/workflows/ci.yml) +[![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. From 14333b6e67ab165ba2625a51c2f9732beddbf7d0 Mon Sep 17 00:00:00 2001 From: Alexander Piskun Date: Tue, 24 Mar 2026 07:07:12 +0000 Subject: [PATCH 4/4] Add CODECOV_TOKEN to coverage upload steps --- .github/workflows/tests-integration.yml | 1 + .github/workflows/tests-unit.yml | 1 + 2 files changed, 2 insertions(+) diff --git a/.github/workflows/tests-integration.yml b/.github/workflows/tests-integration.yml index 0dc4a98..3c04037 100644 --- a/.github/workflows/tests-integration.yml +++ b/.github/workflows/tests-integration.yml @@ -74,6 +74,7 @@ jobs: 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 diff --git a/.github/workflows/tests-unit.yml b/.github/workflows/tests-unit.yml index d7e6ece..77135fa 100644 --- a/.github/workflows/tests-unit.yml +++ b/.github/workflows/tests-unit.yml @@ -33,4 +33,5 @@ jobs: with: files: coverage-unit.xml flags: unit,py${{ matrix.python-version }} + token: ${{ secrets.CODECOV_TOKEN }} fail_ci_if_error: false