ci: Phase 2 빌드 워크플로우 추가 및 CI/CD 로드맵 작성
Quant Engine CI/CD Pipeline / validate-core (push) Failing after 12s
Quant Engine CI/CD Pipeline / validate-ui-and-storage (push) Has been skipped
Build & Package / build (push) Failing after 1m35s
Deploy to Production / Build & Deploy to Production (push) Has been cancelled
Quant Engine CI/CD Pipeline / validate-core (push) Failing after 12s
Quant Engine CI/CD Pipeline / validate-ui-and-storage (push) Has been skipped
Build & Package / build (push) Failing after 1m35s
Deploy to Production / Build & Deploy to Production (push) Has been cancelled
## 추가 사항 ### 1. build.yml 워크플로우 (새로움) - 별도 빌드 단계 워크플로우 - Gitea Releases로 빌드 아티팩트 발행 - 빌드 메타데이터 포함 (커밋, 타임스탐프, 빌드 번호) - 향후 배포 시 아티팩트 재사용 가능 ### 2. CICD_ROADMAP.md (문서) - Phase 1 완료 항목 정리 * 타임아웃 확대 (15→30분) * 자동 롤백 구현 * 헬스체크 강화 * 배포 이력 추적 - Phase 2 계획 (빌드/배포 분리) * build.yml 사용 * 빌드 아티팩트 재사용 * appsettings.Production.json 타이밍 개선 - Phase 3 계획 (E2E 검증) * 로그인 테스트 * API 기능 테스트 - 우선순위 및 예상 소요 시간 - 모니터링 및 추적 방법 ## 아키텍처 원칙 - **한 번 빌드, 여러 번 배포** (속도 + 일관성) - **자동 실패 대응** (롤백) - **명확한 성공 기준** (다중 검증) - **배포 추적성** (이력 기록) Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,161 @@
|
||||
name: Build & Package
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
workflow_dispatch:
|
||||
|
||||
env:
|
||||
DOTNET_VERSION: '10.0.x'
|
||||
REGISTRY: ghcr.io
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 20
|
||||
permissions:
|
||||
contents: write
|
||||
packages: write
|
||||
|
||||
outputs:
|
||||
build-tag: ${{ steps.metadata.outputs.tag }}
|
||||
commit-hash: ${{ steps.metadata.outputs.commit }}
|
||||
build-time: ${{ steps.metadata.outputs.build-time }}
|
||||
|
||||
steps:
|
||||
- name: Checkout Code
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v3
|
||||
with:
|
||||
dotnet-version: ${{ env.DOTNET_VERSION }}
|
||||
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: '3.10'
|
||||
|
||||
- name: Install Python Dependencies
|
||||
run: pip install pyyaml openpyxl requests
|
||||
|
||||
- name: "[GATE] Run Critical Validations"
|
||||
run: |
|
||||
echo "🔐 Running critical CI validations..."
|
||||
python3 tools/validate_no_direct_api_trading_v1.py || exit 1
|
||||
python3 tools/validate_specs.py || exit 1
|
||||
echo "✅ All critical validations passed"
|
||||
|
||||
- name: Prepare Temp Directory
|
||||
run: |
|
||||
mkdir -p Temp
|
||||
if [ ! -f Temp/final_decision_packet_active.json ]; then
|
||||
echo '{"active_decision": "PASS", "details": "CI dummy packet"}' > Temp/final_decision_packet_active.json
|
||||
fi
|
||||
|
||||
- name: Restore .NET Dependencies
|
||||
run: dotnet restore src/dotnet/QuantEngine.Web/QuantEngine.Web.csproj
|
||||
|
||||
- name: Build Release
|
||||
run: |
|
||||
dotnet build src/dotnet/QuantEngine.Web/QuantEngine.Web.csproj \
|
||||
-c Release \
|
||||
--no-restore
|
||||
|
||||
- name: Run Unit Tests
|
||||
run: |
|
||||
dotnet test src/dotnet/QuantEngine.Core.Tests/QuantEngine.Core.Tests.csproj \
|
||||
-c Release \
|
||||
--no-build
|
||||
|
||||
- name: Publish Release Package
|
||||
run: |
|
||||
dotnet publish src/dotnet/QuantEngine.Web/QuantEngine.Web.csproj \
|
||||
-c Release \
|
||||
--no-build \
|
||||
-o ./publish
|
||||
|
||||
- name: Generate Build Metadata
|
||||
id: metadata
|
||||
run: |
|
||||
COMMIT=$(git rev-parse --short HEAD)
|
||||
BUILD_TIME=$(date -u +'%Y-%m-%dT%H:%M:%SZ')
|
||||
BUILD_TAG="build-${COMMIT}"
|
||||
|
||||
mkdir -p ./publish/wwwroot
|
||||
cat > ./publish/wwwroot/version.json <<VERSIONEOF
|
||||
{
|
||||
"version": "1.0.${{ github.run_number }}-${COMMIT}",
|
||||
"commit": "${COMMIT}",
|
||||
"built": "${BUILD_TIME}",
|
||||
"buildNumber": ${{ github.run_number }}
|
||||
}
|
||||
VERSIONEOF
|
||||
|
||||
echo "tag=${BUILD_TAG}" >> $GITHUB_OUTPUT
|
||||
echo "commit=${COMMIT}" >> $GITHUB_OUTPUT
|
||||
echo "build-time=${BUILD_TIME}" >> $GITHUB_OUTPUT
|
||||
echo "✓ Build metadata: ${BUILD_TAG} @ ${BUILD_TIME}"
|
||||
|
||||
- name: Create Deployment Package
|
||||
run: |
|
||||
echo "📦 Creating deployment package..."
|
||||
|
||||
tar -czf quantengine-${{ steps.metadata.outputs.commit }}.tar.gz \
|
||||
-C ./publish .
|
||||
|
||||
PACKAGE_SIZE=$(du -sh quantengine-${{ steps.metadata.outputs.commit }}.tar.gz | cut -f1)
|
||||
echo "✓ Package created: ${PACKAGE_SIZE}"
|
||||
|
||||
# Verify package integrity
|
||||
tar -tzf quantengine-${{ steps.metadata.outputs.commit }}.tar.gz > /dev/null || exit 1
|
||||
echo "✓ Package integrity verified"
|
||||
|
||||
- name: Create GitHub Release
|
||||
uses: ncipollo/release-action@v1
|
||||
with:
|
||||
tag: ${{ steps.metadata.outputs.tag }}
|
||||
name: Build ${{ steps.metadata.outputs.tag }}
|
||||
body: |
|
||||
**Build Information**
|
||||
- **Commit**: `${{ steps.metadata.outputs.commit }}`
|
||||
- **Built At**: ${{ steps.metadata.outputs.build-time }}
|
||||
- **Build Number**: ${{ github.run_number }}
|
||||
|
||||
**Quality Gates**
|
||||
- ✅ No direct API trading validation
|
||||
- ✅ Specification validation
|
||||
- ✅ Unit tests passed
|
||||
|
||||
**Release Package**
|
||||
- Release artifact: `quantengine-${{ steps.metadata.outputs.commit }}.tar.gz`
|
||||
- Size: $(du -sh quantengine-${{ steps.metadata.outputs.commit }}.tar.gz | cut -f1)
|
||||
|
||||
**Deployment Instructions**
|
||||
```bash
|
||||
# Trigger production deployment with this build
|
||||
curl -X POST https://gitea.taxbaik.com/api/v1/repos/kjh2064/QuantEngineByItz/actions/workflows/deploy-prod.yml/dispatches \
|
||||
-H "Authorization: token ${GITEA_TOKEN}" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"ref":"main", "inputs":{"release_tag":"${{ steps.metadata.outputs.tag }}"}}'
|
||||
```
|
||||
draft: false
|
||||
prerelease: false
|
||||
artifacts: quantengine-${{ steps.metadata.outputs.commit }}.tar.gz
|
||||
artifactErrorsFailBuild: true
|
||||
updateLatestRelease: true
|
||||
|
||||
- name: Notify Build Success
|
||||
if: success()
|
||||
run: |
|
||||
echo "✅ Build ${{ steps.metadata.outputs.tag }} completed successfully"
|
||||
echo "📦 Package available at release: ${{ steps.metadata.outputs.tag }}"
|
||||
|
||||
- name: Notify Build Failure
|
||||
if: failure()
|
||||
run: |
|
||||
echo "❌ Build ${{ steps.metadata.outputs.tag }} failed"
|
||||
exit 1
|
||||
Reference in New Issue
Block a user