Fixed alembic errors in CI (maybe)
Some checks failed
CI / Lint & Format (push) Has been cancelled
CI / Tests (Pytest + Alembic + Postgres) (push) Has been cancelled
CI / Docker Build (push) Has been cancelled

This commit is contained in:
2025-09-22 20:08:12 +01:00
parent cf1f01efc0
commit 84e03b2ae9
3 changed files with 73 additions and 5 deletions

View File

@@ -71,15 +71,21 @@ jobs:
key: pip-${{ runner.os }}-${{ env.PYTHON_VERSION }}-${{ hashFiles('**/requirements.txt') }} key: pip-${{ runner.os }}-${{ env.PYTHON_VERSION }}-${{ hashFiles('**/requirements.txt') }}
restore-keys: | restore-keys: |
pip-${{ runner.os }}-${{ env.PYTHON_VERSION }}- pip-${{ runner.os }}-${{ env.PYTHON_VERSION }}-
- name: Install dependencies - name: Install dependencies
run: | run: |
python -m pip install --upgrade pip python -m pip install --upgrade pip
pip install -r requirements.txt pip install -r requirements.txt
- name: Create .env for tests - name: Create .env for tests
run: | run: |
printf "KEYWARDEN_POSTGRES_DSN=%s\nKEYWARDEN_SECRET_KEY=%s\nKEYWARDEN_ACCESS_TOKEN_EXPIRE_MINUTES=60\n" \ printf "KEYWARDEN_POSTGRES_DSN=%s\nKEYWARDEN_SECRET_KEY=%s\nKEYWARDEN_ACCESS_TOKEN_EXPIRE_MINUTES=60\n" \
"${{ env.TEST_POSTGRES_DSN }}" "testsecret" > .env "${{ env.TEST_POSTGRES_DSN }}" "testsecret" > .env
echo "Wrote .env with DSN=${{ env.TEST_POSTGRES_DSN }}" echo "Wrote .env with DSN=${{ env.TEST_POSTGRES_DSN }}"
- name: Set PYTHONPATH
run: echo "PYTHONPATH=${GITHUB_WORKSPACE}" >> $GITHUB_ENV
- name: Run Alembic migrations - name: Run Alembic migrations
env: env:
KEYWARDEN_POSTGRES_DSN: ${{ env.TEST_POSTGRES_DSN }} KEYWARDEN_POSTGRES_DSN: ${{ env.TEST_POSTGRES_DSN }}

View File

@@ -1,9 +1,11 @@
import asyncio import sys, pathlib
# Add project root (parent of the "alembic" dir) to sys.path
PROJECT_ROOT = pathlib.Path(__file__).resolve().parents[1]
if str(PROJECT_ROOT) not in sys.path:
sys.path.insert(0, str(PROJECT_ROOT))
from logging.config import fileConfig from logging.config import fileConfig
from sqlalchemy import pool
from sqlalchemy.ext.asyncio import AsyncEngine, create_async_engine
from alembic import context from alembic import context
# Import your app's config & models # Import your app's config & models

View File

@@ -0,0 +1,60 @@
[build-system]
requires = ["setuptools>=61.0", "wheel"]
build-backend = "setuptools.build_meta"
[project]
name = "keywarden"
version = "0.1.0"
description = "A lightweight, self-hosted SSH key management and access auditing platform."
readme = "README.md"
requires-python = ">=3.11"
license = {text = "MIT"}
authors = [
{ name="George Wilkinson", email="admin@ntbx.io" }
]
dependencies = [
"fastapi>=0.114",
"uvicorn[standard]>=0.30",
"SQLAlchemy[asyncio]>=2.0",
"asyncpg>=0.29",
"alembic>=1.13",
"python-jose[cryptography]>=3.3",
"passlib[argon2]>=1.7",
"pydantic-settings>=2.4",
"cryptography>=43",
"structlog>=24",
"prometheus-fastapi-instrumentator>=6.1"
]
[project.optional-dependencies]
dev = [
"pytest>=8.3",
"httpx>=0.27",
"ruff>=0.6",
"black>=24.8",
"mypy>=1.11"
]
[tool.setuptools.packages.find]
where = ["."]
include = ["app*"]
[tool.black]
line-length = 88
target-version = ["py311"]
[tool.ruff]
line-length = 88
target-version = "py311"
select = ["E", "F", "I"]
ignore = ["E501"] # handled by black
[tool.pytest.ini_options]
minversion = "8.0"
addopts = "-q"
testpaths = ["tests"]
[tool.mypy]
python_version = "3.11"
strict = true
ignore_missing_imports = true