@@ -97,14 +97,14 @@ jobs:
9797 runs-on : ubuntu-latest
9898 strategy :
9999 matrix :
100- kind : [except customer scenarios, customer scenarios]
100+ kind : [except- customer- scenarios, customer- scenarios]
101101 include :
102- - kind : " except customer scenarios"
102+ - kind : " except- customer- scenarios"
103103 extras : " [tf,plt]"
104104 pattern : " (?!CustomerScenarios)"
105105 install_graphviz : true
106106 version : 3.8 # no supported version of tensorflow for 3.9
107- - kind : " customer scenarios"
107+ - kind : " customer- scenarios"
108108 extras : " [plt,dowhy]"
109109 pattern : " CustomerScenarios"
110110 version : 3.9
@@ -127,16 +127,28 @@ jobs:
127127 # Add verbose flag to pip installation if in debug mode
128128 - run : pip install -e .${{ matrix.extras }} ${{ fromJSON('["","-v"]')[runner.debug] }}
129129 name : Install econml
130- - run : pip install pytest pytest-runner jupyter jupyter-client nbconvert nbformat seaborn xgboost tqdm
130+ - run : pip install pytest pytest-runner coverage jupyter jupyter-client nbconvert nbformat seaborn xgboost tqdm
131131 name : Install test and notebook requirements
132132 - run : pip list
133133 name : List installed packages
134134 - run : python setup.py pytest
135135 name : Run notebook tests
136+ id : run_tests
136137 env :
137138 PYTEST_ADDOPTS : ' -m "notebook"'
138139 NOTEBOOK_DIR_PATTERN : ${{ matrix.pattern }}
139-
140+ COVERAGE_PROCESS_START : ' setup.cfg'
141+ - run : mv .coverage .coverage.${{ matrix.kind }}
142+ # Run whether or not the tests passed, but only if they ran at all
143+ if : success() || failure() && contains(fromJSON('["success", "failure"]'), steps.run_tests.outcome)
144+ name : Make coverage filename unique
145+ - uses : actions/upload-artifact@v3
146+ name : Upload coverage report
147+ if : success() || failure() && contains(fromJSON('["success", "failure"]'), steps.run_tests.outcome)
148+ with :
149+ name : coverage
150+ path : .coverage.${{ matrix.kind }}
151+
140152 tests :
141153 name : " Run tests"
142154 needs : [eval]
@@ -191,10 +203,53 @@ jobs:
191203 name : Install pytest
192204 - run : python setup.py pytest
193205 name : Run tests
206+ id : run_tests
194207 env :
195208 PYTEST_ADDOPTS : ${{ matrix.opts }}
196209 COVERAGE_PROCESS_START : ' setup.cfg'
197- # todo: publish test results, coverage info
210+ - run : mv .coverage .coverage.${{ matrix.os }}-${{ matrix.python-version }}-${{ matrix.kind }}
211+ # Run whether or not the tests passed, but only if they ran at all
212+ if : success() || failure() && contains(fromJSON('["success", "failure"]'), steps.run_tests.outcome)
213+ name : Make coverage filename unique
214+ - uses : actions/upload-artifact@v3
215+ name : Upload coverage report
216+ if : success() || failure() && contains(fromJSON('["success", "failure"]'), steps.run_tests.outcome)
217+ with :
218+ name : coverage
219+ path : .coverage.${{ matrix.os }}-${{ matrix.python-version }}-${{ matrix.kind }}
220+
221+ coverage-report :
222+ name : " Coverage report"
223+ needs : [tests, notebooks]
224+ if : success() || failure()
225+ runs-on : ubuntu-latest
226+ steps :
227+ - uses : actions/checkout@v3
228+ name : Checkout repository
229+ with :
230+ ref : ${{ env.ref }}
231+ - uses : actions/download-artifact@v3
232+ name : Get coverage reports
233+ with :
234+ name : coverage
235+ path : coverage
236+ - uses : actions/setup-python@v4
237+ name : Setup Python
238+ with :
239+ python-version : 3.8
240+ - run : pip install coverage
241+ name : Install coverage
242+ - run : coverage combine coverage/
243+ name : Combine coverage reports
244+ - run : coverage report -m --format=markdown > $GITHUB_STEP_SUMMARY
245+ name : Generate coverage report
246+ - run : coverage html
247+ name : Generate coverage html --fail-under=86
248+ - uses : actions/upload-artifact@v3
249+ name : Upload coverage report
250+ with :
251+ name : coverage
252+ path : htmlcov
198253
199254 build :
200255 name : Build package
0 commit comments