CI Tests - Credentialed #542
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. | |
| name: CI Tests - Credentialed | |
| permissions: | |
| contents: read | |
| 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 09:00 UTC every day | |
| - cron: '00 09 * * *' | |
| jobs: | |
| credentialed_tests: | |
| runs-on: ubuntu-latest | |
| 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 | |
| run: | | |
| uv pip install --system -e .[all,test] | |
| - name: Model tests | |
| env: | |
| HF_TOKEN: ${{ secrets.HF_TOKEN }} | |
| # Configure OpenAI | |
| OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | |
| # Configure environment for Azure AI Studio | |
| AZUREAI_STUDIO_PHI4_ENDPOINT: ${{ vars.AZUREAI_STUDIO_PHI4_ENDPOINT }} | |
| AZUREAI_STUDIO_PHI4_MODEL_NAME: ${{ vars.AZUREAI_STUDIO_PHI4_MODEL_NAME }} | |
| AZUREAI_STUDIO_PHI4_KEY: ${{ secrets.AZUREAI_STUDIO_PHI4_KEY }} | |
| # Do not configure the environment for Azure OpenAI, so those tests will | |
| # be skipped. GitHub cannot authenticate. | |
| run: | | |
| pytest -vv --cov=guidance --cov-report=xml --cov-report=term-missing \ | |
| ./tests/need_credentials | |
| - name: Upload coverage reports to Codecov | |
| uses: codecov/codecov-action@v6 | |
| if: ${{ (vars.CODECOV_PYTHON == matrix.python-version) }} | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} |