Add Gitea CI and automatic dev deployment
Main CI / check-and-build (push) Successful in 1m18s
Development CI / check-and-build (push) Successful in 34s
GitHub Git mirror / mirror (push) Successful in 7s
Development CI / deploy-development (push) Successful in 25s

This commit is contained in:
root committed 2026-10-29 21:30:28 +08:00
1 parent 543564a29c
commit b4f29d4966
20 files changed
+1109 -29

No files matched your search

+4
View File
@@ -1,3 +1,7 @@
.venv
__pycache__
*.pyc
.env*
.pytest_cache
.ruff_cache
dist
+4 -1
View File
@@ -1,3 +1,5 @@
import os
from fastapi import Depends, FastAPI
from fastapi.exceptions import RequestValidationError
from fastapi.responses import RedirectResponse
@@ -31,7 +33,8 @@ app.include_router(calendar.router)
@app.get("/api/health", include_in_schema=False)
async def health() -> ApiResponse[dict[str, str]]:
return success({"status": "ok"})
return success({"status": "ok", "version": os.environ.get("APP_VERSION", "source"),
"commit": os.environ.get("APP_COMMIT", "unknown")})
@app.get("/api/openapi.json", include_in_schema=False, dependencies=[Depends(require_admin)])
+8 -1
View File
@@ -238,7 +238,14 @@ def test_protocol_status_validation_redaction_openapi(auth_app, monkeypatch):
monkeypatch.setattr(market, "tradable_symbols", AsyncMock(return_value=[{"symbol": "BTCUSDT", "base": "BTC", "quote": "USDT", "price_precision": 2, "volume_precision": 5}]))
async def check():
async with httpx.AsyncClient(transport=httpx.ASGITransport(app), base_url="http://test") as client:
assert (await client.get("/api/health")).json() == {"code": 0, "data": {"status": "ok"}, "message": ""}
assert (await client.get("/api/health")).json() == {
"code": 0, "data": {"status": "ok", "version": "source", "commit": "unknown"}, "message": "",
}
monkeypatch.setenv("APP_VERSION", "20261029-aaaaaaaa")
monkeypatch.setenv("APP_COMMIT", "a" * 40)
assert (await client.get("/api/health")).json()["data"] == {
"status": "ok", "version": "20261029-aaaaaaaa", "commit": "a" * 40,
}
invalid = await client.post("/api/auth/login", json={"password": {"sensitive": "do-not-echo"}})
assert invalid.status_code == 422 and invalid.json()["code"] == 422
assert "do-not-echo" not in invalid.text and "input" not in invalid.text