Files
QuantEngineByItz/.gitea/workflows/ci.yml
T
kjh2064 d5121753e3 ci: ARM venv 설치 piwheels 사용 및 설치 완료 체크 강화
- numpy 먼저 설치 → pandas oldest-supported-numpy 1.17.3 소스빌드 방지
- piwheels.org ARM 사전빌드 휠로 소스 컴파일 없이 설치
- 버전 핀 완화: numpy>=1.20 / pandas>=1.5 (ARM 휠 가용 버전 수용)
- venv 체크: pip 존재 여부 → numpy/pandas import 가능 여부로 변경

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-13 21:39:31 +09:00

108 lines
4.3 KiB
YAML

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: |
VENV=/volume1/gitea/python_venv
# numpy import 가능 여부로 설치 완료 판단 (pip만 있어도 설치 실패일 수 있음)
if ! "$VENV/bin/python" -c "import numpy, pandas, yaml" 2>/dev/null; then
echo "=== venv 설치 (ARM 사전빌드 휠 사용) ==="
# venv가 없으면 생성
[ ! -f "$VENV/bin/pip" ] && /usr/bin/python3 -m venv "$VENV"
"$VENV/bin/pip" install --upgrade pip --quiet
# piwheels: ARM(armv7l) 사전빌드 휠 저장소
# numpy 먼저 설치 → pandas 빌드 시 oldest-supported-numpy 1.17.3 소스빌드 방지
"$VENV/bin/pip" install --prefer-binary \
--extra-index-url https://www.piwheels.org/simple/ \
"numpy>=1.20,<2" --quiet
"$VENV/bin/pip" install --prefer-binary \
--extra-index-url https://www.piwheels.org/simple/ \
"pandas>=1.5,<3" yfinance pyyaml openpyxl --quiet
if [ -f requirements.txt ]; then
"$VENV/bin/pip" install --prefer-binary \
--extra-index-url https://www.piwheels.org/simple/ \
-r requirements.txt --quiet
fi
"$VENV/bin/python" -c "import numpy, pandas; print('numpy', numpy.__version__, '/ pandas', pandas.__version__)"
echo "venv 설치 완료"
else
"$VENV/bin/python" -c "import numpy, pandas; print('=== venv 재사용:', 'numpy', numpy.__version__, '/ pandas', pandas.__version__, '===')"
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}\"}"