Supporting grafting envs onto pre-existing API (#352) #1251
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: Lint and Test | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| workflow_dispatch: | |
| jobs: | |
| pre-commit: | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'pull_request' # pre-commit-ci/lite-action only runs here | |
| strategy: | |
| matrix: | |
| python-version: [3.11, 3.14] # Our min and max supported Python versions | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 # For setuptools-scm, replace with fetch-tags after https://github.com/actions/checkout/issues/1471 | |
| - uses: astral-sh/setup-uv@v7 | |
| with: | |
| enable-cache: true | |
| python-version: ${{ matrix.python-version }} | |
| activate-environment: true # Activate for simple `uv sync` below | |
| - run: uv sync | |
| - uses: j178/prek-action@v1 | |
| - uses: pre-commit-ci/lite-action@v1.1.0 | |
| if: always() | |
| lint: | |
| runs-on: ubuntu-latest | |
| env: | |
| UV_VENV_CLEAR: 1 # Work around https://github.com/hynek/build-and-inspect-python-package/issues/174 | |
| strategy: | |
| matrix: | |
| python-version: [3.11, 3.14] # Our min and max supported Python versions | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 # For setuptools-scm, replace with fetch-tags after https://github.com/actions/checkout/issues/1471 | |
| - uses: astral-sh/setup-uv@v7 | |
| with: | |
| enable-cache: true | |
| cache-local-path: /tmp/baipp-uv_cache_dir # Work around https://github.com/hynek/build-and-inspect-python-package/issues/181 | |
| python-version: ${{ matrix.python-version }} | |
| - name: Check fhaviary build | |
| id: build-fhaviary | |
| if: matrix.python-version == '3.11' | |
| uses: hynek/build-and-inspect-python-package@v2 | |
| with: | |
| upload-name-suffix: -fhaviary | |
| - name: Clean up fhaviary build # Work around https://github.com/hynek/build-and-inspect-python-package/issues/174 | |
| if: matrix.python-version == '3.11' | |
| run: rm -r ${{ steps.build-fhaviary.outputs.dist }} | |
| - name: Check aviary.gsm8k build | |
| id: build-gsm8k | |
| if: matrix.python-version == '3.11' | |
| uses: hynek/build-and-inspect-python-package@v2 | |
| with: | |
| path: packages/gsm8k | |
| upload-name-suffix: -gsm8k | |
| - name: Clean up aviary.gsm8k build # Work around https://github.com/hynek/build-and-inspect-python-package/issues/174 | |
| if: matrix.python-version == '3.11' | |
| run: rm -r ${{ steps.build-gsm8k.outputs.dist }} | |
| - name: Check aviary.hotpotqa build | |
| id: build-hotpotqa | |
| if: matrix.python-version == '3.11' | |
| uses: hynek/build-and-inspect-python-package@v2 | |
| with: | |
| path: packages/hotpotqa | |
| upload-name-suffix: -hotpotqa | |
| - name: Clean up aviary.hotpotqa build # Work around https://github.com/hynek/build-and-inspect-python-package/issues/174 | |
| if: matrix.python-version == '3.11' | |
| run: rm -r ${{ steps.build-hotpotqa.outputs.dist }} | |
| - name: Check aviary.labbench build | |
| id: build-labbench | |
| if: matrix.python-version == '3.11' | |
| uses: hynek/build-and-inspect-python-package@v2 | |
| with: | |
| path: packages/labbench | |
| upload-name-suffix: -labbench | |
| - name: Clean up aviary.labbench build # Work around https://github.com/hynek/build-and-inspect-python-package/issues/174 | |
| if: matrix.python-version == '3.11' | |
| run: rm -r ${{ steps.build-labbench.outputs.dist }} | |
| - name: Check aviary.lfrqa build | |
| id: build-lfrqa | |
| if: matrix.python-version == '3.11' | |
| uses: hynek/build-and-inspect-python-package@v2 | |
| with: | |
| path: packages/lfrqa | |
| upload-name-suffix: -lfrqa | |
| - name: Clean up aviary.lfrqa build # Work around https://github.com/hynek/build-and-inspect-python-package/issues/174 | |
| if: matrix.python-version == '3.11' | |
| run: rm -r ${{ steps.build-lfrqa.outputs.dist }} | |
| - run: uv sync | |
| - run: uv run refurb . | |
| - run: uv run pylint src packages | |
| - if: matrix.python-version == '3.11' # Only need to run this on one version | |
| uses: suzuki-shunsuke/github-action-renovate-config-validator@v2.1.0 | |
| test: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| python-version: [3.13] | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 # For setuptools-scm, replace with fetch-tags after https://github.com/actions/checkout/issues/1471 | |
| - uses: astral-sh/setup-uv@v7 | |
| with: | |
| enable-cache: true | |
| python-version: ${{ matrix.python-version }} | |
| - run: uv sync | |
| - name: Login to Hugging Face Hub | |
| run: uv run --no-project hf auth login --token $HUGGINGFACE_HUB_ACCESS_TOKEN | |
| env: | |
| HUGGINGFACE_HUB_ACCESS_TOKEN: ${{ secrets.HUGGINGFACE_HUB_ACCESS_TOKEN }} | |
| - name: Cache datasets | |
| uses: actions/cache@v5 | |
| with: | |
| path: ~/.cache/huggingface/datasets | |
| key: ${{ runner.os }}-datasets-${{ hashFiles('packages/gsm8k') }}-${{ hashFiles('packages/hotpotqa') }}-${{ hashFiles('packages/labbench') }}-${{ hashFiles('packages/lfrqa') }}-${{ hashFiles('packages/notebook') }} | |
| restore-keys: ${{ runner.os }}-datasets- | |
| # As of litellm version 1.80.11 from https://github.com/BerriAI/litellm/pull/18070, | |
| # tiktoken encodings are lazily loaded. This breaks our VCR cassette caching | |
| # in fresh CI environments, so for backwards compatibility, | |
| # we download tiktoken encodings before running tests | |
| - name: Pre-download tiktoken encoding | |
| run: uv run python -c "import tiktoken; tiktoken.get_encoding('cl100k_base')" | |
| - run: uv run pytest -n 16 --dist=loadfile # auto only launches 8 workers in CI, despite runners have 16 cores | |
| env: | |
| OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | |
| ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} | |
| SEMANTIC_SCHOLAR_API_KEY: ${{ secrets.SEMANTIC_SCHOLAR_API_KEY }} |