Skip to content

Commit d609c89

Browse files
authored
Add code coverage with Codecov (#5)
1 parent 4e96747 commit d609c89

5 files changed

Lines changed: 89 additions & 51 deletions

File tree

.github/workflows/lint.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Lint
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
lint:
11+
name: Lint & Type Check
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- uses: actions/setup-python@v5
17+
with:
18+
python-version: "3.12"
19+
20+
- name: Install dependencies
21+
run: |
22+
python -m pip install --upgrade pip
23+
pip install -e ".[dev]"
24+
25+
- name: Ruff check
26+
run: ruff check .
27+
28+
- name: Ruff format check
29+
run: ruff format --check .
30+
31+
- name: isort check
32+
run: isort --check .
33+
34+
- name: Pyright
35+
run: pyright
Lines changed: 11 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: CI
1+
name: Integration Tests
22

33
on:
44
push:
@@ -7,56 +7,8 @@ on:
77
branches: [main]
88

99
jobs:
10-
lint:
11-
name: Lint & Type Check
12-
runs-on: ubuntu-latest
13-
steps:
14-
- uses: actions/checkout@v4
15-
16-
- uses: actions/setup-python@v5
17-
with:
18-
python-version: "3.12"
19-
20-
- name: Install dependencies
21-
run: |
22-
python -m pip install --upgrade pip
23-
pip install -e ".[dev]"
24-
25-
- name: Ruff check
26-
run: ruff check .
27-
28-
- name: Ruff format check
29-
run: ruff format --check .
30-
31-
- name: isort check
32-
run: isort --check .
33-
34-
- name: Pyright
35-
run: pyright
36-
37-
test-unit:
38-
name: Unit Tests (Python ${{ matrix.python-version }})
39-
runs-on: ubuntu-latest
40-
strategy:
41-
matrix:
42-
python-version: ["3.12", "3.13"]
43-
steps:
44-
- uses: actions/checkout@v4
45-
46-
- uses: actions/setup-python@v5
47-
with:
48-
python-version: ${{ matrix.python-version }}
49-
50-
- name: Install dependencies
51-
run: |
52-
python -m pip install --upgrade pip
53-
pip install -e ".[dev]"
54-
55-
- name: Run unit tests
56-
run: pytest tests/ -v --ignore=tests/integration/
57-
5810
test-integration:
59-
name: Integration Tests (NC ${{ matrix.nextcloud-version }})
11+
name: NC ${{ matrix.nextcloud-version }}
6012
runs-on: ubuntu-latest
6113
strategy:
6214
fail-fast: false
@@ -115,7 +67,15 @@ jobs:
11567
NEXTCLOUD_URL: http://localhost:8080
11668
NEXTCLOUD_USER: admin
11769
NEXTCLOUD_PASSWORD: admin
118-
run: pytest tests/integration/ -v -m integration
70+
run: pytest tests/integration/ -v -m integration --cov=nextcloud_mcp --cov-report=xml:coverage-integration.xml
71+
72+
- name: Upload coverage
73+
uses: codecov/codecov-action@v5
74+
with:
75+
files: coverage-integration.xml
76+
flags: integration,nc${{ matrix.nextcloud-version }}
77+
token: ${{ secrets.CODECOV_TOKEN }}
78+
fail_ci_if_error: false
11979

12080
- name: Dump Nextcloud logs on failure
12181
if: failure()

.github/workflows/tests-unit.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Unit Tests
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
test-unit:
11+
name: Python ${{ matrix.python-version }}
12+
runs-on: ubuntu-latest
13+
strategy:
14+
matrix:
15+
python-version: ["3.12", "3.13"]
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- uses: actions/setup-python@v5
20+
with:
21+
python-version: ${{ matrix.python-version }}
22+
23+
- name: Install dependencies
24+
run: |
25+
python -m pip install --upgrade pip
26+
pip install -e ".[dev]"
27+
28+
- name: Run unit tests
29+
run: pytest tests/ -v --ignore=tests/integration/ --cov=nextcloud_mcp --cov-report=xml:coverage-unit.xml
30+
31+
- name: Upload coverage
32+
uses: codecov/codecov-action@v5
33+
with:
34+
files: coverage-unit.xml
35+
flags: unit,py${{ matrix.python-version }}
36+
token: ${{ secrets.CODECOV_TOKEN }}
37+
fail_ci_if_error: false

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Nextcloud MCP Server
22

3+
[![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)
4+
[![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)
5+
[![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)
6+
[![codecov](https://codecov.io/gh/cloud-py-api/nextcloud-mcp-server/graph/badge.svg)](https://codecov.io/gh/cloud-py-api/nextcloud-mcp-server)
7+
38
> **Experimental** — This repository is fully maintained by AI (Claude). It serves as an experiment in autonomous AI-driven open-source development.
49
510
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.

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ optional-dependencies.dev = [
3333
"pyright>=1.1",
3434
"pytest>=8",
3535
"pytest-asyncio>=0.24",
36+
"pytest-cov>=6",
3637
"ruff>=0.8",
3738
]
3839
scripts.nextcloud-mcp = "nextcloud_mcp.__main__:main"

0 commit comments

Comments
 (0)