RamshaAnwar's picture
feat(obs): add /metrics endpoint and structured ai_call logging (#17)
0358051 unverified
Raw History Blame Contribute Delete
3.08 kB
name: ci
# ONLY run on pull requests targeting the master branch
on:
pull_request:
branches: [ master ]
# Cancel in-progress runs if a new commit is pushed to the same PR
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
runs-on: ubuntu-latest
services:
postgres:
image: pgvector/pgvector:pg16
env:
POSTGRES_USER: ci
POSTGRES_PASSWORD: ci
POSTGRES_DB: test
ports:
- 5432:5432
options: >-
--health-cmd "pg_isready -U ci -d test"
--health-interval 10s
--health-timeout 5s
--health-retries 5
env:
DATABASE_URL: postgresql+psycopg://ci:ci@localhost:5432/test
DIRECT_DATABASE_URL: postgresql+psycopg://ci:ci@localhost:5432/test
TEST_DATABASE_URL: postgresql+psycopg://ci:ci@localhost:5432/test
JWT_SECRET_KEY: test-secret-test-secret-test-secret-123
GROQ_API_KEY: ${{ secrets.GROQ_API_KEY }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install system dependencies (libgomp1 for FastEmbed)
run: |
sudo apt-get update
sudo apt-get install -y libgomp1
- name: Install Python dependencies
run: pip install -r requirements.txt -r requirements-dev.txt
- name: Run fast tests with coverage
run: pytest -q -m "not eval" --cov=app --cov-fail-under=85
eval:
runs-on: ubuntu-latest
needs: test
# ONLY run the eval job if it is a PR and it's NOT a draft
if: github.event.pull_request.draft == false
services:
postgres:
image: pgvector/pgvector:pg16
env:
POSTGRES_USER: ci
POSTGRES_PASSWORD: ci
POSTGRES_DB: test
ports:
- 5432:5432
options: >-
--health-cmd "pg_isready -U ci -d test"
--health-interval 10s
--health-timeout 5s
--health-retries 5
env:
DATABASE_URL: postgresql+psycopg://ci:ci@localhost:5432/test
DIRECT_DATABASE_URL: postgresql+psycopg://ci:ci@localhost:5432/test
TEST_DATABASE_URL: postgresql+psycopg://ci:ci@localhost:5432/test
JWT_SECRET_KEY: test-secret-test-secret-test-secret-123
GROQ_API_KEY: ${{ secrets.GROQ_API_KEY }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install system dependencies (libgomp1 for FastEmbed)
run: |
sudo apt-get update
sudo apt-get install -y libgomp1
- name: Install Python dependencies
run: pip install -r requirements.txt -r requirements-dev.txt
- name: Run RAGAS Equivalent Evaluation
run: pytest -q -m eval -s
secrets:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: gitleaks/gitleaks-action@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}