Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Base Fast Workflow

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
test:
runs-on: ubuntu-latest

services:
postgres:
image: postgres:17
ports:
- 5432:5432
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: localdb123
POSTGRES_DB: test_db_1
options: >-
--health-cmd "pg_isready -U postgres -d test_db_1"
--health-interval 10s
--health-timeout 5s
--health-retries 5

env:
DATABASE_URL: postgresql://postgres:localdb123@localhost:5432/base_fast
TEST_DATABASE_URL: postgresql://postgres:localdb123@localhost:5432/test_db_1
ENV: development
SECRET_KEY: somthing-that-already-secret
ALGORITHM: HS256
ACCESS_TOKEN_EXPIRE_MINUTES: 45

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.13

- name: Install uv
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh
echo "$HOME/.cargo/bin" >> $GITHUB_PATH

- name: Install dependencies with uv
run: uv sync

- name: Run ruff format check
run: uv run ruff format

- name: Run tests
run: uv run pytest -n auto
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,6 @@ cython_debug/
rules.md
GEMINI.MD

# development files
logs/

# IDE Jetbrains
.idea
6 changes: 5 additions & 1 deletion app/core/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import json
import sys
import os
import sys
from datetime import datetime


Expand All @@ -11,9 +12,12 @@ def __init__(self, path: str):
self.logger = logging.getLogger(path)
self.logger.setLevel(logging.INFO)

is_testing = "pytest" in sys.modules
is_production = os.getenv("ENV") == "production"

# Ensure handlers are not duplicated if logger is retrieved multiple times
if not self.logger.handlers:
if os.getenv("ENV") == "production":
if is_production or is_testing:
# Production: Stream logs to external system (e.g., Grafana)
handler = logging.StreamHandler(
sys.stdout
Expand Down
2 changes: 2 additions & 0 deletions logs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.log
*logs.json