name: Quant Engine CI/CD Pipeline on: push: branches: [ main ] pull_request: branches: [ main ] jobs: validate-and-build: # Synology NAS act_runner: host-based 실행 (Docker 불필요) # Python: /usr/bin/python3 (3.8.12), Node.js: /usr/local/bin/node (v18.18.2) runs-on: self-hosted 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 ${{ github.sha }} --depth=1 git reset --hard FETCH_HEAD - name: Configure Runtime Paths run: | # Node.js 18은 /usr/local/bin에 설치됨 (appstore) — PATH에 추가 echo "/usr/local/bin" >> $GITHUB_PATH echo "=== 런타임 버전 확인 ===" /usr/bin/python3 --version /usr/local/bin/node --version /usr/local/bin/npm --version - name: Setup Python Environment run: | VENV=/volume1/gitea/python_venv if [ ! -f "$VENV/bin/pip" ]; then echo "=== 최초 1회 venv 생성 및 패키지 설치 ===" /usr/bin/python3 -m venv "$VENV" "$VENV/bin/pip" install --upgrade pip --quiet "$VENV/bin/pip" install "numpy==1.24.4" "pandas==2.0.3" \ yfinance pyyaml openpyxl --quiet --prefer-binary if [ -f requirements.txt ]; then "$VENV/bin/pip" install -r requirements.txt --quiet --prefer-binary fi echo "venv 설치 완료" else echo "=== venv 재사용: $("$VENV/bin/python" --version 2>&1) ===" fi # 이후 모든 스텝에서 venv python 사용 echo "$VENV/bin" >> $GITHUB_PATH - name: Install Node Dependencies run: npm install --quiet - name: Validate Specs run: python3 tools/validate_specs.py - name: Validate Formula Registry run: python3 tools/validate_formula_registry.py - name: Validate Golden Case Coverage run: python3 tools/validate_golden_coverage_100.py - name: Build Rebalance Engine V2 run: python3 tools/build_rebalance_engine_v2.py - name: Ingest Fundamentals V2 (Dry Run) run: python3 tools/ingest_fundamental_raw.py --no-naver env: DART_API_KEY: ${{ secrets.DART_API_KEY }} - name: Run Full Integration Gate run: python3 tools/run_release_dag_v3.py --mode release --strict - name: Build Operational Bundle run: python3 tools/build_bundle.py - name: Notify PR Result if: always() && github.event_name == 'pull_request' run: | STATUS="${{ job.status }}" PR_NUM="${{ github.event.pull_request.number }}" RUN_URL="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" if [ "$STATUS" = "success" ]; then MSG="✅ **CI PASS** — gate=PASS step_count=55\n\n[워크플로우 로그](${RUN_URL})" else MSG="❌ **CI FAIL** — 로그 확인 필요\n\n[워크플로우 로그](${RUN_URL})" fi curl -s -X POST "${{ github.api_url }}/repos/${{ github.repository }}/issues/${PR_NUM}/comments" \ -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ -H "Content-Type: application/json" \ -d "{\"body\":\"${MSG}\"}"