From 571d299d8ad0042bbf3c2a97738d78b842f911f0 Mon Sep 17 00:00:00 2001 From: kjh2064 Date: Sat, 11 Jul 2026 22:10:36 +0900 Subject: [PATCH] chore: Clean up all archived and unused workflow files - keep only ci.yml and deploy-prod.yml --- .gitea/workflows/.archived/backup.yml | 15 -- .gitea/workflows/.archived/build.yml.archived | 161 ------------ .../.archived/calibration_backlog.yml | 80 ------ .../.archived/kis_data_collection.yml | 244 ------------------ .../.archived/qualitative_sell_strategy.yml | 156 ----------- .gitea/workflows/.archived/snapshot_admin.yml | 111 -------- .../.archived/wbs_9_3_null_policy_ci_gate.yml | 133 ---------- .gitea/workflows/_common/build-and-test.yml | 89 ------- 8 files changed, 989 deletions(-) delete mode 100644 .gitea/workflows/.archived/backup.yml delete mode 100644 .gitea/workflows/.archived/build.yml.archived delete mode 100644 .gitea/workflows/.archived/calibration_backlog.yml delete mode 100644 .gitea/workflows/.archived/kis_data_collection.yml delete mode 100644 .gitea/workflows/.archived/qualitative_sell_strategy.yml delete mode 100644 .gitea/workflows/.archived/snapshot_admin.yml delete mode 100644 .gitea/workflows/.archived/wbs_9_3_null_policy_ci_gate.yml delete mode 100644 .gitea/workflows/_common/build-and-test.yml diff --git a/.gitea/workflows/.archived/backup.yml b/.gitea/workflows/.archived/backup.yml deleted file mode 100644 index 8a51ed8e..00000000 --- a/.gitea/workflows/.archived/backup.yml +++ /dev/null @@ -1,15 +0,0 @@ -name: backup - -on: - schedule: - - cron: "0 0 * * *" - workflow_dispatch: {} - -jobs: - backup: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Run backup - run: python tools/backup_data_feed_and_databases_v1.py - diff --git a/.gitea/workflows/.archived/build.yml.archived b/.gitea/workflows/.archived/build.yml.archived deleted file mode 100644 index 582f021d..00000000 --- a/.gitea/workflows/.archived/build.yml.archived +++ /dev/null @@ -1,161 +0,0 @@ -name: ARCHIVED - Build & Package (replaced by merge-to-main.yml) - -# This workflow has been replaced by .gitea/workflows/merge-to-main.yml -# Triggers are disabled. Kept for reference only. -on: - # DISABLED - use merge-to-main.yml instead - workflow_dispatch: ~ - -env: - DOTNET_VERSION: '10.0.x' - REGISTRY: ghcr.io - -jobs: - build: - runs-on: ubuntu-latest - timeout-minutes: 20 - permissions: - contents: write - packages: write - - outputs: - build-tag: ${{ steps.metadata.outputs.tag }} - commit-hash: ${{ steps.metadata.outputs.commit }} - build-time: ${{ steps.metadata.outputs.build-time }} - - steps: - - name: Checkout Code - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Setup .NET - uses: actions/setup-dotnet@v3 - with: - dotnet-version: ${{ env.DOTNET_VERSION }} - - - name: Setup Python - uses: actions/setup-python@v4 - with: - python-version: '3.10' - - - name: Install Python Dependencies - run: pip install pyyaml openpyxl requests - - - name: "[GATE] Run Critical Validations" - run: | - echo "πŸ” Running critical CI validations..." - python3 tools/validate_no_direct_api_trading_v1.py || exit 1 - python3 tools/validate_specs.py || exit 1 - echo "βœ… All critical validations passed" - - - name: Prepare Temp Directory - run: | - mkdir -p Temp - if [ ! -f Temp/final_decision_packet_active.json ]; then - echo '{"active_decision": "PASS", "details": "CI dummy packet"}' > Temp/final_decision_packet_active.json - fi - - - name: Restore .NET Dependencies - run: dotnet restore src/dotnet/QuantEngine.Web/QuantEngine.Web.csproj - - - name: Build Release - run: | - dotnet build src/dotnet/QuantEngine.Web/QuantEngine.Web.csproj \ - -c Release \ - --no-restore - - - name: Run Unit Tests - run: | - dotnet test src/dotnet/QuantEngine.Core.Tests/QuantEngine.Core.Tests.csproj \ - -c Release \ - --no-build - - - name: Publish Release Package - run: | - dotnet publish src/dotnet/QuantEngine.Web/QuantEngine.Web.csproj \ - -c Release \ - --no-build \ - -o ./publish - - - name: Generate Build Metadata - id: metadata - run: | - COMMIT=$(git rev-parse --short HEAD) - BUILD_TIME=$(date -u +'%Y-%m-%dT%H:%M:%SZ') - BUILD_TAG="build-${COMMIT}" - - mkdir -p ./publish/wwwroot - cat > ./publish/wwwroot/version.json <> $GITHUB_OUTPUT - echo "commit=${COMMIT}" >> $GITHUB_OUTPUT - echo "build-time=${BUILD_TIME}" >> $GITHUB_OUTPUT - echo "βœ“ Build metadata: ${BUILD_TAG} @ ${BUILD_TIME}" - - - name: Create Deployment Package - run: | - echo "πŸ“¦ Creating deployment package..." - - tar -czf quantengine-${{ steps.metadata.outputs.commit }}.tar.gz \ - -C ./publish . - - PACKAGE_SIZE=$(du -sh quantengine-${{ steps.metadata.outputs.commit }}.tar.gz | cut -f1) - echo "βœ“ Package created: ${PACKAGE_SIZE}" - - # Verify package integrity - tar -tzf quantengine-${{ steps.metadata.outputs.commit }}.tar.gz > /dev/null || exit 1 - echo "βœ“ Package integrity verified" - - - name: Create GitHub Release - uses: ncipollo/release-action@v1 - with: - tag: ${{ steps.metadata.outputs.tag }} - name: Build ${{ steps.metadata.outputs.tag }} - body: | - **Build Information** - - **Commit**: `${{ steps.metadata.outputs.commit }}` - - **Built At**: ${{ steps.metadata.outputs.build-time }} - - **Build Number**: ${{ github.run_number }} - - **Quality Gates** - - βœ… No direct API trading validation - - βœ… Specification validation - - βœ… Unit tests passed - - **Release Package** - - Release artifact: `quantengine-${{ steps.metadata.outputs.commit }}.tar.gz` - - Size: $(du -sh quantengine-${{ steps.metadata.outputs.commit }}.tar.gz | cut -f1) - - **Deployment Instructions** - ```bash - # Trigger production deployment with this build - curl -X POST https://gitea.taxbaik.com/api/v1/repos/kjh2064/QuantEngineByItz/actions/workflows/deploy-prod.yml/dispatches \ - -H "Authorization: token ${GITEA_TOKEN}" \ - -H "Content-Type: application/json" \ - -d '{"ref":"main", "inputs":{"release_tag":"${{ steps.metadata.outputs.tag }}"}}' - ``` - draft: false - prerelease: false - artifacts: quantengine-${{ steps.metadata.outputs.commit }}.tar.gz - artifactErrorsFailBuild: true - updateLatestRelease: true - - - name: Notify Build Success - if: success() - run: | - echo "βœ… Build ${{ steps.metadata.outputs.tag }} completed successfully" - echo "πŸ“¦ Package available at release: ${{ steps.metadata.outputs.tag }}" - - - name: Notify Build Failure - if: failure() - run: | - echo "❌ Build ${{ steps.metadata.outputs.tag }} failed" - exit 1 diff --git a/.gitea/workflows/.archived/calibration_backlog.yml b/.gitea/workflows/.archived/calibration_backlog.yml deleted file mode 100644 index be4fd248..00000000 --- a/.gitea/workflows/.archived/calibration_backlog.yml +++ /dev/null @@ -1,80 +0,0 @@ -name: Calibration Backlog (Registry Drift Watch) - -on: - schedule: - - cron: "15 2 * * 1-5" # UTC 02:15 = KST 11:15, weekday backlog update - workflow_dispatch: - -jobs: - build-calibration-backlog: - runs-on: ubuntu-latest - - steps: - - name: Checkout Code - run: | - if [ -d .git ]; then - git remote set-url origin http://x-access-token:${{ secrets.GITHUB_TOKEN }}@192.168.123.100:8418/KimJaeHyun/myfinance.git - else - git init - git remote add origin http://x-access-token:${{ secrets.GITHUB_TOKEN }}@192.168.123.100:8418/KimJaeHyun/myfinance.git - fi - git fetch origin main --depth=1 - git reset --hard FETCH_HEAD - - - name: Configure Runtime Paths - run: | - export PATH=/usr/local/bin:$PATH - echo "/usr/local/bin" >> $GITHUB_PATH - /usr/bin/python3 --version - - - name: Setup Python Environment - run: | - VENV_BASE=/volume1/gitea/python_venv - REQ_HASH=$(md5sum tools/build_calibration_priority_v1.py 2>/dev/null | cut -d' ' -f1 || echo "calib-default") - VENV="$VENV_BASE/$REQ_HASH" - - if [ ! -f "$VENV/bin/python" ]; then - mkdir -p "$VENV_BASE" - /usr/bin/python3 -m venv "$VENV" - if [ ! -f "$VENV/bin/pip" ]; then - curl -sS https://bootstrap.pypa.io/pip/3.8/get-pip.py -o get-pip.py - "$VENV/bin/python" get-pip.py --quiet - rm get-pip.py - fi - "$VENV/bin/pip" install --upgrade pip --quiet - "$VENV/bin/pip" install pyyaml --quiet - fi - echo "$VENV/bin" >> $GITHUB_PATH - - - name: Validate Calibration Registry - run: python3 tools/validate_calibration_registry_v1.py - - - name: Build Calibration Priority Backlog - run: python3 tools/build_calibration_priority_v1.py - - - name: Build Calibration Change Ledger - run: python3 tools/build_calibration_change_ledger_v4.py - - - name: Build Calibration Review Report - run: python3 tools/build_calibration_review_report_v1.py - - - name: Build Calibration Approval List - run: python3 tools/build_calibration_approval_list_v1.py - - - name: Build Calibration Decision Draft - run: python3 tools/build_calibration_decision_draft_v1.py - - - name: Validate Calibration Change Ledger - run: python3 tools/validate_calibration_change_ledger_v1.py - - - name: Summarize Backlog - if: always() - run: | - STATUS="${{ job.status }}" - echo "=== Calibration Backlog Result ===" - echo "status: $STATUS" - echo "priority: Temp/calibration_priority_v1.json" - echo "ledger: Temp/calibration_change_ledger_v4.json" - echo "review: Temp/calibration_review_report_v1.md" - echo "approval: Temp/calibration_approval_list_v1.md" - echo "decision: Temp/calibration_decision_draft_v1.md" diff --git a/.gitea/workflows/.archived/kis_data_collection.yml b/.gitea/workflows/.archived/kis_data_collection.yml deleted file mode 100644 index 3912e7bc..00000000 --- a/.gitea/workflows/.archived/kis_data_collection.yml +++ /dev/null @@ -1,244 +0,0 @@ -name: KIS Data Collection (SQLite Canonical Feed) - -# ───────────────────────────────────────────────────────────────── -# [μ€‘μš”] 이 μ›Œν¬ν”Œλ‘œμš°λŠ” KIS Open APIλ₯Ό μ½”μ–΄λ‘œ ν•˜λŠ” read-only 데이터 μˆ˜μ§‘λ§Œ μˆ˜ν–‰ν•œλ‹€. -# GatherTradingData.json + live read-only APIsλ₯Ό 톡해 SQLite canonical storeλ₯Ό κ°±μ‹ ν•œλ‹€. -# xlsxλŠ” 이 μ›Œν¬ν”Œλ‘œμš°μ˜ 직접 μž…λ ₯이 μ•„λ‹ˆλ©°, KIS μ‹€νŒ¨ μ‹œμ—λ§Œ 별도 보쑰 κ²½λ‘œμ—μ„œ μ‚¬μš©ν•œλ‹€. -# -# μŠ€μΌ€μ€„: μ˜μ—…μΌ(μ›”~금) 08:00~17:00 KST, 2μ‹œκ°„ 간격(08/10/12/14/16μ‹œ). -# Gitea Actions의 schedule cron은 UTC κΈ°μ€€μœΌλ‘œ ν‰κ°€λœλ‹€(μ„œλ²„ νƒ€μž„μ‘΄μ΄ 별도 -# μ„€μ •λ˜μ–΄ μžˆμ§€ μ•Šμ€ 경우의 κΈ°λ³Έκ°’). μ•„λž˜ cron은 UTC둜 μž‘μ„±ν–ˆλ‹€: -# KST 08:00 = UTC μ „λ‚  23:00 β†’ μš”μΌμ€ "ν•œκ΅­ κΈ°μ€€ 평일"에 맞좰 UTC 0-4(일~λͺ©)둜 이동 -# KST 10/12/14/16:00 = UTC 01/03/05/07:00, 같은 λ‚ (UTC μ›”~금, 1-5) -# -# [μ‹€μ œ Gitea μ„œλ²„ νƒ€μž„μ‘΄μ΄ Asia/Seoul둜 μ„€μ •λ˜μ–΄ μžˆλ‹€λ©΄] μ•„λž˜ cron을 κ·ΈλŒ€λ‘œ -# "0 8,10,12,14,16 * * 1-5" ν•œ μ€„λ‘œ κ΅μ²΄ν•˜λ©΄ λœλ‹€ β€” 첫 μ‹€ν–‰ ν›„ Actions μ‹€ν–‰ -# 기둝의 νƒ€μž„μŠ€νƒ¬ν”„λ₯Ό 확인해 KST 08μ‹œ μ „ν›„λ‘œ λ„λŠ”μ§€ 검증할 것(μΆ”μ •ν•˜μ§€ 말고 확인). -# -# μŠ€μΌ€μ€„ μ£ΌκΈ° λ³€κ²½: μ•„λž˜ schedule λͺ©λ‘μ˜ cron 쀄을 μΆ”κ°€/μ‚­μ œ/μˆ˜μ •ν•˜λ©΄ λœλ‹€. -# 예) 1μ‹œκ°„ κ°„κ²©μœΌλ‘œ λ°”κΎΈλ €λ©΄ 09,11,13,15μ‹œ μŠ¬λ‘―μ„ μΆ”κ°€. -# ───────────────────────────────────────────────────────────────── - -on: - schedule: - - cron: "0 23 * * 0-4" # KST μ›”~금 08:00 (UTC 일~λͺ© 23:00) - - cron: "0 1 * * 1-5" # KST μ›”~금 10:00 (UTC 01:00) - - cron: "0 3 * * 1-5" # KST μ›”~금 12:00 (UTC 03:00) - - cron: "0 5 * * 1-5" # KST μ›”~금 14:00 (UTC 05:00) - - cron: "0 7 * * 1-5" # KST μ›”~금 16:00 (UTC 07:00) - workflow_dispatch: # μˆ˜λ™ μ‹€ν–‰ β€” μŠ€μΌ€μ€„ 검증/μ¦‰μ‹œ μž¬μ‹œλ„μš© - -jobs: - validate-kis-config-smoke: - if: github.event_name == 'workflow_dispatch' - runs-on: ubuntu-latest - steps: - - name: Checkout Code - run: | - if [ -d .git ]; then - git remote set-url origin http://x-access-token:${{ secrets.GITHUB_TOKEN }}@192.168.123.100:8418/KimJaeHyun/myfinance.git - else - git init - git remote add origin http://x-access-token:${{ secrets.GITHUB_TOKEN }}@192.168.123.100:8418/KimJaeHyun/myfinance.git - fi - TARGET_REF="${GITHUB_REF_NAME:-main}" - git fetch origin "$TARGET_REF" --depth=1 - git reset --hard FETCH_HEAD - - - name: Setup Python Environment - run: | - VENV_BASE=/volume1/gitea/python_venv - REQ_HASH=$(md5sum tools/run_kis_data_collection_v1.py 2>/dev/null | cut -d' ' -f1 || echo "kis-default") - VENV="$VENV_BASE/$REQ_HASH" - - if [ ! -f "$VENV/bin/python" ]; then - mkdir -p "$VENV_BASE" - /usr/bin/python3 -m venv "$VENV" - if [ ! -f "$VENV/bin/pip" ]; then - curl -sS https://bootstrap.pypa.io/pip/3.8/get-pip.py -o get-pip.py - "$VENV/bin/python" get-pip.py --quiet - rm get-pip.py - fi - "$VENV/bin/pip" install --upgrade pip --quiet - "$VENV/bin/pip" install requests beautifulsoup4 pyyaml --quiet - ls -dt "$VENV_BASE"/*/ 2>/dev/null | tail -n +3 | xargs rm -rf 2>/dev/null || true - fi - "$VENV/bin/pip" install requests beautifulsoup4 pyyaml --quiet - echo "$VENV/bin" >> $GITHUB_PATH - - - name: "[CRITICAL] No Direct API Trading Gate" - run: python3 tools/validate_no_direct_api_trading_v1.py - - - name: "[CRITICAL] Validate KIS API Credentials (mock)" - env: - # Gitea repository variables are injected here; the Python loader reads these env names. - KIS_APP_Key_TEST: ${{ vars.KIS_APP_KEY_TEST }} - KIS_APP_Secret_TEST: ${{ vars.KIS_APP_SECRET_TEST }} - run: | - if [ -z "${KIS_APP_Key_TEST:-}" ]; then - echo "::error::Gitea variable KIS_APP_KEY_TEST is missing or empty" - exit 1 - fi - if [ -z "${KIS_APP_Secret_TEST:-}" ]; then - echo "::error::Gitea variable KIS_APP_SECRET_TEST is missing or empty" - exit 1 - fi - python3 tools/validate_kis_api_credentials_v1.py \ - --account mock \ - --ticker 005930 \ - --dry-run - - collect-kis-data-live: - if: github.event_name == 'schedule' - runs-on: ubuntu-latest - - steps: - - name: Checkout Code - run: | - if [ -d .git ]; then - git remote set-url origin http://x-access-token:${{ secrets.GITHUB_TOKEN }}@192.168.123.100:8418/KimJaeHyun/myfinance.git - else - git init - git remote add origin http://x-access-token:${{ secrets.GITHUB_TOKEN }}@192.168.123.100:8418/KimJaeHyun/myfinance.git - fi - TARGET_REF="${GITHUB_REF_NAME:-main}" - git fetch origin "$TARGET_REF" --depth=1 - git reset --hard FETCH_HEAD - - - name: Prepare Raw Seed Snapshot - run: | - if [ -f GatherTradingData.json ]; then - echo "GatherTradingData.json present" - exit 0 - fi - - if [ -f .clasprc.json ]; then - echo "GatherTradingData.json missing; seed regeneration is not performed in this workflow." - echo "::error::Commit or pre-stage GatherTradingData.json before running this workflow." - echo "::error::If workbook conversion is required, run tools/convert_xlsx_to_json.py in a separate seed-prep step." - exit 1 - fi - - echo "::error::GatherTradingData.json is missing." - echo "::error::This workflow is JSON-first and does not consume GatherTradingData.xlsx directly." - echo "::error::Fix options:" - echo "::error:: 1) Commit GatherTradingData.json to the repository tree." - echo "::error:: 2) Run a separate seed-prep job to generate GatherTradingData.json from workbook sources." - exit 1 - - - name: Configure Runtime Paths - run: | - export PATH=/usr/local/bin:$PATH - echo "/usr/local/bin" >> $GITHUB_PATH - /usr/bin/python3 --version - - - name: Setup Python Environment - run: | - VENV_BASE=/volume1/gitea/python_venv - REQ_HASH=$(md5sum tools/run_kis_data_collection_v1.py 2>/dev/null | cut -d' ' -f1 || echo "kis-default") - VENV="$VENV_BASE/$REQ_HASH" - - if [ ! -f "$VENV/bin/python" ]; then - mkdir -p "$VENV_BASE" - /usr/bin/python3 -m venv "$VENV" - if [ ! -f "$VENV/bin/pip" ]; then - curl -sS https://bootstrap.pypa.io/pip/3.8/get-pip.py -o get-pip.py - "$VENV/bin/python" get-pip.py --quiet - rm get-pip.py - fi - "$VENV/bin/pip" install --upgrade pip --quiet - "$VENV/bin/pip" install requests beautifulsoup4 pyyaml --quiet - ls -dt "$VENV_BASE"/*/ 2>/dev/null | tail -n +3 | xargs rm -rf 2>/dev/null || true - fi - "$VENV/bin/pip" install requests beautifulsoup4 pyyaml --quiet - echo "$VENV/bin" >> $GITHUB_PATH - - - name: "[CRITICAL] No Direct API Trading Gate" - run: python3 tools/validate_no_direct_api_trading_v1.py - - - name: Collect KIS Market Data to SQLite (read-only) - env: - # Real collection uses repository variables, not Windows shell env syntax. - KIS_APP_Key: ${{ vars.KIS_APP_KEY }} - KIS_APP_Secret: ${{ vars.KIS_APP_SECRET }} - run: | - if [ -z "${KIS_APP_Key:-}" ]; then - echo "::error::Gitea variable KIS_APP_KEY is missing or empty" - exit 1 - fi - if [ -z "${KIS_APP_Secret:-}" ]; then - echo "::error::Gitea variable KIS_APP_SECRET is missing or empty" - exit 1 - fi - python3 tools/run_kis_data_collection_v1.py \ - --input-json GatherTradingData.json \ - --sqlite-db outputs/kis_data_collection/kis_data_collection.db \ - --output-json Temp/kis_data_collection_v1.json \ - --kis-account real - - - name: Validate SQLite Artifact - run: | - python3 - <<'PY' - import json, sqlite3 - from pathlib import Path - db = Path("outputs/kis_data_collection/kis_data_collection.db") - report = Path("Temp/kis_data_collection_v1.json") - assert db.exists(), f"missing db: {db}" - assert report.exists(), f"missing report: {report}" - conn = sqlite3.connect(db) - try: - run_count = conn.execute("SELECT COUNT(*) FROM collection_runs").fetchone()[0] - snap_count = conn.execute("SELECT COUNT(*) FROM collection_snapshots").fetchone()[0] - print(json.dumps({"run_count": run_count, "snapshot_count": snap_count}, ensure_ascii=False)) - assert run_count >= 1 - assert snap_count >= 1 - finally: - conn.close() - PY - - - name: Backup SQLite Database (WBS-9.7) - if: always() - run: | - BACKUP_BASE="/volume1/gitea/backups/kis_data_collection" - mkdir -p "$BACKUP_BASE" - - TIMESTAMP=$(date +%Y%m%d_%H%M%S) - SOURCE_DB="outputs/kis_data_collection/kis_data_collection.db" - BACKUP_DIR="$BACKUP_BASE/$TIMESTAMP" - BACKUP_DB="$BACKUP_DIR/kis_data_collection.db" - - if [ -f "$SOURCE_DB" ]; then - mkdir -p "$BACKUP_DIR" - cp "$SOURCE_DB" "$BACKUP_DB" - echo "Backup created: $BACKUP_DB" - - # 메타데이터 μ €μž₯ (backup manifest) - cat > "$BACKUP_DIR/manifest.json" </dev/null || true - else - echo "::warning::Source DB not found: $SOURCE_DB" - fi - - - name: Notify Run Result - if: always() - run: | - STATUS="${{ job.status }}" - RUN_URL="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" - SUMMARY_FILE="Temp/kis_data_collection_v1.json" - SUMMARY_TEXT="(μš”μ•½ 파일 μ—†μŒ)" - [ -f "$SUMMARY_FILE" ] && SUMMARY_TEXT=$(cat "$SUMMARY_FILE") - echo "=== KIS Data Collection Result ===" - echo "status: $STATUS" - echo "summary: $SUMMARY_TEXT" - echo "run log: $RUN_URL" diff --git a/.gitea/workflows/.archived/qualitative_sell_strategy.yml b/.gitea/workflows/.archived/qualitative_sell_strategy.yml deleted file mode 100644 index bc962ca8..00000000 --- a/.gitea/workflows/.archived/qualitative_sell_strategy.yml +++ /dev/null @@ -1,156 +0,0 @@ -name: Qualitative Sell Strategy (Read-Only, SQLite Canonical) - -on: - schedule: - - cron: "0 10 * * 1-5" # KST 19:00-ish daily post-close batch window (UTC 10:00) - workflow_dispatch: - -jobs: - evaluate-qualitative-sell: - runs-on: ubuntu-latest - - steps: - - name: Checkout Code - run: | - if [ -d .git ]; then - git remote set-url origin http://x-access-token:${{ secrets.GITHUB_TOKEN }}@192.168.123.100:8418/KimJaeHyun/myfinance.git - else - git init - git remote add origin http://x-access-token:${{ secrets.GITHUB_TOKEN }}@192.168.123.100:8418/KimJaeHyun/myfinance.git - fi - TARGET_REF="${GITHUB_REF_NAME:-main}" - git fetch origin "$TARGET_REF" --depth=1 - git reset --hard FETCH_HEAD - - - name: Prepare Raw Seed Snapshot - run: | - if [ -f GatherTradingData.json ]; then - echo "GatherTradingData.json present" - exit 0 - fi - - if [ -f GatherTradingData.xlsx ]; then - echo "GatherTradingData.json missing; regenerating from GatherTradingData.xlsx" - python3 tools/convert_xlsx_to_json.py \ - --xlsx GatherTradingData.xlsx \ - --out GatherTradingData.json - if [ -f GatherTradingData.json ]; then - echo "GatherTradingData.json regenerated successfully" - exit 0 - fi - echo "::error::GatherTradingData.xlsx is present but JSON regeneration failed." - echo "::error::Check tools/convert_xlsx_to_json.py and workbook sheet integrity." - exit 1 - fi - - if [ -f .clasprc.json ]; then - echo "GatherTradingData seed files missing; downloading GatherTradingData.xlsx from Google Drive via .clasprc.json" - python3 tools/download_trading_data.py - if [ -f GatherTradingData.xlsx ]; then - echo "GatherTradingData.xlsx downloaded successfully; regenerating GatherTradingData.json" - python3 tools/convert_xlsx_to_json.py \ - --xlsx GatherTradingData.xlsx \ - --out GatherTradingData.json - if [ -f GatherTradingData.json ]; then - echo "GatherTradingData.json regenerated successfully from downloaded workbook" - exit 0 - fi - echo "::error::Downloaded GatherTradingData.xlsx but JSON regeneration failed." - echo "::error::Check workbook integrity and tools/convert_xlsx_to_json.py." - exit 1 - fi - echo "::error::.clasprc.json exists but GatherTradingData.xlsx was not downloaded." - echo "::error::Check Google Drive access and tools/download_trading_data.py." - exit 1 - fi - - echo "::error::Neither GatherTradingData.json nor GatherTradingData.xlsx exists in the checked-out tree." - echo "::error::This workflow requires a canonical seed snapshot before batch build can start." - echo "::error::Fix options:" - echo "::error:: 1) Commit GatherTradingData.json to the repository tree." - echo "::error:: 2) Commit GatherTradingData.xlsx so the workflow can regenerate the JSON." - echo "::error:: 3) Provide .clasprc.json so the workflow can download GatherTradingData.xlsx from Google Drive and regenerate the JSON." - echo "::error:: 4) If neither file should be tracked, add a prior step that downloads the seed before collection." - exit 1 - - - name: Configure Runtime Paths - run: | - export PATH=/usr/local/bin:$PATH - echo "/usr/local/bin" >> $GITHUB_PATH - /usr/bin/python3 --version - - - name: Setup Python Environment - run: | - VENV_BASE=/volume1/gitea/python_venv - REQ_HASH=$(md5sum tools/build_qualitative_sell_inputs_v1.py 2>/dev/null | cut -d' ' -f1 || echo "qual-default") - VENV="$VENV_BASE/$REQ_HASH" - if [ ! -f "$VENV/bin/python" ]; then - mkdir -p "$VENV_BASE" - /usr/bin/python3 -m venv "$VENV" - "$VENV/bin/pip" install --upgrade pip --quiet - "$VENV/bin/pip" install requests beautifulsoup4 pyyaml openpyxl --quiet - fi - "$VENV/bin/pip" install requests beautifulsoup4 pyyaml openpyxl --quiet - echo "$VENV/bin" >> $GITHUB_PATH - - - name: "[CRITICAL] No Direct API Trading Gate" - run: python3 tools/validate_no_direct_api_trading_v1.py - - - name: "[CRITICAL] Validate KIS API Credentials (mock)" - env: - # Mock validation is wired from Gitea repository variables. - KIS_APP_Key_TEST: ${{ vars.KIS_APP_KEY_TEST }} - KIS_APP_Secret_TEST: ${{ vars.KIS_APP_SECRET_TEST }} - run: | - if [ -z "${KIS_APP_Key_TEST:-}" ]; then - echo "::error::Gitea variable KIS_APP_KEY_TEST is missing or empty" - exit 1 - fi - if [ -z "${KIS_APP_Secret_TEST:-}" ]; then - echo "::error::Gitea variable KIS_APP_SECRET_TEST is missing or empty" - exit 1 - fi - python3 tools/validate_kis_api_credentials_v1.py --account mock --ticker 005930 --dry-run - - - name: Build Qualitative Sell Inputs (batch) - env: - # Real batch build reads the same repository variables as KIS collection. - KIS_APP_Key: ${{ vars.KIS_APP_KEY }} - KIS_APP_Secret: ${{ vars.KIS_APP_SECRET }} - run: | - if [ -z "${KIS_APP_Key:-}" ]; then - echo "::error::Gitea variable KIS_APP_KEY is missing or empty" - exit 1 - fi - if [ -z "${KIS_APP_Secret:-}" ]; then - echo "::error::Gitea variable KIS_APP_SECRET is missing or empty" - exit 1 - fi - if [ -f GatherTradingData.xlsx ]; then - python3 tools/build_qualitative_sell_inputs_v1.py \ - --batch \ - --workbook GatherTradingData.xlsx \ - --kis-account real \ - --apply - else - echo "GatherTradingData.xlsx missing -> skip batch build" - fi - - - name: Build Satellite Recommendations - run: | - if [ -f GatherTradingData.xlsx ]; then - python3 tools/build_satellite_candidate_recommendations_v1.py \ - --workbook GatherTradingData.xlsx \ - --apply - else - echo "GatherTradingData.xlsx missing -> skip satellite build" - fi - - - name: Evaluate Qualitative Sell Accuracy - run: | - if [ -f outputs/qualitative_sell_strategy/qualitative_sell_strategy.db ]; then - python3 tools/evaluate_qualitative_sell_strategy_accuracy_v1.py \ - --sqlite-db outputs/qualitative_sell_strategy/qualitative_sell_strategy.db - else - echo "qualitative_sell_strategy.db missing -> skip accuracy evaluation" - fi diff --git a/.gitea/workflows/.archived/snapshot_admin.yml b/.gitea/workflows/.archived/snapshot_admin.yml deleted file mode 100644 index cb99e8af..00000000 --- a/.gitea/workflows/.archived/snapshot_admin.yml +++ /dev/null @@ -1,111 +0,0 @@ -name: Snapshot Admin Web Validation - -on: - workflow_dispatch: - push: - paths: - - "src/quant_engine/snapshot_admin_server_v1.py" - - "src/quant_engine/snapshot_admin_store_v1.py" - - "tools/run_snapshot_admin_server_v1.py" - - "tools/validate_snapshot_admin_workflow_v1.py" - - "tools/validate_snapshot_admin_web_v1.py" - - "spec/15_account_snapshot_contract.yaml" - - "spec/18_settings_contract.yaml" - - "GatherTradingData.json" - -jobs: - # Push-only smoke gate: no deployment, no web UI smoke, no long-running side effects. - validate-snapshot-admin-smoke: - if: github.event_name == 'push' - runs-on: ubuntu-latest - steps: - - name: Checkout Code - run: | - echo "[smoke] push-only snapshot admin workflow validation" - if [ -d .git ]; then - git remote set-url origin http://x-access-token:${{ secrets.GITHUB_TOKEN }}@192.168.123.100:8418/KimJaeHyun/myfinance.git - else - git init - git remote add origin http://x-access-token:${{ secrets.GITHUB_TOKEN }}@192.168.123.100:8418/KimJaeHyun/myfinance.git - fi - git fetch origin main --depth=1 - git reset --hard FETCH_HEAD - - - name: Setup Python Environment - run: | - echo "[smoke] prepare python venv" - VENV_BASE=/volume1/gitea/python_venv - REQ_HASH=$(md5sum tools/validate_snapshot_admin_workflow_v1.py 2>/dev/null | cut -d' ' -f1 || echo "snapshot-admin-default") - VENV="$VENV_BASE/$REQ_HASH" - if [ ! -f "$VENV/bin/python" ]; then - mkdir -p "$VENV_BASE" - /usr/bin/python3 -m venv "$VENV" - "$VENV/bin/pip" install --upgrade pip --quiet - fi - "$VENV/bin/pip" install pyyaml --quiet - echo "$VENV/bin" >> $GITHUB_PATH - - - name: Validate Snapshot Admin Workflow - run: | - echo "[smoke] validate workflow only (no web UI, no deploy)" - python3 tools/validate_snapshot_admin_workflow_v1.py - - - name: Validate DB First Pipeline - run: | - echo "[smoke] validate DB-first pipeline contract" - python3 tools/validate_db_first_pipeline_v1.py - - # Manual dispatch gate: full workflow + web UI validation only. - validate-snapshot-admin-full: - if: github.event_name == 'workflow_dispatch' - runs-on: ubuntu-latest - steps: - - name: Checkout Code - run: | - echo "[full] workflow_dispatch snapshot admin validation" - if [ -d .git ]; then - git remote set-url origin http://x-access-token:${{ secrets.GITHUB_TOKEN }}@192.168.123.100:8418/KimJaeHyun/myfinance.git - else - git init - git remote add origin http://x-access-token:${{ secrets.GITHUB_TOKEN }}@192.168.123.100:8418/KimJaeHyun/myfinance.git - fi - git fetch origin main --depth=1 - git reset --hard FETCH_HEAD - - - name: Setup Python Environment - run: | - echo "[full] prepare python venv" - VENV_BASE=/volume1/gitea/python_venv - REQ_HASH=$(md5sum tools/validate_snapshot_admin_workflow_v1.py 2>/dev/null | cut -d' ' -f1 || echo "snapshot-admin-default") - VENV="$VENV_BASE/$REQ_HASH" - if [ ! -f "$VENV/bin/python" ]; then - mkdir -p "$VENV_BASE" - /usr/bin/python3 -m venv "$VENV" - "$VENV/bin/pip" install --upgrade pip --quiet - fi - "$VENV/bin/pip" install pyyaml --quiet - echo "$VENV/bin" >> $GITHUB_PATH - - - name: Validate Snapshot Admin Workflow - run: | - echo "[full] validate workflow" - python3 tools/validate_snapshot_admin_workflow_v1.py - - - name: Validate DB First Pipeline - run: | - echo "[full] validate DB-first pipeline contract" - python3 tools/validate_db_first_pipeline_v1.py - - - name: Validate Snapshot Admin Web UI - run: | - echo "[full] validate web ui" - python3 tools/validate_snapshot_admin_web_v1.py - - - name: Notify Run Result - if: always() - run: | - STATUS="${{ job.status }}" - echo "=== Snapshot Admin Full Validation ===" - echo "status: $STATUS" - echo "workflow validation: Temp/snapshot_admin_workflow_v1.json" - echo "web validation: Temp/snapshot_admin_web_validation_v1.json" diff --git a/.gitea/workflows/.archived/wbs_9_3_null_policy_ci_gate.yml b/.gitea/workflows/.archived/wbs_9_3_null_policy_ci_gate.yml deleted file mode 100644 index d365baf6..00000000 --- a/.gitea/workflows/.archived/wbs_9_3_null_policy_ci_gate.yml +++ /dev/null @@ -1,133 +0,0 @@ -name: WBS-9.3 - NULL Policy CI Gate - -on: - push: - branches: - - main - - 'feature/**' - paths: - - 'src/**' - - 'spec/12_field_dictionary.yaml' - pull_request: - branches: - - main - -jobs: - null-policy-validation: - runs-on: ubuntu-latest - name: NULL Policy Validation - - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Setup Python - run: python --version - - - name: Run NULL Policy Validation - run: | - python -c " - import sqlite3 - from pathlib import Path - import yaml - - # Load NULL policy from field dictionary - with open('spec/12_field_dictionary.yaml') as f: - spec = yaml.safe_load(f) - - null_policy = spec.get('field_dictionary', {}).get('policy', {}) - print(f'[*] NULL Policy loaded: {null_policy}') - - # Check both databases - databases = [ - 'src/quant_engine/kis_data_collection.db', - 'src/quant_engine/snapshot_admin.db' - ] - - all_passed = True - for db_path in databases: - if not Path(db_path).exists(): - print(f'[SKIP] {db_path} not found') - continue - - conn = sqlite3.connect(db_path) - cursor = conn.cursor() - - # Get all tables - cursor.execute(\"SELECT name FROM sqlite_master WHERE type='table'\") - tables = [row[0] for row in cursor.fetchall()] - - print(f'\n[CHECK] {db_path}') - for table in tables: - if table == 'sqlite_sequence': - continue - - cursor.execute(f'SELECT * FROM {table} LIMIT 1') - if cursor.fetchone() is None: - print(f' [{table}] Empty (OK)') - else: - print(f' [{table}] Has data') - - conn.close() - - print('\n[RESULT] NULL Policy validation PASS') - " - - - name: Validate Field Dictionary Schema - run: | - python -c " - import yaml - from pathlib import Path - - with open('spec/12_field_dictionary.yaml') as f: - spec = yaml.safe_load(f) - - # Check required sections - required_sections = ['meta', 'field_dictionary'] - for section in required_sections: - if section not in spec: - print(f'ERROR: Missing section: {section}') - exit(1) - - # Check field_dictionary structure - fd = spec['field_dictionary'] - if 'fields' not in fd: - print('ERROR: Missing fields in field_dictionary') - exit(1) - - print('[OK] Field dictionary schema valid') - print(f'[OK] Total fields defined: {len(fd[\"fields\"])}') - " - - - name: Check FILLABLE vs NOT_FILLABLE - run: | - python -c " - import yaml - - with open('spec/12_field_dictionary.yaml') as f: - spec = yaml.safe_load(f) - - fields = spec['field_dictionary']['fields'] - - fillable = 0 - not_fillable = 0 - - for fname, fspec in fields.items(): - if 'data_quality_policy' in fspec: - chargeability = fspec['data_quality_policy'].get('chargeability') - if chargeability == 'FILLABLE': - fillable += 1 - elif chargeability == 'NOT_FILLABLE': - not_fillable += 1 - - print(f'[OK] FILLABLE fields: {fillable}') - print(f'[OK] NOT_FILLABLE fields: {not_fillable}') - print('[OK] Data quality policy check complete') - " - - - name: Log Results - if: always() - run: | - echo "WBS-9.3 NULL Policy CI Gate completed" - echo "Fields validated: total definitions vs NULL distribution" - diff --git a/.gitea/workflows/_common/build-and-test.yml b/.gitea/workflows/_common/build-and-test.yml deleted file mode 100644 index 6d90ba09..00000000 --- a/.gitea/workflows/_common/build-and-test.yml +++ /dev/null @@ -1,89 +0,0 @@ -name: Build and Test (Reusable) - -on: - workflow_call: - outputs: - artifact-path: - description: "Artifact path" - value: ${{ jobs.build.outputs.artifact-path }} - build-tag: - description: "Build tag" - value: ${{ jobs.build.outputs.build-tag }} - commit-hash: - description: "Commit hash" - value: ${{ jobs.build.outputs.commit-hash }} - -env: - DOTNET_VERSION: '10.0.x' - -jobs: - build: - runs-on: ubuntu-latest - timeout-minutes: 15 - - outputs: - artifact-path: quantengine-${{ steps.metadata.outputs.commit }}.tar.gz - build-tag: build-${{ steps.metadata.outputs.commit }}-${{ github.run_number }} - commit-hash: ${{ steps.metadata.outputs.commit }} - - steps: - - name: Checkout Code - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Setup .NET - uses: actions/setup-dotnet@v3 - with: - dotnet-version: ${{ env.DOTNET_VERSION }} - - - name: Generate Build Metadata - id: metadata - run: | - COMMIT=$(git rev-parse --short HEAD) - BUILD_TIME=$(date -u +'%Y-%m-%dT%H:%M:%SZ') - echo "commit=${COMMIT}" >> $GITHUB_OUTPUT - echo "build-time=${BUILD_TIME}" >> $GITHUB_OUTPUT - - - name: Restore Dependencies - run: dotnet restore src/dotnet/QuantEngine.Web/QuantEngine.Web.csproj - - - name: Build Release - run: | - dotnet build src/dotnet/QuantEngine.Web/QuantEngine.Web.csproj \ - -c Release --no-restore - - - name: Run Unit Tests - run: | - dotnet test src/dotnet/QuantEngine.Core.Tests/QuantEngine.Core.Tests.csproj \ - -c Release --no-build || true - - - name: Publish Release Package - run: | - dotnet publish src/dotnet/QuantEngine.Web/QuantEngine.Web.csproj \ - -c Release --no-build -o ./publish - - - name: Create Version Metadata - run: | - mkdir -p ./publish/wwwroot - cat > ./publish/wwwroot/version.json < /dev/null || exit 1 - - - name: Upload Build Artifact - uses: actions/upload-artifact@v3 - with: - name: quantengine-build-${{ github.run_number }} - path: quantengine-${{ steps.metadata.outputs.commit }}.tar.gz - retention-days: 5