Skip to content

Commit 7347aab

Browse files
committed
chore: added support for coverage report generation
- updated the github actions to generate the coveragre report per MCP server - updated the github actions to create a combined coverage report
1 parent c36757f commit 7347aab

File tree

28 files changed

+90
-5
lines changed

28 files changed

+90
-5
lines changed

.github/workflows/build.yml

Lines changed: 50 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,11 @@ jobs:
4141
working-directory: src/${{ matrix.directory }}
4242
run: uv sync --locked --all-extras --dev
4343

44-
- name: Test
44+
- name: Test and Coverage
4545
working-directory: src/${{ matrix.directory }}
46-
run: uv run pytest
46+
run: uv run pytest --cov=. --cov-branch --cov-report=html:htmlcov/${{ matrix.directory }} --cov-report=term-missing
47+
env:
48+
COVERAGE_FILE: .coverage.${{ matrix.directory }}
4749

4850
- name: Build
4951
working-directory: src/${{ matrix.directory }}
@@ -53,6 +55,15 @@ jobs:
5355
working-directory: src/${{ matrix.directory }}
5456
run: uv pip install .
5557

58+
- name: Upload coverage report
59+
uses: actions/upload-artifact@v4
60+
with:
61+
name: ${{ matrix.directory }}-coverage-report
62+
path: |
63+
src/${{ matrix.directory }}/htmlcov/*
64+
src/${{ matrix.directory }}/.coverage.${{ matrix.directory }}
65+
include-hidden-files: true
66+
5667
get-directories:
5768
runs-on: ubuntu-latest
5869
outputs:
@@ -66,3 +77,40 @@ jobs:
6677
run: |
6778
directories=$(ls src | grep -v dbtools-mcp-server | grep -v mysql-mcp-server | grep -v oci-pricing-mcp-server | grep -v oracle-db-doc-mcp-server | jq -R -s -c 'split("\n")[:-1]')
6879
echo "directories=$directories" >> $GITHUB_OUTPUT
80+
81+
combined-coverage:
82+
runs-on: ubuntu-latest
83+
needs: build
84+
steps:
85+
- name: Checkout code
86+
uses: actions/checkout@v4
87+
88+
- name: Set up Python
89+
uses: actions/setup-python@v5
90+
with:
91+
python-version: "3.13"
92+
93+
- name: Install requirements
94+
run: pip install -r requirements-dev.txt
95+
96+
- name: Download Artifacts
97+
uses: actions/download-artifact@v4
98+
with:
99+
pattern: '*-coverage-report' # Downloads all artifacts starting with 'my-artifact-'
100+
merge-multiple: true # Merges the contents of multiple artifacts into a single directory
101+
102+
- name: Combine Coverage reports
103+
run: |
104+
uv run coverage combine
105+
uv run coverage html -d oracle-mcp-coverage-report
106+
uv run coverage report --fail-under=79
107+
108+
- name: Upload combined reports
109+
uses: actions/upload-artifact@v4
110+
with:
111+
name: all-in-one-coverage-report
112+
path: |
113+
oracle-mcp-coverage-report/*
114+
.coverage
115+
include-hidden-files: true
116+

.gitignore

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,5 @@ venv.bak/
2020

2121
# test environments
2222
.env
23-
24-
.coverage
25-
htmlcov/
23+
.coverage*
24+
htmlcov

src/oci-api-mcp-server/pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ authors = [
1212
dependencies = [
1313
"fastmcp==2.12.2",
1414
"oci==2.160.0",
15+
"pytest-cov>=7.0.0",
1516
]
1617

1718
classifiers = [

src/oci-api-mcp-server/uv.lock

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/oci-compute-instance-agent-mcp-server/pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ authors = [
1212
dependencies = [
1313
"oci==2.160.0",
1414
"fastmcp==2.12.2",
15+
"pytest-cov>=7.0.0",
1516
]
1617

1718
classifiers = [

src/oci-compute-instance-agent-mcp-server/uv.lock

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/oci-compute-mcp-server/pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ dependencies = [
1313
"fastmcp==2.12.2",
1414
"oci==2.160.0",
1515
"pydantic==2.12.3",
16+
"pytest-cov>=7.0.0",
1617
]
1718

1819
classifiers = [

src/oci-identity-mcp-server/pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ authors = [
1212
dependencies = [
1313
"fastmcp==2.12.2",
1414
"oci==2.160.0",
15+
"pytest-cov>=7.0.0",
1516
]
1617

1718
classifiers = [

src/oci-identity-mcp-server/uv.lock

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/oci-logging-mcp-server/pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ requires-python = ">=3.13"
1010
dependencies = [
1111
"fastmcp==2.12.2",
1212
"oci==2.160.0",
13+
"pytest-cov>=7.0.0",
1314
]
1415

1516
classifiers = [

0 commit comments

Comments
 (0)