Skip to content

Commit beab7f1

Browse files
committed
Added support for coverage report generation
1 parent f0a0dde commit beab7f1

File tree

31 files changed

+1122
-31
lines changed

31 files changed

+1122
-31
lines changed

.github/workflows/build.yml

Lines changed: 52 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,12 @@ jobs:
4343

4444
- name: Test
4545
working-directory: src/${{ matrix.directory }}
46-
run: uv run pytest
46+
run: |
47+
uv run pytest --cov=. --cov-branch --cov-report=html:htmlcov/${{ matrix.directory }} --cov-report=term-missing
48+
pwd
49+
ls -la
50+
env:
51+
COVERAGE_FILE: .coverage.${{ matrix.directory }}
4752

4853
- name: Build
4954
working-directory: src/${{ matrix.directory }}
@@ -53,6 +58,15 @@ jobs:
5358
working-directory: src/${{ matrix.directory }}
5459
run: uv pip install .
5560

61+
- name: Upload coverage report
62+
uses: actions/upload-artifact@v4
63+
with:
64+
name: ${{ matrix.directory }}-coverage-report
65+
path: |
66+
src/${{ matrix.directory }}/htmlcov/*
67+
src/${{ matrix.directory }}/.coverage.${{ matrix.directory }}
68+
include-hidden-files: true
69+
5670
get-directories:
5771
runs-on: ubuntu-latest
5872
outputs:
@@ -66,3 +80,40 @@ jobs:
6680
run: |
6781
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]')
6882
echo "directories=$directories" >> $GITHUB_OUTPUT
83+
84+
combined-coverage:
85+
runs-on: ubuntu-latest
86+
needs: build
87+
steps:
88+
- name: Checkout code
89+
uses: actions/checkout@v4
90+
91+
- name: Set up Python
92+
uses: actions/setup-python@v5
93+
with:
94+
python-version: "3.13"
95+
96+
- name: Install requirements
97+
run: pip install -r requirements-dev.txt
98+
99+
- name: Download Artifacts
100+
uses: actions/download-artifact@v4
101+
with:
102+
pattern: '*-coverage-report' # Downloads all artifacts starting with 'my-artifact-'
103+
merge-multiple: true # Merges the contents of multiple artifacts into a single directory
104+
105+
- name: Combine Coverage reports
106+
run: |
107+
uv run coverage combine
108+
uv run coverage html -d oracle-mcp-coverage-report
109+
uv run coverage report --fail-under=79
110+
111+
- name: Upload combined reports
112+
uses: actions/upload-artifact@v4
113+
with:
114+
name: all-in-one-coverage-report
115+
path: |
116+
oracle-mcp-coverage-report/*
117+
.coverage
118+
include-hidden-files: true
119+

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,5 @@ venv.bak/
2020

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

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ test:
4949
@for dir in $(SUBDIRS); do \
5050
if [ -f $$dir/pyproject.toml ]; then \
5151
echo "Testing $$dir"; \
52-
cd $$dir && uv sync && uv run pytest && cd ../..; \
52+
cd $$dir && uv sync && uv run pytest --cov=. --cov-branch --cov-report=html --cov-report=term-missing && cd ../..; \
5353
fi \
5454
done
5555

requirements-dev.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
-r requirements.txt
22
pytest
33
pytest-asyncio
4+
pytest-cov
45
tox
56
tomlq
67
uv

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: 78 additions & 1 deletion
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: 77 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-compute-mcp-server/uv.lock

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

0 commit comments

Comments
 (0)