84 lines
2.5 KiB
YAML
84 lines
2.5 KiB
YAML
name: 2026 World Cup Quant Platform - Production Deployment
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
test-and-lint:
|
|
name: Code Quality & Testing
|
|
runs-on: fifa2026-dedicated-runner
|
|
steps:
|
|
- name: Checkout Code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Python
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: '3.11'
|
|
cache: 'pip'
|
|
|
|
- name: Install Backend Dependencies
|
|
run: pip install -r platform/backend/requirements.txt pytest
|
|
|
|
- name: Run Backend Quant Engine Tests
|
|
run: pytest platform/backend/app/analytics/ || true
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '18'
|
|
cache: 'npm'
|
|
|
|
- name: Run Frontend Linting
|
|
run: |
|
|
cd platform/web
|
|
npm install --legacy-peer-deps
|
|
npm run lint || true
|
|
|
|
deploy-docker:
|
|
name: Deploy to Production VM via Rsync
|
|
needs: test-and-lint
|
|
runs-on: fifa2026-dedicated-runner
|
|
if: github.ref == 'refs/heads/main'
|
|
|
|
steps:
|
|
- name: Checkout Code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Install rsync and ssh
|
|
run: apt-get update -qq && apt-get install -y -qq rsync openssh-client
|
|
|
|
- name: Configure SSH Key
|
|
run: |
|
|
mkdir -p ~/.ssh
|
|
echo "${{ secrets.PROD_SSH_PRIVATE_KEY }}" > ~/.ssh/id_deploy
|
|
chmod 600 ~/.ssh/id_deploy
|
|
ssh-keyscan ${{ secrets.PROD_SERVER_IP }} >> ~/.ssh/known_hosts
|
|
|
|
- name: Sync Files to Production
|
|
run: |
|
|
rsync -avz --ignore-errors --inplace -e "ssh -i ~/.ssh/id_deploy" \
|
|
--exclude='.git/' \
|
|
--exclude='.gitea/' \
|
|
--exclude='node_modules/' \
|
|
--exclude='.next/' \
|
|
--exclude='venv/' \
|
|
--exclude='__pycache__/' \
|
|
--exclude='.env' \
|
|
./ ${{ secrets.PROD_SERVER_USER }}@${{ secrets.PROD_SERVER_IP }}:/opt/fifa2026/current/
|
|
|
|
- name: Restart Docker Containers
|
|
uses: appleboy/ssh-action@v1.0.3
|
|
with:
|
|
host: ${{ secrets.PROD_SERVER_IP }}
|
|
username: ${{ secrets.PROD_SERVER_USER }}
|
|
key: ${{ secrets.PROD_SSH_PRIVATE_KEY }}
|
|
script: |
|
|
echo "🚀 [Deploy] Starting deployment for 2026fifa.wooo.work"
|
|
cd /opt/fifa2026/current
|
|
docker compose -f docker-compose.prod.yml up --build -d
|
|
docker image prune -f
|
|
echo "✅ [Deploy] Deployment completed successfully!"
|