Fix migration revision ID mismatch for remove_workspace_analysis_tabl… #722
This file contains hidden or 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: Backend CI | |
on: | |
push: | |
paths: | |
- 'backend/**' | |
- '.github/workflows/backend-ci.yml' | |
pull_request: | |
paths: | |
- 'backend/**' | |
- '.github/workflows/backend-ci.yml' | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: backend | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
cache: 'pip' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install flake8 pytest pytest-cov black isort | |
pip install -r requirements.txt | |
- name: Format with black | |
run: black . | |
- name: Check imports with isort | |
run: isort --check-only . | |
- name: Lint with flake8 | |
# E402 ignored because scripts need to modify sys.path before importing local modules | |
run: flake8 ./app --count --max-complexity=10 --max-line-length=120 --statistics --ignore=C901,E501,W503,W293,E203,E402 | |
- name: Create test environment file | |
run: | | |
mkdir -p /tmp | |
echo "DATABASE_URL=postgresql://postgres:postgres@localhost:5432/test_db" > .env.test | |
echo "DATABASE_TEST_URL=postgresql://postgres:postgres@localhost:5432/test_db" >> .env.test | |
echo "SUPABASE_URL=https://example.supabase.co" >> .env.test | |
echo "SUPABASE_KEY=test-supabase-key" >> .env.test | |
echo "SUPABASE_JWT_SECRET=test-jwt-secret" >> .env.test | |
echo "OPENROUTER_API_KEY=sk-test-key" >> .env.test | |
- name: Check environment variables | |
env: | |
CI: "true" | |
TESTING: "True" | |
DATABASE_URL: "postgresql://postgres:postgres@localhost:5432/test_db" | |
DATABASE_TEST_URL: "postgresql://postgres:postgres@localhost:5432/test_db" | |
SUPABASE_URL: "https://example.supabase.co" | |
SUPABASE_KEY: "test-supabase-key" | |
SUPABASE_JWT_SECRET: "test-jwt-secret" | |
OPENROUTER_API_KEY: "sk-test-key" | |
run: python scripts/check_env.py --env-file .env.test --no-exit | |
- name: Run tests with pytest | |
env: | |
TESTING: "True" | |
DATABASE_URL: "postgresql://postgres:postgres@localhost:5432/test_db" | |
DATABASE_TEST_URL: "postgresql://postgres:postgres@localhost:5432/test_db" | |
SUPABASE_URL: "https://example.supabase.co" | |
SUPABASE_KEY: "test-supabase-key" | |
SUPABASE_JWT_SECRET: "test-jwt-secret" | |
OPENROUTER_API_KEY: "sk-test-key" | |
run: pytest --cov=app --cov-report=xml | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v4 | |
with: | |
file: ./backend/coverage.xml | |
flags: backend | |
fail_ci_if_error: false |