11name : tests/unitary/**
22
33on :
4- push :
4+ pull_request :
55 branches :
66 - main
7- - ' release/**'
7+ - " release/**"
88 - develop
99 paths :
10- - ' ads/**'
10+ - " ads/**"
1111 - setup.py
12- - ' **requirements.txt'
13- - ' !docs/**'
14-
15- pull_request :
12+ - " **requirements.txt"
13+ - .github/workflows/run-unittests.yml
14+ - .github/workflows/run-unittests-default_setup.yml
1615
1716# Cancel in progress workflows on pull_requests.
1817# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value
@@ -88,22 +87,21 @@ jobs:
8887 shell : bash
8988 run : |
9089 set -x # print commands that are executed
91-
90+
9291 sudo apt-get install libkrb5-dev graphviz
9392 $CONDA/bin/conda init
9493 source /home/runner/.bashrc
95-
94+
9695 pip install -r dev-requirements.txt
9796
9897 - name : " Run unitary tests folder with maximum ADS dependencies"
9998 timeout-minutes : 60
10099 shell : bash
101100 env :
102- NB_SESSION_COMPARTMENT_OCID : ocid1.compartment.oc1.<unique_ocid>
103101 CONDA_PREFIX : /usr/share/miniconda
104102 run : |
105103 set -x # print commands that are executed
106-
104+
107105 # Setup project and tests folder for cov reports to not be overwritten by another parallel step
108106 if [[ ! -z "${{ matrix.cov-reports }}" ]]; then
109107 mkdir -p cov-${{ matrix.name }}
@@ -112,7 +110,7 @@ jobs:
112110 ln -s ../ads ads
113111 ln -s ../.coveragerc .coveragerc
114112 fi
115-
113+
116114 # Run tests
117115 python -m pytest -v -p no:warnings --durations=5 \
118116 -n auto --dist loadfile ${{ matrix.cov-reports }} \
@@ -148,41 +146,41 @@ jobs:
148146 - name : " Calculate overall coverage"
149147 run : |
150148 set -x # print commands that are executed
151-
149+
152150 # Prepare default cov body text
153151 COV_BODY_INTRO="📌 Overall coverage:\n\n"
154152 echo COV_BODY="$COV_BODY_INTRO No success to gather report. 😿" >> $GITHUB_ENV
155-
153+
156154 # Combine coverage files
157155 pip install coverage
158156 coverage combine cov-reports-unitary/.coverage cov-reports-model/.coverage
159-
157+
160158 # Make html report
161159 coverage html
162-
160+
163161 # Calculate overall coverage and update body message
164162 COV=$(grep -E 'pc_cov' htmlcov/index.html | cut -d'>' -f 2 | cut -d'%' -f 1)
165163 if [[ ! -z $COV ]]; then
166- if [[ $COV < 50 ]]; then COLOR=red; elif [[ $COV < 80 ]]; then COLOR=yellow; else COLOR=green; fi
164+ if [[ $COV -lt 50 ]]; then COLOR=red; elif [[ $COV -lt 80 ]]; then COLOR=yellow; else COLOR=green; fi
167165 echo COV_BODY="$COV_BODY_INTRO " >> $GITHUB_ENV
168166 fi
169167
170168 - name : " Calculate coverage diff"
171169 if : always()
172170 run : |
173171 set -x # print commands that are executed
174-
172+
175173 # Prepare default diff body text
176174 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-
175+ echo DIFF_BODY="$DIFF_BODY_INTRO No success to gather report. 😿" >> $GITHUB_ENV
176+
179177 # Prepare file paths to coverage xml files
180178 # Filenames taken from job.test last step with name - "Save coverage files"
181179 FILE1="cov-reports-unitary/coverage.xml"; [[ ! -f $FILE1 ]] && FILE1=""
182180 FILE2="cov-reports-model/coverage.xml"; [[ ! -f $FILE2 ]] && FILE2=""
183181 echo "FILE1=$FILE1" >> $GITHUB_ENV
184182 echo "FILE2=$FILE2" >> $GITHUB_ENV
185-
183+
186184 # Calculate coverage diff and update body message
187185 pip install diff_cover
188186 diff-cover $FILE1 $FILE2 --compare-branch=origin/${{ env.COMPARE_BRANCH }}
@@ -193,7 +191,7 @@ jobs:
193191 --compare-branch=origin/${{ env.COMPARE_BRANCH }} | grep "No lines");
194192 echo DIFF_BODY="$DIFF_BODY_INTRO $DIFF_INFO">> $GITHUB_ENV
195193 else
196- if [[ $DIFF < 50 ]]; then COLOR=red; elif [[ $DIFF < 80 ]]; then COLOR=yellow; else COLOR=green; fi
194+ if [[ $DIFF -lt 50 ]]; then COLOR=red; elif [[ $DIFF -lt 80 ]]; then COLOR=yellow; else COLOR=green; fi
197195 echo DIFF_BODY="$DIFF_BODY_INTRO " >> $GITHUB_ENV
198196 fi
199197
0 commit comments