1- name : tests/unitary/**
1+ name : " [Py3.8][COV REPORT] tests/unitary/**"
22
33on :
4+ workflow_dispatch :
45 pull_request :
5- branches :
6- - main
7- - " release/**"
8- - develop
96 paths :
107 - " ads/**"
11- - " !ads/ads_version.json"
12- - setup.py
8+ - pyproject.toml
139 - " **requirements.txt"
14- - .github/workflows/run-unittests.yml
15- - .github/workflows/run-unittests-default_setup.yml
10+ - " .github/workflows/run-unittests*.yml"
1611
1712# Cancel in progress workflows on pull_requests.
1813# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value
3025
3126jobs :
3227 test :
33- name : python ${{ matrix.python-version }} , ${{ matrix.name }}
28+ name : python 3.8 , ${{ matrix.name }}
3429 runs-on : ubuntu-latest
3530 timeout-minutes : 90
3631
3732 strategy :
3833 fail-fast : false
3934 matrix :
40- python-version : ["3.8", "3.9", "3.10"]
41- test-path : ["tests/unitary", "tests/unitary/with_extras/model"]
35+ test-path : ["tests/unitary/with_extras tests/unitary/default_setup", "tests/unitary/with_extras/model"]
4236 include :
43- - test-path : " tests/unitary"
44- ignore-path : " tests/unitary/with_extras/model"
37+ - test-path : " tests/unitary/with_extras tests/unitary/default_setup "
38+ ignore-path : " --ignore tests/unitary/with_extras/model --ignore tests/unitary/with_extras/feature_store "
4539 name : " unitary"
4640 - test-path : " tests/unitary/with_extras/model"
4741 name : " model"
48- - python-version : " 3.8"
49- cov-reports : --cov=ads --cov-report=xml --cov-report=html
5042
5143 steps :
5244 - uses : actions/checkout@v3
5345
54- # Caching python libraries installed with pip
55- # https://github.com/actions/cache/blob/main/examples.md#python---pip
56- - uses : actions/cache@v3
57- with :
58- path : ~/.cache/pip
59- key : ${{ runner.os }}-pip-${{ hashFiles('**/dev-requirements.txt') }}
60- restore-keys : |
61- ${{ runner.os }}-pip-
46+ - uses : ./.github/workflows/create-more-space
47+ name : " Create more disk space"
48+
6249 - uses : actions/setup-python@v4
6350 with :
64- python-version : ${{ matrix.python-version }}
51+ python-version : " 3.8"
52+ cache : " pip"
53+ cache-dependency-path : |
54+ pyproject.toml
55+ "**requirements.txt"
6556
66- - name : " Test config setup"
67- shell : bash
68- env :
69- HOME_RUNNER_DIR : /home/runner
70- run : |
71- set -x # print commands that are executed
72- mkdir -p "$HOME_RUNNER_DIR"/.oci
73- openssl genrsa -out $HOME_RUNNER_DIR/.oci/oci_ads_user.pem 2048
74- cat <<EOT >> "$HOME_RUNNER_DIR/.oci/config"
75- [DEFAULT]
76- user=ocid1.user.oc1..xxx
77- fingerprint=00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00
78- tenancy=ocid1.tenancy.oc1..xxx
79- region=test_region
80- key_file=$HOME_RUNNER_DIR/.oci/oci_ads_user.pem
81- EOT
82- ls -lha "$HOME_RUNNER_DIR"/.oci
83- echo "Test config file:"
84- cat $HOME_RUNNER_DIR/.oci/config
57+ - uses : ./.github/workflows/set-dummy-conf
58+ name : " Test config setup"
8559
8660 - name : " Test env setup"
8761 timeout-minutes : 20
@@ -104,23 +78,19 @@ jobs:
10478 set -x # print commands that are executed
10579
10680 # Setup project and tests folder for cov reports to not be overwritten by another parallel step
107- if [[ ! -z "${{ matrix.cov-reports }}" ]]; then
108- mkdir -p cov-${{ matrix.name }}
109- cd cov-${{ matrix.name }}
110- ln -s ../tests tests
111- ln -s ../ads ads
112- ln -s ../.coveragerc .coveragerc
113- fi
81+ mkdir -p cov-${{ matrix.name }}
82+ cd cov-${{ matrix.name }}
83+ ln -s ../tests tests
84+ ln -s ../ads ads
85+ ln -s ../.coveragerc .coveragerc
11486
11587 # Run tests
11688 python -m pytest -v -p no:warnings --durations=5 \
117- -n auto --dist loadfile ${{ matrix.cov-reports }} \
118- ${{ matrix.test-path }} \
119- --ignore "${{ matrix.ignore-path }}"
89+ -n auto --dist loadfile --cov=ads --cov-report=xml --cov-report=html \
90+ ${{ matrix.test-path }} ${{ matrix.ignore-path }}
12091
12192 - name : " Save coverage files"
12293 uses : actions/upload-artifact@v3
123- if : ${{ matrix.cov-reports }}
12494 with :
12595 name : cov-reports-${{ matrix.name }}
12696 path : |
@@ -133,7 +103,7 @@ jobs:
133103 runs-on : ubuntu-latest
134104 continue-on-error : true
135105 needs : test
136- if : ${{ success() }} && ${{ github.event.issue.pull_request }}
106+ if : ${{ success() }} && && github.event_name == 'pull_request'
137107 env :
138108 COMPARE_BRANCH : main
139109
@@ -148,15 +118,15 @@ jobs:
148118 run : |
149119 set -x # print commands that are executed
150120
151- # Prepare default cov body text
121+ # Prepare default cov body text
152122 COV_BODY_INTRO="📌 Overall coverage:\n\n"
153123 echo COV_BODY="$COV_BODY_INTRO No success to gather report. 😿" >> $GITHUB_ENV
154124
155125 # Prepare file paths to .coverage files
156126 # Filenames taken from job.test last step with name - "Save coverage files"
157- FILE_UNITARY="cov-reports-unitary/.coverage"; [[ ! -f $FILE_UNITARY ]] && FILE_UNITARY=""
127+ FILE_UNITARY="cov-reports-unitary/.coverage"; [[ ! -f $FILE_UNITARY ]] && FILE_UNITARY=""
158128 FILE_MODEL="cov-reports-model/.coverage"; [[ ! -f $FILE_MODEL ]] && FILE_MODEL=""
159-
129+
160130 # Combine coverage files
161131 pip install coverage
162132 coverage combine $FILE_UNITARY $FILE_MODEL
@@ -166,7 +136,7 @@ jobs:
166136
167137 # Calculate overall coverage and update body message
168138 COV=$(grep -E 'pc_cov' htmlcov/index.html | cut -d'>' -f 2 | cut -d'%' -f 1)
169- if [[ ! -z $COV ]]; then
139+ if [[ ! -z $COV ]]; then
170140 if [[ $COV -lt 50 ]]; then COLOR=red; elif [[ $COV -lt 80 ]]; then COLOR=yellow; else COLOR=green; fi
171141 echo COV_BODY="$COV_BODY_INTRO " >> $GITHUB_ENV
172142 fi
@@ -176,23 +146,23 @@ jobs:
176146 run : |
177147 set -x # print commands that are executed
178148
179- # Prepare default diff body text
149+ # Prepare default diff body text
180150 DIFF_BODY_INTRO="📌 Cov diff with **${{ env.COMPARE_BRANCH }}**:\n\n"
181151 echo DIFF_BODY="$DIFF_BODY_INTRO No success to gather report. 😿" >> $GITHUB_ENV
182152
183153 # Prepare file paths to coverage xml files
184154 # Filenames taken from job.test last step with name - "Save coverage files"
185- FILE1="cov-reports-unitary/coverage.xml"; [[ ! -f $FILE1 ]] && FILE1=""
155+ FILE1="cov-reports-unitary/coverage.xml"; [[ ! -f $FILE1 ]] && FILE1=""
186156 FILE2="cov-reports-model/coverage.xml"; [[ ! -f $FILE2 ]] && FILE2=""
187157 echo "FILE1=$FILE1" >> $GITHUB_ENV
188158 echo "FILE2=$FILE2" >> $GITHUB_ENV
189159
190160 # Calculate coverage diff and update body message
191161 pip install diff_cover
192- diff-cover $FILE1 $FILE2 --compare-branch=origin/${{ env.COMPARE_BRANCH }}
162+ diff-cover $FILE1 $FILE2 --compare-branch=origin/${{ env.COMPARE_BRANCH }}
193163 DIFF=$(diff-cover $FILE1 $FILE2 \
194164 --compare-branch=origin/${{ env.COMPARE_BRANCH }} | grep Coverage: | cut -d' ' -f 2 | cut -d'%' -f 1)
195- if [[ -z $DIFF ]]; then
165+ if [[ -z $DIFF ]]; then
196166 DIFF_INFO=$(diff-cover $FILE1 $FILE2 \
197167 --compare-branch=origin/${{ env.COMPARE_BRANCH }} | grep "No lines");
198168 echo DIFF_BODY="$DIFF_BODY_INTRO $DIFF_INFO">> $GITHUB_ENV
0 commit comments