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) — 현재 스텝과 이후 스텝 모두 적용 export PATH=/usr/local/bin:$PATH echo "/usr/local/bin" >> $GITHUB_PATH echo "=== 런타임 버전 확인 ===" /usr/bin/python3 --version node --version npm --version - name: Setup Python Environment run: | # 32-bit ARM(armv7l)에는 공식 numpy/pandas 휠 없음 # → micromamba(conda-forge)로 ARM 네이티브 바이너리 제공 MAMBA_DIR=/volume1/gitea/micromamba CONDA_ENV=/volume1/gitea/conda_py38 MAMBA="$MAMBA_DIR/bin/micromamba" # 1) micromamba 바이너리 최초 1회 다운로드 if [ ! -f "$MAMBA" ]; then echo "=== micromamba 다운로드 ===" mkdir -p "$MAMBA_DIR/bin" curl -Ls https://micro.mamba.pm/api/micromamba/linux-32/latest \ | tar -xvj -C "$MAMBA_DIR" --strip-components=1 bin/micromamba chmod +x "$MAMBA" echo "micromamba: $($MAMBA --version)" fi # 2) conda-forge 환경 최초 1회 생성 (numpy/pandas ARM 바이너리 포함) if ! "$CONDA_ENV/bin/python" -c "import numpy, pandas, yaml" 2>/dev/null; then echo "=== conda env 생성 (conda-forge ARM) ===" "$MAMBA" create -p "$CONDA_ENV" -c conda-forge \ python=3.8 numpy pandas pyyaml openpyxl -y --quiet # pip-only 패키지 (yfinance 등) "$CONDA_ENV/bin/pip" install yfinance --quiet --prefer-binary if [ -f requirements.txt ]; then "$CONDA_ENV/bin/pip" install -r requirements.txt --quiet --prefer-binary fi "$CONDA_ENV/bin/python" -c \ "import numpy, pandas; print('numpy', numpy.__version__, '/ pandas', pandas.__version__)" echo "=== conda env 설치 완료 ===" else "$CONDA_ENV/bin/python" -c \ "import numpy, pandas; print('=== conda env 재사용: numpy', numpy.__version__, '/ pandas', pandas.__version__, '===')" fi # 이후 모든 스텝에서 conda python 사용 echo "$CONDA_ENV/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}\"}"