Skip to content

Commit

Permalink
[CCI][FEATURE] Add test coverage statistics to Codecov (#138)
Browse files Browse the repository at this point in the history
* feat: added codecov integration

Signed-off-by: bl1nkker <nurovich14@gmail.com>

* fixed codecov integration

Signed-off-by: Yerzhaisang Taskali <tasqali1697@gmail.com>

---------

Signed-off-by: bl1nkker <nurovich14@gmail.com>
Signed-off-by: Yerzhaisang Taskali <tasqali1697@gmail.com>
Co-authored-by: bl1nkker <nurovich14@gmail.com>
  • Loading branch information
Yerzhaisang and bl1nkker committed Apr 10, 2023
1 parent 2c73825 commit 7ff5113
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
4 changes: 3 additions & 1 deletion .ci/run-repository.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,11 @@ if [[ "$IS_DOC" == "false" ]]; then
--env "PYTHON_CONNECTION_CLASS=${PYTHON_CONNECTION_CLASS}" \
--env "TEST_TYPE=server" \
--name opensearch-py-ml-test-runner \
--rm \
opensearch-project/opensearch-py-ml \
nox -s "test-${PYTHON_VERSION}(pandas_version='${PANDAS_VERSION}')"
docker cp opensearch-py-ml-test-runner:/code/opensearch-py-ml/junit/ ./junit/

docker rm opensearch-py-ml-test-runner
else
docker run \
--network=${network_name} \
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,8 @@ jobs:
uses: actions/checkout@v2
- name: Integ ${{ matrix.cluster }} secured=${{ matrix.secured }} version=${{matrix.entry.opensearch_version}}
run: "./.ci/run-tests ${{ matrix.cluster }} ${{ matrix.secured }} ${{ matrix.entry.opensearch_version }}"
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./junit/opensearch-py-ml-codecov.xml
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ venv.bak/
# Coverage
.coverage
.coverage.*
*-junit.xml
*-codecov.xml

#model file
all-MiniLM-L6-v2_torchscript_sentence-transformer.zip
Expand Down
9 changes: 8 additions & 1 deletion noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@
# specific language governing permissions and limitations
# under the License.

from os.path import abspath, dirname, join
from pathlib import Path

import nox

BASE_DIR = Path(__file__).parent
# SOURCE_FILES = ("setup.py", "noxfile.py", "eland/", "docs/", "utils/", "tests/", "bin/")
SOURCE_FILES = ("setup.py", "noxfile.py", "opensearch_py_ml/", "utils/", "tests/")

# Whenever type-hints are completed on a file it should
Expand Down Expand Up @@ -115,6 +115,11 @@ def test(session, pandas_version: str):
session.run("python", "-m", "pip", "install", f"pandas~={pandas_version}")
session.run("python", "-m", "setup_tests")

junit_xml = join(abspath(dirname(__file__)), "junit", "opensearch-py-ml-junit.xml")
codecov_xml = join(
abspath(dirname(__file__)), "junit", "opensearch-py-ml-codecov.xml"
)

pytest_args = (
"python",
"-m",
Expand All @@ -124,6 +129,8 @@ def test(session, pandas_version: str):
"--cov-config=setup.cfg",
"--doctest-modules",
"--nbval",
f"--junitxml={junit_xml}",
f"--cov-report=xml:{codecov_xml}",
)

session.run(
Expand Down

0 comments on commit 7ff5113

Please sign in to comment.