Skip to content

Commit 2998a8e

Browse files
Abel Milashclaude
andcommitted
Add 90% coverage enforcement and diff-cover for new changes
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent dcb6ea1 commit 2998a8e

2 files changed

Lines changed: 15 additions & 5 deletions

File tree

.azdo/ci-pr.yaml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ extends:
4242

4343
- script: |
4444
python -m pip install --upgrade pip
45-
python -m pip install flake8 black build
45+
python -m pip install flake8 black build diff-cover
4646
python -m pip install -e .[dev]
4747
displayName: 'Install dependencies'
4848
@@ -66,9 +66,14 @@ extends:
6666
displayName: 'Install wheel'
6767
6868
- script: |
69-
pytest --junitxml=test-results.xml --cov=PowerPlatform --cov-report=xml --cov-report=term-missing
69+
pytest --junitxml=test-results.xml --cov=PowerPlatform --cov-report=xml --cov-report=term-missing --cov-fail-under=90
7070
displayName: 'Test with pytest'
71-
71+
72+
- script: |
73+
git fetch origin main
74+
diff-cover coverage.xml --compare-branch=origin/main --fail-under=90
75+
displayName: 'Diff coverage (90% for new changes)'
76+
7277
- task: PublishTestResults@2
7378
condition: succeededOrFailed()
7479
inputs:

.github/workflows/python-package.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
- name: Install dependencies
2828
run: |
2929
python -m pip install --upgrade pip
30-
python -m pip install flake8 black build
30+
python -m pip install flake8 black build diff-cover
3131
python -m pip install -e .[dev]
3232
3333
- name: Check format with black
@@ -51,7 +51,12 @@ jobs:
5151
5252
- name: Test with pytest
5353
run: |
54-
pytest --junitxml=test-results.xml --cov=PowerPlatform --cov-report=xml --cov-report=term-missing
54+
pytest --junitxml=test-results.xml --cov=PowerPlatform --cov-report=xml --cov-report=term-missing --cov-fail-under=90
55+
56+
- name: Diff coverage (90% for new changes)
57+
run: |
58+
git fetch origin ${{ github.base_ref }}
59+
diff-cover coverage.xml --compare-branch=origin/${{ github.base_ref }} --fail-under=90
5560
5661
- name: Upload test results
5762
if: always()

0 commit comments

Comments
 (0)