rm hardcoded gpt-4 in tests (use gpt-4o) #1777
Workflow file for this run
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: Pytest | |
on: | |
push: | |
paths: | |
- "langroid/**" | |
- "tests/**" | |
- ".github/workflows/pytest.yml" | |
branches: | |
- main # Replace with your default branch name | |
pull_request: | |
branches: | |
- main # Replace with your default branch name | |
jobs: | |
cancel: | |
if: "contains(github.event.head_commit.message, 'notest') == false" | |
name: Cancel Previous Runs | |
runs-on: ubuntu-latest | |
timeout-minutes: 3 | |
steps: | |
- name: Cancel Previous Workflow Runs | |
uses: styfle/cancel-workflow-action@0.9.1 | |
with: | |
access_token: ${{ github.token }} | |
pytest: | |
if: "contains(github.event.head_commit.message, 'notest') == false" | |
runs-on: ubuntu-latest | |
services: | |
meilisearch: | |
image: getmeili/meilisearch:latest | |
ports: | |
- 7700:7700 | |
options: --env MEILI_MASTER_KEY=masterKey | |
neo4j: | |
image: neo4j:latest | |
ports: | |
- 7474:7474 # HTTP | |
- 7687:7687 # Bolt | |
env: | |
options: --env NEO4J_AUTH=neo4j/password | |
env: | |
CI: true # allows conditional skipping of tests based on this env var | |
OPENAI_API_KEY: ${{ secrets.OPENAI_KEY }} | |
GITHUB_ACCESS_TOKEN: ${{ secrets.GH_ACCESS_TOKEN }} | |
REDIS_PASSWORD: ${{ secrets.REDIS_PASSWORD }} | |
REDIS_HOST: ${{ secrets.REDIS_HOST }} | |
REDIS_PORT: ${{ secrets.REDIS_PORT }} | |
MOMENTO_AUTH_TOKEN: ${{ secrets.MOMENTO_AUTH_TOKEN }} | |
MOMENTO_API_KEY: ${{ secrets.MOMENTO_API_KEY }} | |
QDRANT_API_KEY: ${{ secrets.QDRANT_API_KEY }} | |
QDRANT_API_URL: ${{ secrets.QDRANT_API_URL }} | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY }} | |
GOOGLE_CSE_ID: ${{ secrets.GOOGLE_CSE_ID }} | |
# Azure OpenAI env vars | |
AZURE_OPENAI_API_KEY: ${{ secrets.AZURE_OPENAI_API_KEY }} | |
AZURE_OPENAI_API_BASE: ${{ secrets.AZURE_OPENAI_API_BASE }} | |
AZURE_OPENAI_API_VERSION: "2023-05-15" | |
AZURE_OPENAI_DEPLOYMENT_NAME: ${{ secrets.AZURE_OPENAI_DEPLOYMENT_NAME }} | |
AZURE_OPENAI_MODEL_NAME: ${{ secrets.AZURE_GPT_MODEL_NAME }} | |
AZURE_OPENAI_MODEL_VERSION: ${{ secrets.AZURE_OPENAI_MODEL_VERSION }} | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.11 # Replace with your desired Python version | |
- name: Install dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libmagic1 | |
sudo apt-get install -y poppler-utils tesseract-ocr | |
- name: Install Poetry | |
uses: Gr1N/setup-poetry@v8 | |
- name: Install Poetry dependencies | |
run: | | |
poetry --version | |
echo "$HOME/.local/bin" >> $GITHUB_PATH | |
python -m pip install --upgrade pip | |
poetry install -E "chromadb hf-embeddings unstructured" | |
- name: Dump dependencies to file | |
run: pip freeze > requirements_github.txt | |
- name: Upload dependencies file | |
uses: actions/upload-artifact@v3 | |
with: | |
name: github-dependencies | |
path: requirements_github.txt | |
- name: Run tests with coverage (exit on first failure) | |
id: first_test | |
run: | | |
poetry run coverage run --source=langroid -m pytest -x tests/main tests/extras/test_hf_embeddings.py | |
poetry run coverage report | |
continue-on-error: true | |
- name: Retry pytest with gpt-4 instead of gpt-4o | |
if: steps.first_test.outcome == 'failure' | |
run: | | |
poetry run coverage run --source=langroid -m pytest -x tests/main tests/extras/test_hf_embeddings.py --m gpt-4 | |
poetry run coverage report | |
- name: Generate XML coverage report | |
run: | | |
poetry run coverage xml | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v2 | |
with: | |
file: ./coverage.xml | |
flags: unittests | |
name: codecov-umbrella | |
fail_ci_if_error: false | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |