@@ -97,14 +97,14 @@ jobs:
97
97
runs-on : ubuntu-latest
98
98
strategy :
99
99
matrix :
100
- kind : [except customer scenarios, customer scenarios]
100
+ kind : [except- customer- scenarios, customer- scenarios]
101
101
include :
102
- - kind : " except customer scenarios"
102
+ - kind : " except- customer- scenarios"
103
103
extras : " [tf,plt]"
104
104
pattern : " (?!CustomerScenarios)"
105
105
install_graphviz : true
106
106
version : 3.8 # no supported version of tensorflow for 3.9
107
- - kind : " customer scenarios"
107
+ - kind : " customer- scenarios"
108
108
extras : " [plt,dowhy]"
109
109
pattern : " CustomerScenarios"
110
110
version : 3.9
@@ -127,16 +127,28 @@ jobs:
127
127
# Add verbose flag to pip installation if in debug mode
128
128
- run : pip install -e .${{ matrix.extras }} ${{ fromJSON('["","-v"]')[runner.debug] }}
129
129
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
131
131
name : Install test and notebook requirements
132
132
- run : pip list
133
133
name : List installed packages
134
134
- run : python setup.py pytest
135
135
name : Run notebook tests
136
+ id : run_tests
136
137
env :
137
138
PYTEST_ADDOPTS : ' -m "notebook"'
138
139
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
+
140
152
tests :
141
153
name : " Run tests"
142
154
needs : [eval]
@@ -191,10 +203,53 @@ jobs:
191
203
name : Install pytest
192
204
- run : python setup.py pytest
193
205
name : Run tests
206
+ id : run_tests
194
207
env :
195
208
PYTEST_ADDOPTS : ${{ matrix.opts }}
196
209
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
198
253
199
254
build :
200
255
name : Build package
0 commit comments