diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index aa99bb3..948db2b 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -19,7 +19,7 @@ on: # ───────────────────────────────────────────────────────────────── jobs: - validate-and-build: + validate-core: runs-on: self-hosted steps: @@ -153,16 +153,66 @@ jobs: - name: Validate Snapshot Admin Workflow run: python3 tools/validate_snapshot_admin_workflow_v1.py + validate-ui-and-storage: + runs-on: self-hosted + needs: validate-core + if: always() + + 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: Setup Python Environment + run: | + VENV_BASE=/volume1/gitea/python_venv + REQ_HASH=$(md5sum tools/validate_snapshot_admin_web_v1.py 2>/dev/null | cut -d' ' -f1 || echo "default") + VENV="$VENV_BASE/$REQ_HASH" + + if [ ! -f "$VENV/bin/python" ]; then + echo "=== venv 신규 생성: $REQ_HASH ===" + mkdir -p "$VENV_BASE" + /usr/bin/python3 -m venv "$VENV" + + if [ ! -f "$VENV/bin/pip" ]; then + echo "pip missing in venv, installing via get-pip.py..." + 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 pyyaml openpyxl --quiet + else + echo "=== venv 캐시 히트: $("$VENV/bin/python" --version 2>&1) ===" + fi + echo "$VENV/bin" >> $GITHUB_PATH + - name: Validate Snapshot Admin Web UI + if: needs.validate-core.result == 'success' run: python3 tools/validate_snapshot_admin_web_v1.py - name: Validate Storage Backend Contracts + if: needs.validate-core.result == 'success' run: python3 -m pytest tests/unit/test_storage_backend_v1.py tests/unit/test_validate_kis_api_credentials_v1.py tests/unit/test_qualitative_sell_strategy_store_v1.py tests/unit/test_kis_api_client_v1.py tests/unit/test_snapshot_admin_store_v1.py tests/unit/test_snapshot_admin_web_v1.py -q - name: Notify PR Result - if: github.event_name == 'pull_request' + if: always() && github.event_name == 'pull_request' + env: + CORE_RESULT: ${{ needs.validate-core.result }} + STAGE_RESULT: ${{ job.status }} run: | - STATUS="${{ job.status }}" + STATUS="$STAGE_RESULT" + if [ "$CORE_RESULT" != "success" ]; then + STATUS="failure" + fi PR_NUM="${{ github.event.pull_request.number }}" RUN_URL="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" if [ "$STATUS" = "success" ]; then