Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Enforce python project coverage [TSD-1611] #27

Merged
merged 11 commits into from
May 30, 2023
7 changes: 7 additions & 0 deletions .github/workflows/python-run-checks-and-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ on:
type: string
required: false
default: "3.8"
skip-coverage-check:
description: Set to true to disable enforcement of 100% code coverage.
type: boolean
required: false
default: false

secrets:
private-package-repo-username:
required: false
Expand Down Expand Up @@ -82,6 +88,7 @@ jobs:
with:
module: ${{ inputs.module }}
additional-modules-to-lint: ${{ inputs.additional-modules-to-lint }}
skip-coverage-check: ${{ inputs.skip-coverage-check }}
env:
AWS_DEFAULT_REGION: us-east-1

Expand Down
9 changes: 9 additions & 0 deletions python/run-checks/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ inputs:
description: The directory (or path from the project root) containing the pytests to run. Defaults to "tests".
required: false
default: tests
skip-coverage-check:
description: Set to true to disable enforcement of 100% code coverage.
required: false
default: false

runs:
using: composite
Expand Down Expand Up @@ -53,3 +57,8 @@ runs:
- name: Run pytest
shell: bash
run: poetry run pytest --cov=${{ inputs.module }} --cov-report=term-missing ${{ inputs.test-dir }}

- name: Enforce 100% Test Coverage
if: ${{ inputs.skip-coverage-check == 'false' }}
shell: bash
run: poetry run coverage report --fail-under=100