Skip to content

[render preview] Feature/crawl4ai demo #59

[render preview] Feature/crawl4ai demo

[render preview] Feature/crawl4ai demo #59

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: Python application
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
env:
DJANGO_SETTINGS_MODULE: socialcal.test_settings
SECRET_KEY: dummy-secret-key-for-tests
DEBUG: "True"
DATABASE_URL: sqlite:///test_db.sqlite3
OLOSTEP_API_KEY: dummy-olostep-key
OPENAI_API_KEY: dummy-openai-key
SIMPLESCRAPER_API_KEY: dummy-simplescraper-key
FIRECRAWL_API_KEY: dummy-firecrawl-key
GROQ_API_KEY: dummy-groq-key
GOOGLE_API_KEY: dummy-google-key
services:
redis:
image: redis
ports:
- 6379:6379
options: --health-cmd="redis-cli ping" --health-interval=10s --health-timeout=5s --health-retries=3
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: "3.10"
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest python-dotenv
pip install -r requirements.txt
- name: Install Playwright browsers
run: |
playwright install chromium
playwright install-deps chromium
- name: Set up environment variables
run: |
echo "Setting up test environment variables"
cp .env-dummy .env
printenv | grep -E "DJANGO_|SECRET_|DEBUG|DATABASE_|.*_API_KEY" >> .env
- name: Lint with flake8
run: |
# Stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# Exit-zero treats all errors as warnings
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Run migrations
run: |
python manage.py migrate
- name: Test with pytest
run: |
python -m pytest -v --ds=socialcal.test_settings 2>/dev/null || exit $?