Run notebooks in docs to ensure they work #354
This file contains hidden or 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 in docs to ensure they work | |
| on: | |
| schedule: | |
| - cron: 0 20 * * * | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| env: | |
| DAFT_ANALYTICS_ENABLED: "0" | |
| jobs: | |
| notebook-check: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.10"] | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install dependencies | |
| run: | | |
| pip install --upgrade pip | |
| pip install -U jupyter papermill matplotlib nb-clean | |
| - name: Install Tesseract | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y tesseract-ocr libtesseract-dev | |
| - name: Clean all notebook output | |
| run: find . -name "*.ipynb" -print0 | xargs -0 nb-clean clean | |
| - name: Run notebooks in docs | |
| run: find docs -name "*.ipynb" -not -path "*/quickstart.ipynb" -print0 | xargs -0 -I {} papermill {} /tmp/out.ipynb -p CI True --kernel python3 --no-progress-bar --cwd /tmp/ | |
| - name: Run notebooks in tutorials | |
| run: find tutorials -name "*.ipynb" -print0 | xargs -0 -I {} papermill {} /tmp/out.ipynb -p CI True --kernel python3 --no-progress-bar --cwd /tmp/ | |
| - name: Send Slack notification on failure | |
| uses: slackapi/[email protected] | |
| if: ${{ env.SLACK_WEBHOOK_URL && failure() && (github.ref == 'refs/heads/main') }} | |
| env: | |
| SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | |
| with: | |
| payload: | | |
| { | |
| "blocks": [ | |
| { | |
| "type": "section", | |
| "text": { | |
| "type": "mrkdwn", | |
| "text": ":rotating_light: [NIGHTLY] Notebook Checker <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|workflow> *FAILED* :rotating_light:" | |
| } | |
| } | |
| ] | |
| } | |
| webhook: ${{ env.SLACK_WEBHOOK_URL }} | |
| webhook-type: incoming-webhook |