Skip to content

Commit 0e46a3a

Browse files
committed
unify workflows
1 parent 0d62999 commit 0e46a3a

3 files changed

Lines changed: 36 additions & 105 deletions

File tree

.github/workflows/nightly.yml

Lines changed: 0 additions & 90 deletions
This file was deleted.

.github/workflows/run_tutorials.yml

Lines changed: 27 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
name: Run Haystack Tutorials
1+
name: Run Tutorials
22

33
on:
4+
workflow_dispatch: # Activate this workflow manually
5+
schedule:
6+
- cron: "0 0 * * *"
47
pull_request:
58
paths:
69
- "tutorials/*.ipynb"
@@ -9,7 +12,7 @@ jobs:
912
generate-matrix:
1013
runs-on: ubuntu-slim
1114
outputs:
12-
matrix: ${{ steps.filter.outputs.matrix }}
15+
matrix: ${{ steps.matrix.outputs.matrix }}
1316
steps:
1417
- uses: actions/checkout@v6
1518

@@ -28,38 +31,41 @@ jobs:
2831
echo "matrix={\"include\":$NOTEBOOKS}" >> "$GITHUB_OUTPUT"
2932
3033
- name: Get changed files
34+
if: github.event_name == 'pull_request'
3135
id: files
3236
uses: tj-actions/changed-files@v47
3337
with:
3438
matrix: true
3539
files: tutorials/*.ipynb
3640

37-
- name: Filter non changed notebooks
38-
id: filter
41+
- name: Filter to changed notebooks (pull request only)
42+
id: matrix
3943
shell: python
4044
env:
45+
EVENT_NAME: ${{ github.event_name }}
4146
MATRIX: ${{ steps.generator.outputs.matrix }}
4247
CHANGED_FILES: ${{ steps.files.outputs.all_changed_files }}
4348
run: |
4449
import os
4550
import json
4651
4752
matrix = json.loads(os.environ["MATRIX"])
48-
changed_files = json.loads(os.environ["CHANGED_FILES"])
49-
new_matrix = {"include": []}
50-
for item in matrix["include"]:
51-
notebook = item["notebook"]
52-
if f"tutorials/{notebook}.ipynb" not in changed_files:
53-
continue
54-
new_matrix["include"].append(item)
55-
56-
new_matrix = json.dumps(new_matrix)
53+
54+
if os.environ["EVENT_NAME"] == "pull_request":
55+
changed_files = json.loads(os.environ["CHANGED_FILES"])
56+
new_matrix = {"include": []}
57+
for item in matrix["include"]:
58+
notebook = item["notebook"]
59+
if f"tutorials/{notebook}.ipynb" in changed_files:
60+
new_matrix["include"].append(item)
61+
matrix = new_matrix
62+
5763
with open(os.environ["GITHUB_OUTPUT"], "a") as f:
58-
print(f"matrix={new_matrix}", file=f)
64+
print(f"matrix={json.dumps(matrix)}", file=f)
5965
6066
run-tutorials:
61-
runs-on: ubuntu-latest
6267
needs: generate-matrix
68+
runs-on: ubuntu-latest
6369

6470
strategy:
6571
fail-fast: false
@@ -114,3 +120,9 @@ jobs:
114120
else
115121
python "$NOTEBOOK"
116122
fi
123+
124+
- name: Notify Slack on nightly failure
125+
if: failure() && github.event_name != 'pull_request'
126+
uses: deepset-ai/notify-slack-action@v1
127+
with:
128+
slack-webhook-url: ${{ secrets.SLACK_WEBHOOK_URL_NOTIFICATIONS }}

tutorials/27_First_RAG_Pipeline.ipynb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,15 @@
5858
"pip install \"sentence-transformers>=4.1.0\""
5959
]
6060
},
61+
{
62+
"cell_type": "code",
63+
"execution_count": null,
64+
"metadata": {},
65+
"outputs": [],
66+
"source": [
67+
"# let me try"
68+
]
69+
},
6170
{
6271
"cell_type": "markdown",
6372
"metadata": {

0 commit comments

Comments
 (0)