Files
QuantEngineByItz/.gitea/workflows/ci.yml
T
Workflow config file is invalid. Please check your config file: model.ReadWorkflow: yaml: line 43: could not find expected ':'

107 lines
4.2 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 불필요)
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: Install Python Dependencies
env:
SETUPTOOLS_USE_DISTUTILS: stdlib
run: |
if ! python3 -m pip --version >/dev/null 2>&1; then
curl -sS https://bootstrap.pypa.io/pip/3.8/get-pip.py -o get-pip.py
python3 get-pip.py --user --quiet
rm get-pip.py
fi
export PATH=$HOME/.local/bin:$PATH
python3 -c "import platform, sys; print('[ENV_DEBUG] Platform:', platform.platform(), 'Python:', sys.version)"
# distutils 누락 stub 파일 생성 및 Mock 클래스 주입
DISTUTILS_PATH=$(python3 -c "import distutils, os; print(os.path.dirname(distutils.__file__))")
echo "[ENV_DEBUG] distutils directory: $DISTUTILS_PATH"
cat << 'EOF' > "$DISTUTILS_PATH/cygwinccompiler.py"
import distutils.ccompiler
class CygwinCCompiler(distutils.ccompiler.CCompiler):
pass
EOF
cat << 'EOF' > "$DISTUTILS_PATH/msvccompiler.py"
import distutils.ccompiler
class MSVCCompiler(distutils.ccompiler.CCompiler):
pass
EOF
# 임포트 성공 확인
python3 -c "import distutils, distutils.cygwinccompiler, distutils.msvccompiler; print('[ENV_DEBUG] distutils stub path:', distutils.__file__)"
python3 -m pip install --upgrade pip --user --quiet
python3 -m pip install --upgrade --force-reinstall "setuptools==59.6.0" "wheel" "Cython" --user --quiet
python3 -c "import setuptools; print('[ENV_DEBUG] installed setuptools:', setuptools.__version__)"
python3 -m pip install "numpy==1.24.4" --user --quiet --no-build-isolation
python3 -m pip install "pandas==2.0.3" --user --quiet --no-build-isolation
if [ -f requirements.txt ]; then python3 -m pip install -r requirements.txt --user --quiet --prefer-binary; fi
python3 -m pip install yfinance pyyaml openpyxl --user --quiet --prefer-binary
echo "$HOME/.local/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}\"}"