From 36794513035b459953505a75ecf052c4c35286f6 Mon Sep 17 00:00:00 2001 From: rahul-tuli Date: Fri, 29 Sep 2023 11:43:00 -0400 Subject: [PATCH 1/4] Add basic coverage --- .github/workflows/code-coverage.yaml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 .github/workflows/code-coverage.yaml diff --git a/.github/workflows/code-coverage.yaml b/.github/workflows/code-coverage.yaml new file mode 100644 index 00000000000..2dfba58dcce --- /dev/null +++ b/.github/workflows/code-coverage.yaml @@ -0,0 +1,14 @@ +name: 'coverage' +on: + pull_request: + branches: + - main +jobs: + coverage: + runs-on: ubuntu-latest + steps: + - name: Report Coverage + uses: orgoro/coverage@v3.1 + with: + coverageFile: coverage.xml + token: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file From d7dc92e7141abe146db39411988d9442d3a4a3bb Mon Sep 17 00:00:00 2001 From: rahul-tuli Date: Fri, 29 Sep 2023 11:50:17 -0400 Subject: [PATCH 2/4] Move coverage to test-check.yaml --- .github/workflows/test-check.yaml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/test-check.yaml b/.github/workflows/test-check.yaml index 65fc6908ca3..1dbb72d4b17 100644 --- a/.github/workflows/test-check.yaml +++ b/.github/workflows/test-check.yaml @@ -197,3 +197,13 @@ jobs: run: pip3 install .[dev,torchvision,onnxruntime] torch==1.9.1 - name: "🔬 Running onnx tests" run: make test TARGETS=onnx + coverage: + runs-on: ubuntu-latest + steps: + - run: pytest --cov=src --cov-report=xml:coverage.xml + + - name: Report Coverage + uses: orgoro/coverage@v3.1 + with: + coverageFile: coverage.xml + token: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file From 960ee76c3a3427843d1a306030e51f0d47179e8e Mon Sep 17 00:00:00 2001 From: rahul-tuli Date: Fri, 29 Sep 2023 11:56:48 -0400 Subject: [PATCH 3/4] Update Make file Add pytest cov in dev dependencies --- .github/workflows/test-check.yaml | 34 ++++++++++++++++++++++++------- Makefile | 2 ++ setup.py | 1 + 3 files changed, 30 insertions(+), 7 deletions(-) diff --git a/.github/workflows/test-check.yaml b/.github/workflows/test-check.yaml index 1dbb72d4b17..2572e6ca3fa 100644 --- a/.github/workflows/test-check.yaml +++ b/.github/workflows/test-check.yaml @@ -77,6 +77,11 @@ jobs: run: pip3 install .[dev,onnxruntime] - name: "🔬 Running base tests" run: make test + - name: Report Coverage + uses: orgoro/coverage@v3.1 + with: + coverageFile: coverage.xml + token: ${{ secrets.GITHUB_TOKEN }} deepsparse-tests: runs-on: ubuntu-22.04 env: @@ -101,6 +106,11 @@ jobs: run: pip3 install .[dev,deepsparse,onnxruntime] - name: "🔬 Running deepsparse tests" run: make test TARGETS=deepsparse + - name: Report Coverage + uses: orgoro/coverage@v3.1 + with: + coverageFile: coverage.xml + token: ${{ secrets.GITHUB_TOKEN }} onnx-tests: runs-on: ubuntu-22.04 env: @@ -125,6 +135,11 @@ jobs: run: pip3 install .[dev,torchvision,onnxruntime] - name: "🔬 Running onnx tests" run: make test TARGETS=onnx + - name: Report Coverage + uses: orgoro/coverage@v3.1 + with: + coverageFile: coverage.xml + token: ${{ secrets.GITHUB_TOKEN }} pytorch-tests: runs-on: ubuntu-22.04 env: @@ -149,6 +164,11 @@ jobs: run: pip3 install .[dev,torchvision,onnxruntime] - name: "🔬 Running pytorch tests" run: make test TARGETS=pytorch + - name: Report Coverage + uses: orgoro/coverage@v3.1 + with: + coverageFile: coverage.xml + token: ${{ secrets.GITHUB_TOKEN }} compat-pytorch-1_9-pytorch-tests: runs-on: ubuntu-22.04 env: @@ -173,6 +193,11 @@ jobs: run: pip3 install .[dev,torchvision,onnxruntime] torch==1.9.1 - name: "🔬 Running pytorch tests" run: make test TARGETS=pytorch + - name: Report Coverage + uses: orgoro/coverage@v3.1 + with: + coverageFile: coverage.xml + token: ${{ secrets.GITHUB_TOKEN }} compat-pytorch-1_9-onnx-tests: runs-on: ubuntu-22.04 env: @@ -196,14 +221,9 @@ jobs: - name: "⚙️ Install dependencies" run: pip3 install .[dev,torchvision,onnxruntime] torch==1.9.1 - name: "🔬 Running onnx tests" - run: make test TARGETS=onnx - coverage: - runs-on: ubuntu-latest - steps: - - run: pytest --cov=src --cov-report=xml:coverage.xml - + run: make test TARGETS=onnx - name: Report Coverage uses: orgoro/coverage@v3.1 with: coverageFile: coverage.xml - token: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file + token: ${{ secrets.GITHUB_TOKEN }} diff --git a/Makefile b/Makefile index c8600e281c9..e2f31b0d2d7 100644 --- a/Makefile +++ b/Makefile @@ -74,11 +74,13 @@ style: test: @echo "Running python tests"; SPARSEZOO_TEST_MODE="true" pytest tests $(PYTEST_ARGS) --ignore tests/integrations + pytest --cov=src --cov-report=xml:coverage.xml # run integration tests testinteg: @echo "Running integration tests"; SPARSEZOO_TEST_MODE="true" pytest -x -ls tests/integrations $(PYTEST_INTEGRATION_ARGS) + pytest --cov=src --cov-report=xml:coverage.xml # create docs docs: diff --git a/setup.py b/setup.py index 29c9a903dae..e8b49187b7f 100644 --- a/setup.py +++ b/setup.py @@ -115,6 +115,7 @@ "sphinx-rtd-theme~=0.5.0", "wheel>=0.36.2", "pytest~=6.2.0", + "pytest-cov~=2.11.0", "pytest-mock~=3.6.0", "flaky~=3.7.0", "sphinx-rtd-theme", From 6b8f64793d5911a0b0277983c15bea8a71d3f854 Mon Sep 17 00:00:00 2001 From: rahul-tuli Date: Fri, 29 Sep 2023 11:57:30 -0400 Subject: [PATCH 4/4] delete code-coverage.yaml --- .github/workflows/code-coverage.yaml | 14 -------------- 1 file changed, 14 deletions(-) delete mode 100644 .github/workflows/code-coverage.yaml diff --git a/.github/workflows/code-coverage.yaml b/.github/workflows/code-coverage.yaml deleted file mode 100644 index 2dfba58dcce..00000000000 --- a/.github/workflows/code-coverage.yaml +++ /dev/null @@ -1,14 +0,0 @@ -name: 'coverage' -on: - pull_request: - branches: - - main -jobs: - coverage: - runs-on: ubuntu-latest - steps: - - name: Report Coverage - uses: orgoro/coverage@v3.1 - with: - coverageFile: coverage.xml - token: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file