Skip to content

Commit 72a5dad

Browse files
authored
Merge branch 'develop' into progress_bar
2 parents 14307d2 + cd2c8f3 commit 72a5dad

File tree

65 files changed

+3339
-636
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+3339
-636
lines changed

.coveragerc

Lines changed: 39 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,61 @@
1-
[paths]
2-
source =
3-
ads/
4-
51
[run]
6-
branch = true
7-
parallel = true
8-
source =
9-
ads
102
omit =
11-
docs/*
12-
tests/*
3+
**/__init__.py
4+
**/__main__.py
5+
**/_imports.py
6+
**/cli.py
7+
**/constants.py
8+
**/extension.py
9+
**/score.py
10+
*/.*
11+
/private/*
12+
/tmp/*
1313
ads/automl/*
14+
ads/common/analyzer.py
1415
ads/common/artifact/*
16+
ads/common/function/*
17+
ads/dataflow/*
18+
ads/dataset/dask_series.py
19+
ads/dataset/factory.py
1520
ads/environment/*
1621
ads/experiments/*
22+
ads/explanations/*
1723
ads/templates/*
18-
*/constants.py
19-
*/_imports.py
20-
*/__init__.py
21-
*/__main__.py
22-
*/.*
24+
ads/type_discovery/*
25+
docs/*
26+
tests/*
2327

2428
[report]
2529
exclude_lines =
2630
pragma: no cover
2731
def __repr__
2832
if __name__ == .__main__.:
33+
@(abc\.)?abstractmethod
34+
raise AssertionError
35+
raise NotImplementedError
2936
omit =
37+
**/__init__.py
38+
**/__main__.py
39+
**/_imports.py
40+
**/cli.py
41+
**/constants.py
42+
**/extension.py
43+
**/score.py
44+
*/.*
45+
/private/*
46+
/tmp/*
3047
ads/automl/*
48+
ads/common/analyzer.py
3149
ads/common/artifact/*
50+
ads/common/function/*
51+
ads/dataflow/*
52+
ads/dataset/dask_series.py
53+
ads/dataset/factory.py
3254
ads/environment/*
3355
ads/experiments/*
56+
ads/explanations/*
3457
ads/templates/*
35-
*/constants.py
36-
*/_imports.py
37-
*/__init__.py
38-
*/__main__.py
39-
__init.py__
58+
ads/type_discovery/*
4059
show_missing = true
4160
skip_empty = true
4261
precision = 2

.github/workflows/run-unittests-default_setup.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ env:
2929

3030
jobs:
3131
test:
32-
name: python ${{ matrix.python-version }}, tests/unitary/default_setup
32+
name: python ${{ matrix.python-version }}, default_setup
3333
runs-on: ubuntu-latest
3434
timeout-minutes: 20
3535

.github/workflows/run-unittests.yml

Lines changed: 123 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,15 @@ concurrency:
2222

2323
permissions:
2424
contents: read
25+
pull-requests: write
2526

2627
# hack for https://github.com/actions/cache/issues/810#issuecomment-1222550359
2728
env:
2829
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 5
2930

3031
jobs:
3132
test:
32-
name: python ${{ matrix.python-version }}, ${{ matrix.test-path }}, ignore ${{ matrix.ignore-path }}
33+
name: python ${{ matrix.python-version }}, ${{ matrix.name }}
3334
runs-on: ubuntu-latest
3435
timeout-minutes: 90
3536

@@ -41,6 +42,11 @@ jobs:
4142
include:
4243
- test-path: "tests/unitary"
4344
ignore-path: "tests/unitary/with_extras/model"
45+
name: "unitary"
46+
- test-path: "tests/unitary/with_extras/model"
47+
name: "model"
48+
- python-version: "3.8"
49+
cov-reports: --cov=ads --cov-report=xml --cov-report=html
4450

4551
steps:
4652
- uses: actions/checkout@v3
@@ -82,10 +88,11 @@ jobs:
8288
shell: bash
8389
run: |
8490
set -x # print commands that are executed
91+
8592
sudo apt-get install libkrb5-dev graphviz
8693
$CONDA/bin/conda init
8794
source /home/runner/.bashrc
88-
pip install setuptools
95+
8996
pip install -r dev-requirements.txt
9097
9198
- name: "Run unitary tests folder with maximum ADS dependencies"
@@ -95,16 +102,123 @@ jobs:
95102
NB_SESSION_COMPARTMENT_OCID: ocid1.compartment.oc1.<unique_ocid>
96103
CONDA_PREFIX: /usr/share/miniconda
97104
run: |
105+
set -x # print commands that are executed
106+
107+
# Setup project and tests folder for cov reports to not be overwritten by another parallel step
108+
if [[ ! -z "${{ matrix.cov-reports }}" ]]; then
109+
mkdir -p cov-${{ matrix.name }}
110+
cd cov-${{ matrix.name }}
111+
ln -s ../tests tests
112+
ln -s ../ads ads
113+
ln -s ../.coveragerc .coveragerc
114+
fi
115+
116+
# Run tests
98117
python -m pytest -v -p no:warnings --durations=5 \
118+
-n auto --dist loadfile ${{ matrix.cov-reports }} \
99119
${{ matrix.test-path }} \
100-
--ignore "${{ matrix.ignore-path }}" \
101-
--cov --cov-append --cov-report=html
120+
--ignore "${{ matrix.ignore-path }}"
121+
122+
- name: "Save coverage files"
123+
uses: actions/upload-artifact@v3
124+
if: ${{ matrix.cov-reports }}
125+
with:
126+
name: cov-reports-${{ matrix.name }}
127+
path: |
128+
cov-${{ matrix.name }}/htmlcov/
129+
cov-${{ matrix.name }}/.coverage
130+
cov-${{ matrix.name }}/coverage.xml
131+
132+
coverage-report:
133+
name: "Coverage report"
134+
runs-on: ubuntu-latest
135+
continue-on-error: true
136+
needs: test
137+
if: ${{ success() }} && ${{ github.event.issue.pull_request }}
138+
env:
139+
COMPARE_BRANCH: develop
140+
141+
steps:
142+
- name: "Checkout current branch"
143+
uses: actions/checkout@v3
144+
with:
145+
fetch-depth: 0
146+
- name: "Download coverage files"
147+
uses: actions/download-artifact@v3
148+
- name: "Calculate overall coverage"
149+
run: |
150+
set -x # print commands that are executed
151+
152+
# Prepare default cov body text
153+
COV_BODY_INTRO="📌 Overall coverage:\n\n"
154+
echo COV_BODY="$COV_BODY_INTRO No success to gather report. 😿" >> $GITHUB_ENV
155+
156+
# Combine coverage files
157+
pip install coverage
158+
coverage combine cov-reports-unitary/.coverage cov-reports-model/.coverage
159+
160+
# Make html report
161+
coverage html
162+
163+
# Calculate overall coverage and update body message
164+
COV=$(grep -E 'pc_cov' htmlcov/index.html | cut -d'>' -f 2 | cut -d'%' -f 1)
165+
if [[ ! -z $COV ]]; then
166+
if [[ $COV < 50 ]]; then COLOR=red; elif [[ $COV < 80 ]]; then COLOR=yellow; else COLOR=green; fi
167+
echo COV_BODY="$COV_BODY_INTRO ![Coverage-$COV%](https://img.shields.io/badge/coverage-$COV%25-$COLOR)" >> $GITHUB_ENV
168+
fi
169+
170+
- name: "Calculate coverage diff"
171+
if: always()
172+
run: |
173+
set -x # print commands that are executed
174+
175+
# Prepare default diff body text
176+
DIFF_BODY_INTRO="📌 Cov diff with **${{ env.COMPARE_BRANCH }}**:\n\n"
177+
echo DIFF_BODY="$BODY_INTRO No success to gather report. 😿" >> $GITHUB_ENV
178+
179+
# Prepare file paths to coverage xml files
180+
# Filenames taken from job.test last step with name - "Save coverage files"
181+
FILE1="cov-reports-unitary/coverage.xml"; [[ ! -f $FILE1 ]] && FILE1=""
182+
FILE2="cov-reports-model/coverage.xml"; [[ ! -f $FILE2 ]] && FILE2=""
183+
echo "FILE1=$FILE1" >> $GITHUB_ENV
184+
echo "FILE2=$FILE2" >> $GITHUB_ENV
185+
186+
# Calculate coverage diff and update body message
187+
pip install diff_cover
188+
diff-cover $FILE1 $FILE2 --compare-branch=origin/${{ env.COMPARE_BRANCH }}
189+
DIFF=$(diff-cover $FILE1 $FILE2 \
190+
--compare-branch=origin/${{ env.COMPARE_BRANCH }} | grep Coverage: | cut -d' ' -f 2 | cut -d'%' -f 1)
191+
if [[ -z $DIFF ]]; then
192+
DIFF_INFO=$(diff-cover $FILE1 $FILE2 \
193+
--compare-branch=origin/${{ env.COMPARE_BRANCH }} | grep "No lines");
194+
echo DIFF_BODY="$DIFF_BODY_INTRO $DIFF_INFO">> $GITHUB_ENV
195+
else
196+
if [[ $DIFF < 50 ]]; then COLOR=red; elif [[ $DIFF < 80 ]]; then COLOR=yellow; else COLOR=green; fi
197+
echo DIFF_BODY="$DIFF_BODY_INTRO ![Coverage-$DIFF%](https://img.shields.io/badge/coverage-$DIFF%25-$COLOR)" >> $GITHUB_ENV
198+
fi
102199
103-
# Uploading test artifacts
104-
# https://docs.github.com/en/actions/using-workflows/storing-workflow-data-as-artifacts#uploading-build-and-test-artifacts
105-
- name: "Save html coverage report"
200+
- name: "Add comment with cov diff to PR"
201+
uses: actions/github-script@v6
202+
if: always()
203+
with:
204+
github-token: ${{ github.token }}
205+
script: |
206+
github.rest.issues.createComment({
207+
issue_number: context.issue.number,
208+
owner: context.repo.owner,
209+
repo: context.repo.repo,
210+
body: '${{ env.DIFF_BODY }}\n\n${{ env.COV_BODY }}'
211+
})
212+
- name: "Generate html difference report"
213+
run: |
214+
diff-cover ${{ env.FILE1 }} ${{ env.FILE2 }} \
215+
--compare-branch=origin/${{ env.COMPARE_BRANCH }} \
216+
--html-report=cov-diff.html
217+
- name: "Save coverage difference report"
106218
uses: actions/upload-artifact@v3
107219
with:
108-
name: code-coverage-report
109-
path: htmlcov/
220+
name: cov-html-reports
221+
path: |
222+
cov-diff.html
223+
htmlcov/
110224
retention-days: 10

ads/bds/auth.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
KRB5_CONFIG = "KRB5_CONFIG"
1515

1616

17-
class KRB5KinitError(Exception):
17+
class KRB5KinitError(Exception): # pragma: no cover
1818
"""KRB5KinitError class when kinit -kt command failed to generate cached ticket with the keytab file and the krb5 config file."""
1919

2020
pass

ads/catalog/model.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,11 @@
8282
_WORK_REQUEST_INTERVAL_IN_SEC = 3
8383

8484

85-
class ModelWithActiveDeploymentError(Exception):
85+
class ModelWithActiveDeploymentError(Exception): # pragma: no cover
8686
pass
8787

8888

89-
class ModelArtifactSizeError(Exception):
89+
class ModelArtifactSizeError(Exception): # pragma: no cover
9090
def __init__(self, max_artifact_size: str):
9191
super().__init__(
9292
f"The model artifacts size is greater than `{max_artifact_size}`. "

ads/common/decorator/deprecate.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from functools import wraps
1010

1111

12-
class NotSupportedError(Exception):
12+
class NotSupportedError(Exception): # pragma: no cover
1313
pass
1414

1515

ads/common/error.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
66

77

8-
class ChangesNotCommitted(Exception):
8+
class ChangesNotCommitted(Exception): # pragma: no cover
99
def __init__(self, path):
1010
msg = f"""
1111
File(s) at {path} are either dirty or untracked.

ads/common/model_artifact.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@
102102
_COMPARTMENT_OCID = NB_SESSION_COMPARTMENT_OCID or JOB_RUN_COMPARTMENT_OCID
103103

104104

105-
class InvalidDataType(Exception):
105+
class InvalidDataType(Exception): # pragma: no cover
106106
"""Invalid Data Type."""
107107

108108
pass

ads/common/object_storage_details.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
from ads.common import oci_client
1616

1717

18-
class InvalidObjectStoragePath(Exception):
18+
class InvalidObjectStoragePath(Exception): # pragma: no cover
1919
"""Invalid Object Storage Path."""
2020

2121
pass

ads/common/oci_mixin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class MergeStrategy(Enum):
4141
MERGE = "merge"
4242

4343

44-
class OCIModelNotExists(Exception):
44+
class OCIModelNotExists(Exception): # pragma: no cover
4545
pass
4646

4747

0 commit comments

Comments
 (0)