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

[Backport 1.x] [CCI][FEATURE] Add test coverage statistics to Codecov #152

Merged
merged 1 commit into from
Apr 25, 2023
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
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
Loading