Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions .github/workflows/code-coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: "Code Coverage"
on:
pull_request:
branches: [ "main", "master" ]

jobs:
coverage:
name: Overall Coverage Check
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
contents: read
pull-requests: write

strategy:
matrix:
python-version: ["3.11"]

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Install tox
run: |
python -m pip install --upgrade pip
pip install tox

- name: Run Unit Tests with Coverage
run: |
tox -e coverage

- name: Upload Coverage Report
uses: actions/upload-artifact@v4
if: always()
with:
name: coverage-report
path: coverage.xml
8 changes: 8 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,11 @@ commands =
description = Run integration tests
commands =
pytest test/integration_tests
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need a threshold minimum coverage for integ tests as well ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's hard to say... from what I've seen, integ test code coverage is much lower than unit test. I'm not sure what would be a good threshold


[testenv:coverage]
description = Run unit tests with coverage
deps =
pytest-cov
-e .
commands =
pytest test/unit_tests --cov=sagemaker.hyperpod --cov-report=term-missing --cov-report=xml:coverage.xml --cov-fail-under=70
Loading