Skip to content

Merge develop into main #248

Merge develop into main

Merge develop into main #248

Workflow file for this run

# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: Ansari CICD
on:
# Trigger the workflow on push or pull request events to the "api-v2" and "main" branches.
push:
branches: [ "api-v2", "main" ]
pull_request:
branches: [ "api-v2", "main" ]
permissions:
contents: read
jobs:
ansari-container-job:
runs-on: ubuntu-latest
env:
# Set up environment variables and secrets required for the workflow.
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
KALEMAT_API_KEY: ${{ secrets.KALEMAT_API_KEY }}
VECTARA_API_KEY: ${{ secrets.VECTARA_API_KEY }}
MAWSUAH_VECTARA_CORPUS_KEY: ${{ secrets.MAWSUAH_VECTARA_CORPUS_KEY }}
TAFSIR_VECTARA_CORPUS_KEY: ${{ secrets.TAFSIR_VECTARA_CORPUS_KEY }}
QURAN_DOT_COM_API_KEY: ${{ secrets.QURAN_DOT_COM_API_KEY }}
WHATSAPP_API_VERSION: ${{ secrets.WHATSAPP_API_VERSION }}
WHATSAPP_BUSINESS_PHONE_NUMBER_ID: ${{ secrets.WHATSAPP_BUSINESS_PHONE_NUMBER_ID }}
WHATSAPP_ACCESS_TOKEN_FROM_SYS_USER: ${{ secrets.WHATSAPP_ACCESS_TOKEN_FROM_SYS_USER }}
WHATSAPP_VERIFY_TOKEN_FOR_WEBHOOK: ${{ secrets.WHATSAPP_VERIFY_TOKEN_FOR_WEBHOOK }}
PYTHONPATH: src
# Use a Python 3.13 container
container: python:3.13
steps:
# Check out the repository code.
- name: Check out repository code
uses: actions/checkout@v4
# Install the `uv` tool.
- name: Install uv
run: |
pip install uv
# TODO(abdullah): create a venv using uv
# Install Python dependencies from pyproject.toml plus test/lint tools.
- name: Install dependencies
run: |
uv pip install --system ruff pytest pytest-asyncio pytest-cov
uv pip install --system .
# Lint the code using `ruff` and stop the build if there are lint errors.
- name: Lint with ruff
run: |
# stop the build if there are lint errors
ruff check . --config pyproject.toml --output-format=github
# Run tests using `pytest` and generate a coverage report.
- name: Test with pytest
env:
SECRET_KEY: "secret" # This is a required field. Setting it to a random value to pass the tests.
WHATSAPP_SERVICE_API_KEY: "test-service-key" # Required field for Settings validation in tests.
run: |
pytest --capture=tee-sys --cov=.