Run notebooks #37
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Run notebooks | |
on: | |
workflow_dispatch: | |
inputs: | |
python_version: | |
description: 'Python version' | |
required: false | |
default: '3.11' | |
working-directory: | |
description: 'Working directory or subset (e.g., docs/docs/tutorials/llm_chain.ipynb)' | |
required: false | |
default: 'all' | |
schedule: | |
- cron: '0 13 * * *' | |
env: | |
POETRY_VERSION: "1.7.1" | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
if: github.repository == 'langchain-ai/langchain' || github.event_name != 'schedule' | |
name: "Test docs" | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python + Poetry ${{ env.POETRY_VERSION }} | |
uses: "./.github/actions/poetry_setup" | |
with: | |
python-version: ${{ github.event.inputs.python_version || '3.11' }} | |
poetry-version: ${{ env.POETRY_VERSION }} | |
working-directory: ${{ inputs.working-directory }} | |
cache-key: run-notebooks | |
- name: Install dependencies | |
run: | | |
poetry install --with dev,test | |
- name: Pre-download tiktoken files | |
run: | | |
poetry run python docs/scripts/download_tiktoken.py | |
- name: Prepare notebooks | |
run: | | |
poetry run python docs/scripts/prepare_notebooks_for_ci.py --comment-install-cells --working-directory ${{ github.event.inputs.working-directory || 'all' }} | |
- name: Run notebooks | |
env: | |
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} | |
MISTRAL_API_KEY: ${{ secrets.MISTRAL_API_KEY }} | |
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | |
TAVILY_API_KEY: ${{ secrets.TAVILY_API_KEY }} | |
WORKING_DIRECTORY: ${{ github.event.inputs.working-directory || 'all' }} | |
run: | | |
./docs/scripts/execute_notebooks.sh $WORKING_DIRECTORY |