Skip to content

Run Tutorials Nightly #1010

Run Tutorials Nightly

Run Tutorials Nightly #1010

Workflow file for this run

name: Run Tutorials Nightly
on:
workflow_dispatch: # Activate this workflow manually
schedule:
- cron: "0 0 * * *"
jobs:
generate-matrix:
runs-on: ubuntu-latest
outputs:
matrix_v2: ${{ steps.generator.outputs.matrix_v2 }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- id: generator
env:
GH_TOKEN: ${{ github.token }}
run: |
# Get tutorial notebooks
VERSION=$(gh api /repos/deepset-ai/haystack/releases | \
jq -r '[.[].tag_name | select(test("^v2.[0-9]+.[0-9]+$"))] | first')
NOTEBOOKS=$(python ./scripts/generate_matrix.py --haystack-version "$VERSION" --include-main)
echo "matrix_v2={\"include\":$NOTEBOOKS}" >> "$GITHUB_OUTPUT"
run-tutorials:
needs: generate-matrix
runs-on: ubuntu-latest
container: deepset/haystack:base-${{ matrix.haystack_version }}
strategy:
max-parallel: 2
fail-fast: false
matrix: ${{ fromJSON(needs.generate-matrix.outputs.matrix_v2) }}
env:
HAYSTACK_TELEMETRY_ENABLED: "False"
HF_API_TOKEN: ${{ secrets.HF_API_KEY }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
SERPERDEV_API_KEY: ${{ secrets.SERPERDEV_API_KEY }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install common dependencies
run: |
apt-get update && apt-get install -y \
build-essential \
gcc \
libsndfile1 \
ffmpeg
pip install nbconvert ipython
- name: Install tutorial dependencies
if: toJSON(matrix.dependencies) != '[]'
run: |
pip install "${{ join(matrix.dependencies, '" "')}}"
- name: Convert notebook to Python
run: |
jupyter nbconvert --to python --RegexRemovePreprocessor.patterns '%%bash' ./tutorials/${{ matrix.notebook }}.ipynb
- name: Run the converted notebook
run: |
python ./tutorials/${{ matrix.notebook }}.py
- name: Send Failure to Datadog
if: failure()
uses: masci/datadog@v1
with:
api-key: ${{ secrets.CORE_DATADOG_API_KEY }}
api-url: https://api.datadoghq.eu
events: |
- title: "Tutorial ${{ matrix.notebook }} failed"
text: "Branch ${{ github.ref_name }} tests failed"
alert_type: "error"
source_type_name: "Github"
host: ${{ github.repository_owner }}
tags:
- "project:${{ github.repository }}"
- "name:${{ matrix.notebook }}"
- "url:https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"