forked from deepset-ai/haystack-tutorials
-
Notifications
You must be signed in to change notification settings - Fork 0
56 lines (47 loc) 路 1.58 KB
/
run_tutorials.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
name: Run Tutorials
on:
workflow_dispatch: # Activate this workflow manually
pull_request:
paths:
- 'tutorials/*.ipynb'
jobs:
run-tutorials:
runs-on: ubuntu-latest
container: deepset/haystack:base-massi-docker
services:
elasticsearch:
image: elasticsearch:7.9.2
env:
discovery.type: "single-node"
ES_JAVA_OPTS: "-Xms128m -Xmx256m"
env:
HAYSTACK_TELEMETRY_ENABLED: "False"
ELASTICSEARCH_HOST: "elasticsearch"
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install jupyter
# remove pip install pyzmq when this is resolved https://github.com/zeromq/pyzmq/issues/1764
run: |
pip install pyzmq==23.2.1
pip install nbconvert
- name: Files changed
uses: jitterbit/get-changed-files@v1
id: files
with:
format: space-delimited
token: ${{ secrets.GITHUB_TOKEN }}
- name: Convert notebooks to Python
shell: bash
run: |
for changed_file in ${{ steps.files.outputs.all }}; do
if [[ $changed_file == *".ipynb" ]]; then
echo $changed_file
jupyter nbconvert --to python --RegexRemovePreprocessor.patterns '%%bash' ${changed_file}
fi
done
- name: Run the converted notebooks
# Note: the `+` at the end of the `find` invocation will make it fail if any
# of the execs failed, otherwise `find` returns 0 even when the execs fail.
run: |
find ./tutorials -name "*.py" -execdir python {} +;