CI Tests - Notebook #1112
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
| # These access secrets, so should only be run on local branches. | |
| # Not part of the regular CI run, since notebook tests seem | |
| # particularly flaky | |
| name: CI Tests - Notebook | |
| on: | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| inputs: | |
| commit_id: | |
| description: 'Branch or Commit ID (optional)' | |
| required: false | |
| type: string | |
| schedule: | |
| # * is a special character in YAML so we quote this string | |
| # Run at 10:00 UTC every day | |
| - cron: '00 10 * * *' | |
| jobs: | |
| notebook_tests: | |
| runs-on: "Large_Linux" | |
| environment: test | |
| strategy: | |
| fail-fast: false # Don't cancel all on first failure | |
| matrix: | |
| python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"] | |
| permissions: | |
| id-token: write # for Azure CLI login | |
| steps: | |
| - name: Checkout repo at ${{ github.event_name == 'workflow_dispatch' && inputs.commit_id || github.sha }} | |
| uses: actions/checkout@v6 | |
| with: | |
| ref: ${{ github.event_name == 'workflow_dispatch' && inputs.commit_id || github.sha }} | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Set up uv | |
| uses: astral-sh/setup-uv@v8.1.0 | |
| - name: Install guidance | |
| shell: bash | |
| run: | | |
| uv pip install --system -e .[all,llamacpp,test] | |
| - name: Install gpustat | |
| shell: bash | |
| run: | | |
| uv pip install --system gpustat | |
| - name: Notebook tests | |
| shell: bash | |
| env: | |
| HF_TOKEN: ${{ secrets.HF_TOKEN }} | |
| # Configure OpenAI | |
| OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | |
| run: | | |
| # Run the non-AOAI notebooks | |
| pytest -vv --cov=guidance --cov-report=xml --cov-report=term-missing --cov-append \ | |
| ./tests/notebooks/test_notebooks.py | |
| - name: Upload coverage reports to Codecov | |
| uses: codecov/codecov-action@v6 | |
| if: ${{ (vars.CODECOV_PYTHON == matrix.python-version) }} | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} |