forked from SeldonIO/alibi
-
Notifications
You must be signed in to change notification settings - Fork 0
76 lines (66 loc) · 2.83 KB
/
test_changed_notebooks.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# This workflows executes new or modified example notebooks.
name: test_changed_notebooks
defaults:
run:
shell: bash # To override PowerShell on Windows
on:
push:
branches:
- master
paths:
- 'doc/source/examples/**/*.ipynb'
pull_request:
branches:
- master
paths:
- 'doc/source/examples/**/*.ipynb'
types: [ opened, synchronize, reopened, ready_for_review ]
jobs:
test_changed_notebooks:
if: github.event.pull_request.draft == false
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
python-version: [ '3.7', '3.8', '3.9', '3.10' ]
include: # Run macos and windows tests on only one python version
- os: windows-latest
python-version: '3.9' # PyTorch doesn't yet have 3.10 support on Windows (https://pytorch.org/get-started/locally/#windows-python)
- os: macos-latest
python-version: '3.10'
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Check for new or changed .ipynb files
id: changed-ipynb
uses: tj-actions/[email protected]
with:
files: |
doc/source/examples/*.ipynb
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
python -m pip install --upgrade --upgrade-strategy eager -r requirements/dev.txt -r testing/requirements.txt
python -m pip install --upgrade --upgrade-strategy eager -e .
if [ "$RUNNER_OS" != "Windows" ] && [ ${{ matrix.python }} < '3.10' ]; then
# Windows support for ray is experimental (https://docs.ray.io/en/latest/installation.html#windows-support)
# Python 3.10 is not yet supported (https://github.com/ray-project/ray/blob/master/python/setup.py#L24)
python -m pip install --upgrade --upgrade-strategy eager -e .[ray]
fi
python -m pip install --upgrade --upgrade-strategy eager -e .[shap,tensorflow]
python -m spacy download en_core_web_md
python -m pip freeze
- name: Run notebooks
env:
FILES: ${{ steps.changed-ipynb.outputs.all_modified_files }}
# The following line builds the test case string to be passed to pytest by stripping the directory 'doc/source/examples/',
# adding the `or` quantifier between the names and concatenating with the test name `test_notebook_execution`.
run: |
tests="test_notebook_execution[$(echo ${FILES} | sed 's|doc/source/examples/||g' | sed 's| | or |g')]" &&
pytest --no-cov -rA --durations=0 -vv testing/test_notebooks.py -k "$tests"