3838 name : Evaluate changes
3939 runs-on : ubuntu-latest
4040 steps :
41- - uses : actions/checkout@v4
42- name : Checkout repository
41+ - name : Checkout repository
42+ uses : actions/checkout@v4
4343 with :
4444 ref : ${{ env.ref }}
4545 fetch-depth : 2
5757 # which will be the first parent: HEAD^
5858 # (For non-PR changes, we will always perform all CI tasks)
5959 # Note that GitHub Actions provides path filters, but they operate at the workflow level, not the job level
60- - run : |
60+ - name : Determine type of code change
61+ run : |
6162 if ($env:GITHUB_EVENT_NAME -eq 'pull_request') {
6263 $editedFiles = git diff HEAD^ --name-only
6364 $editedFiles # echo edited files to enable easier debugging
8283 echo "buildNbs=$(($env:GITHUB_EVENT_NAME -ne 'pull_request') -or ($nbChanges -or $codeChanges))" >> $env:GITHUB_OUTPUT
8384 echo "testCode=$(($env:GITHUB_EVENT_NAME -ne 'pull_request') -or $codeChanges)" >> $env:GITHUB_OUTPUT
8485 shell : pwsh
85- name: Determine type of code change
8686 id : eval
8787 outputs :
8888 buildDocs : ${{ steps.eval.outputs.buildDocs }}
@@ -95,17 +95,18 @@ jobs:
9595 if : ${{ needs.eval.outputs.testCode == 'True' }}
9696 runs-on : ubuntu-latest
9797 steps :
98- - uses : actions/checkout@v4
99- name : Checkout repository
98+ - name : Checkout repository
99+ uses : actions/checkout@v4
100100 with :
101101 ref : ${{ env.ref }}
102- - uses : actions/setup-python@v5
103- name : Setup Python
102+ - name : Setup Python
103+ uses : actions/setup-python@v5
104104 with :
105105 python-version : ' 3.9'
106- - run : python -m pip install --upgrade pip && pip install --upgrade setuptools
107- name : Ensure latest pip and setuptools
108- - run : ' pip install pycodestyle && pycodestyle econml'
106+ - name : Ensure latest pip and setuptools
107+ run : python -m pip install --upgrade pip && pip install --upgrade setuptools
108+ - name : Run pycodestyle to check style
109+ run : ' pip install pycodestyle && pycodestyle econml'
109110
110111 notebooks :
111112 name : Run notebooks
@@ -130,65 +131,65 @@ jobs:
130131 env :
131132 id_string : ${{ matrix.kind }}-${{ matrix.version }}
132133 steps :
133- - uses : actions/checkout@v4
134- name : Checkout repository
134+ - name : Checkout repository
135+ uses : actions/checkout@v4
135136 with :
136137 ref : ${{ env.ref }}
137- - uses : actions/setup-python@v5
138- name : Setup Python
138+ - name : Setup Python
139+ uses : actions/setup-python@v5
139140 with :
140141 python-version : ${{ matrix.version }}
141- - run : python -m pip install --upgrade pip && pip install --upgrade setuptools
142- name : Ensure latest pip and setuptools
143- - run : sudo apt-get -yq install graphviz
144- name : Install graphviz
142+ - name : Ensure latest pip and setuptools
143+ run : python -m pip install --upgrade pip && pip install --upgrade setuptools
144+ - name : Install graphviz
145+ run : sudo apt-get -yq install graphviz
145146 if : ${{ matrix.install_graphviz }}
146147 # Add verbose flag to pip installation if in debug mode
147- - run : pip install -e .${{ matrix.extras }} ${{ fromJSON('["","-v"]')[runner.debug] }} ${{ env.use_lkg && '-r lkg-notebook.txt' }}
148- name : Install econml
148+ - name : Install econml
149+ run : pip install -e .${{ matrix.extras }} ${{ fromJSON('["","-v"]')[runner.debug] }} ${{ env.use_lkg && '-r lkg-notebook.txt' }}
149150 # Install notebook requirements (if not already done as part of lkg)
150- - run : pip install jupyter jupyter-client nbconvert nbformat seaborn xgboost tqdm
151- name : Install notebook requirements
151+ - name : Install notebook requirements
152+ run : pip install jupyter jupyter-client nbconvert nbformat seaborn xgboost tqdm
152153 if : ${{ !env.use_lkg }}
153- - run : pip freeze --exclude-editable > notebooks-${{ env.id_string }}-requirements.txt
154- name : Save installed packages
155- - uses : actions/upload-artifact@v3
156- name : Upload installed packages
154+ - name : Save installed packages
155+ run : pip freeze --exclude-editable > notebooks-${{ env.id_string }}-requirements.txt
156+ - name : Upload installed packages
157+ uses : actions/upload-artifact@v3
157158 with :
158159 name : requirements
159160 path : notebooks-${{ env.id_string }}-requirements.txt
160- - run : pip install pytest pytest-runner coverage
161- name : Install pytest
161+ - name : Install pytest
162+ run : pip install pytest pytest-runner coverage
162163
163- - run : python setup.py pytest
164- name : Run notebook tests
164+ - name : Run notebook tests
165+ run : python setup.py pytest
165166 id : run_tests
166167 env :
167168 PYTEST_ADDOPTS : ' -m "notebook"'
168169 NOTEBOOK_DIR_PATTERN : ${{ matrix.pattern }}
169170 COVERAGE_PROCESS_START : ' setup.cfg'
170- - run : mv .coverage .coverage.${{ env.id_string }}
171+ - name : Make coverage filename unique
172+ run : mv .coverage .coverage.${{ env.id_string }}
171173 # Run whether or not the tests passed, but only if they ran at all
172174 if : success() || failure() && contains(fromJSON('["success", "failure"]'), steps.run_tests.outcome)
173- name : Make coverage filename unique
174- - uses : actions/upload-artifact@v3
175- name : Upload coverage report
175+ - name : Upload coverage report
176+ uses : actions/upload-artifact@v3
176177 if : success() || failure() && contains(fromJSON('["success", "failure"]'), steps.run_tests.outcome)
177178 with :
178179 name : coverage
179180 path : .coverage.${{ env.id_string }}
180- - run : mv junit/test-results.xml ${{ env.id_string }}-test-results.xml
181+ - name : Make test XML filename unique
182+ run : mv junit/test-results.xml ${{ env.id_string }}-test-results.xml
181183 # Run whether or not the tests passed, but only if they ran at all
182184 if : success() || failure() && contains(fromJSON('["success", "failure"]'), steps.run_tests.outcome)
183- name : Make test XML filename unique
184- - uses : actions/upload-artifact@v3
185- name : Upload test XML files
185+ - name : Upload test XML files
186+ uses : actions/upload-artifact@v3
186187 if : success() || failure() && contains(fromJSON('["success", "failure"]'), steps.run_tests.outcome)
187188 with :
188189 name : tests
189190 path : ${{ env.id_string }}-test-results.xml
190- - uses : actions/upload-artifact@v3
191- name : Upload notebook outputs
191+ - name : Upload notebook outputs
192+ uses : actions/upload-artifact@v3
192193 if : success() || failure() && contains(fromJSON('["success", "failure"]'), steps.run_tests.outcome)
193194 with :
194195 name : notebooks
@@ -235,50 +236,50 @@ jobs:
235236 env :
236237 id_string : ${{ matrix.os }}-${{ matrix.python-version }}-${{ matrix.kind }}
237238 steps :
238- - uses : actions/checkout@v4
239- name : Checkout repository
239+ - name : Checkout repository
240+ uses : actions/checkout@v4
240241 with :
241242 ref : ${{ env.ref }}
242- - uses : actions/setup-python@v5
243- name : Setup Python
243+ - name : Setup Python
244+ uses : actions/setup-python@v5
244245 with :
245246 python-version : ${{ matrix.python-version }}
246- - run : python -m pip install --upgrade pip && pip install --upgrade setuptools
247- name : Ensure latest pip and setuptools
247+ - name : Ensure latest pip and setuptools
248+ run : python -m pip install --upgrade pip && pip install --upgrade setuptools
248249 # Add verbose flag to pip installation if in debug mode
249- - run : pip install -e .${{ matrix.extras }} ${{ fromJSON('["","-v"]')[runner.debug] }} ${{ env.use_lkg && '-r lkg.txt' }}
250- name : Install econml
251- - run : pip freeze --exclude-editable > tests-${{ env.id_string }}-requirements.txt
252- name : Save installed packages
253- - uses : actions/upload-artifact@v3
254- name : Upload installed packages
250+ - name : Install econml
251+ run : pip install -e .${{ matrix.extras }} ${{ fromJSON('["","-v"]')[runner.debug] }} ${{ env.use_lkg && '-r lkg.txt' }}
252+ - name : Save installed packages
253+ run : pip freeze --exclude-editable > tests-${{ env.id_string }}-requirements.txt
254+ - name : Upload installed packages
255+ uses : actions/upload-artifact@v3
255256 with :
256257 name : requirements
257258 path : tests-${{ env.id_string }}-requirements.txt
258- - run : pip install pytest pytest-runner coverage
259- name : Install pytest
260- - run : python setup.py pytest
261- name : Run tests
259+ - name : Install pytest
260+ run : pip install pytest pytest-runner coverage
261+ - name : Run tests
262+ run : python setup.py pytest
262263 id : run_tests
263264 env :
264265 PYTEST_ADDOPTS : ${{ matrix.opts }}
265266 COVERAGE_PROCESS_START : ' setup.cfg'
266- - run : mv .coverage .coverage.${{ env.id_string }}
267+ - name : Make coverage filename unique
268+ run : mv .coverage .coverage.${{ env.id_string }}
267269 # Run whether or not the tests passed, but only if they ran at all
268270 if : success() || failure() && contains(fromJSON('["success", "failure"]'), steps.run_tests.outcome)
269- name : Make coverage filename unique
270- - uses : actions/upload-artifact@v3
271- name : Upload coverage report
271+ - name : Upload coverage report
272+ uses : actions/upload-artifact@v3
272273 if : success() || failure() && contains(fromJSON('["success", "failure"]'), steps.run_tests.outcome)
273274 with :
274275 name : coverage
275276 path : .coverage.${{ env.id_string }}
276- - run : mv junit/test-results.xml ${{ env.id_string }}-test-results.xml
277+ - name : Make test XML filename unique
278+ run : mv junit/test-results.xml ${{ env.id_string }}-test-results.xml
277279 # Run whether or not the tests passed, but only if they ran at all
278280 if : success() || failure() && contains(fromJSON('["success", "failure"]'), steps.run_tests.outcome)
279- name : Make test XML filename unique
280- - uses : actions/upload-artifact@v3
281- name : Upload test XML files
281+ - name : Upload test XML files
282+ uses : actions/upload-artifact@v3
282283 if : success() || failure() && contains(fromJSON('["success", "failure"]'), steps.run_tests.outcome)
283284 with :
284285 name : tests
@@ -290,29 +291,29 @@ jobs:
290291 if : success() || failure()
291292 runs-on : ubuntu-latest
292293 steps :
293- - uses : actions/checkout@v4
294- name : Checkout repository
294+ - name : Checkout repository
295+ uses : actions/checkout@v4
295296 with :
296297 ref : ${{ env.ref }}
297- - uses : actions/download-artifact@v3
298- name : Get coverage reports
298+ - name : Get coverage reports
299+ uses : actions/download-artifact@v3
299300 with :
300301 name : coverage
301302 path : coverage
302- - uses : actions/setup-python@v5
303- name : Setup Python
303+ - name : Setup Python
304+ uses : actions/setup-python@v5
304305 with :
305306 python-version : ' 3.8'
306- - run : pip install coverage
307- name : Install coverage
308- - run : coverage combine coverage/
309- name : Combine coverage reports
310- - run : coverage report -m --format=markdown > $GITHUB_STEP_SUMMARY
311- name : Generate coverage report
312- - run : coverage html
313- name : Generate coverage html --fail-under=86
314- - uses : actions/upload-artifact@v3
315- name : Upload coverage report
307+ - name : Install coverage
308+ run : pip install coverage
309+ - name : Combine coverage reports
310+ run : coverage combine coverage/
311+ - name : Generate coverage report
312+ run : coverage report -m --format=markdown > $GITHUB_STEP_SUMMARY
313+ - name : Generate coverage html --fail-under=86
314+ run : coverage html
315+ - name : Upload coverage report
316+ uses : actions/upload-artifact@v3
316317 with :
317318 name : coverage
318319 path : htmlcov
@@ -349,9 +350,9 @@ jobs:
349350 if : always()
350351 runs-on : ubuntu-latest
351352 steps :
352- - run : exit 1
353- name : At least one check failed or was cancelled
353+ - name : At least one check failed or was cancelled
354+ run : exit 1
354355 if : ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }}
355- - run : exit 0
356- name : All checks passed
356+ - name : All checks passed
357+ run : exit 0
357358 if : ${{ !(contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')) }}
0 commit comments