Arag / .github /workflows /ci.yml
AuthorBot
Implement Enterprise Worth Roadmap (R-139–R-173).
df480e4
Raw
History Blame Contribute Delete
2.85 kB
name: CI AuthorBot SaaS
on:
push:
branches: [main]
pull_request:
branches: [main]
env:
PYTHON_VERSION: "3.11"
jobs:
lint:
name: Lint & Type Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install dependencies
run: |
pip install ruff mypy
pip install -r requirements.txt
- name: Ruff lint
run: ruff check app/ --output-format=github
- name: Ruff format check
run: ruff format app/ --check
- name: Mypy type check
run: mypy app/ --ignore-missing-imports
test:
name: Tests
runs-on: ubuntu-latest
needs: lint
services:
redis:
image: redis:7-alpine
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
postgres:
image: postgres:16-alpine
env:
POSTGRES_DB: test_authorbot
POSTGRES_USER: authorbot
POSTGRES_PASSWORD: testpass
ports:
- 5432:5432
options: >-
--health-cmd "pg_isready -U authorbot -d test_authorbot"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: pip
- name: Install dependencies
run: pip install -r requirements.txt
- name: Run unit + integration tests
env:
JWT_SECRET_KEY: "ci-test-secret-key-not-for-production"
DATABASE_URL: "postgresql+asyncpg://authorbot:testpass@localhost:5432/test_authorbot"
REDIS_URL: "redis://localhost:6379"
OPENAI_API_KEY: "sk-test-fake-key"
CHROMA_PERSIST_DIR: "./test_chroma"
run: |
pytest tests/ -v --tb=short --cov=app --cov-report=xml --cov-fail-under=80 -x
behave tests/bdd/features/ --no-capture
- name: Upload coverage
if: always()
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: coverage.xml
deploy:
name: Deploy to HuggingFace
runs-on: ubuntu-latest
needs: test
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Push to HuggingFace Spaces
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
run: |
git remote add hf https://HF_USER:$HF_TOKEN@huggingface.co/spaces/${{ vars.HF_SPACE_ID || 'testingweb647/Arag' }}
git push hf main --force