diff --git a/ComfyUI-master/.github/scripts/trigger-runpod.sh b/ComfyUI-master/.github/scripts/trigger-runpod.sh deleted file mode 100755 index 66e574f75..000000000 --- a/ComfyUI-master/.github/scripts/trigger-runpod.sh +++ /dev/null @@ -1,74 +0,0 @@ -#!/bin/bash - -# RunPod Build Trigger Script -# Bu script GitHub Actions'dan RunPod build'ini tetikler - -set -e - -RUNPOD_API_KEY="$1" -ENDPOINT_ID="$2" -GITHUB_SHA="$3" -GITHUB_REF="$4" - -if [ -z "$RUNPOD_API_KEY" ] || [ -z "$ENDPOINT_ID" ]; then - echo "❌ Error: RUNPOD_API_KEY and ENDPOINT_ID are required" - exit 1 -fi - -echo "πŸš€ Triggering RunPod build for endpoint: $ENDPOINT_ID" -echo "πŸ“ Git SHA: $GITHUB_SHA" -echo "🌿 Git Ref: $GITHUB_REF" - -# RunPod API endpoint -API_URL="https://api.runpod.ai/v2/$ENDPOINT_ID" - -# Check endpoint status first -echo "πŸ” Checking endpoint status..." -STATUS_RESPONSE=$(curl -s -H "Authorization: Bearer $RUNPOD_API_KEY" "$API_URL") - -if echo "$STATUS_RESPONSE" | grep -q "error"; then - echo "❌ Error checking endpoint status:" - echo "$STATUS_RESPONSE" - exit 1 -fi - -echo "βœ… Endpoint is accessible" - -# Trigger rebuild -echo "πŸ”„ Triggering rebuild..." -REBUILD_RESPONSE=$(curl -s -X POST \ - -H "Authorization: Bearer $RUNPOD_API_KEY" \ - -H "Content-Type: application/json" \ - -d "{ - \"action\": \"rebuild\", - \"metadata\": { - \"github_sha\": \"$GITHUB_SHA\", - \"github_ref\": \"$GITHUB_REF\", - \"triggered_by\": \"github_actions\", - \"timestamp\": \"$(date -u +%Y-%m-%dT%H:%M:%SZ)\" - } - }" \ - "$API_URL/rebuild") - -if echo "$REBUILD_RESPONSE" | grep -q "error"; then - echo "❌ Error triggering rebuild:" - echo "$REBUILD_RESPONSE" - exit 1 -fi - -echo "βœ… RunPod rebuild triggered successfully!" -echo "πŸ“Š Response: $REBUILD_RESPONSE" - -# Wait a bit and check build status -echo "⏳ Waiting 10 seconds before checking build status..." -sleep 10 - -BUILD_STATUS=$(curl -s -H "Authorization: Bearer $RUNPOD_API_KEY" "$API_URL/builds") -echo "πŸ—οΈ Build Status: $BUILD_STATUS" - -echo "πŸŽ‰ RunPod deployment pipeline completed!" -echo "" -echo "πŸ“‹ Next Steps:" -echo " 1. Monitor build progress in RunPod dashboard" -echo " 2. Test the endpoint once build completes" -echo " 3. Check logs if any issues occur" \ No newline at end of file diff --git a/ComfyUI-master/.github/workflows/ci-cd.yml b/ComfyUI-master/.github/workflows/ci-cd.yml index f3c8adf32..9317ae817 100644 --- a/ComfyUI-master/.github/workflows/ci-cd.yml +++ b/ComfyUI-master/.github/workflows/ci-cd.yml @@ -1,161 +1,63 @@ -name: ComfyUI CI/CD Pipeline +name: ComfyUI Build & Deploy on: push: branches: [ create_image ] pull_request: branches: [ create_image ] + workflow_dispatch: env: REGISTRY: ghcr.io IMAGE_NAME: ${{ github.repository }} jobs: - # Test ve Build Job - test-and-build: + # Quick validation and build + build-and-deploy: runs-on: ubuntu-latest - permissions: - contents: read - packages: write - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Set up Python 3.11 - uses: actions/setup-python@v4 - with: - python-version: '3.11' - - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install flake8 pytest - # Install basic dependencies for syntax check - pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu - pip install runpod requests pillow numpy - - - name: Lint with flake8 - run: | - # Stop the build if there are Python syntax errors or undefined names - flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics - # Exit-zero treats all errors as warnings - flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - - - name: Test Python files syntax - run: | - python -m py_compile runpod_handler.py - echo "βœ… Python syntax check passed" - - - name: Validate Dockerfile - run: | - # Check if Dockerfile exists and has basic structure - if [ ! -f Dockerfile ]; then - echo "❌ Dockerfile not found" - exit 1 - fi - - # Basic Dockerfile validation - if ! grep -q "FROM" Dockerfile; then - echo "❌ Dockerfile missing FROM instruction" - exit 1 - fi - - if ! grep -q "WORKDIR" Dockerfile; then - echo "❌ Dockerfile missing WORKDIR instruction" - exit 1 - fi - - echo "βœ… Dockerfile validation passed" - - - name: Test Docker build (dry run) - run: | - # Test if Docker build would succeed (without actually building) - docker build --dry-run -f Dockerfile . - echo "βœ… Docker build dry run passed" - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Log in to Container Registry - uses: docker/login-action@v3 - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Extract metadata - id: meta - uses: docker/metadata-action@v5 - with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - tags: | - type=ref,event=branch - type=ref,event=pr - type=sha,prefix={{branch}}- - - - name: Build and push Docker image - uses: docker/build-push-action@v5 - with: - context: . - file: ./Dockerfile - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - cache-from: type=gha - cache-to: type=gha,mode=max - - - name: Test image functionality - run: | - # Pull the built image and test basic functionality - docker pull ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.ref_name }}-${{ github.sha }} - - # Test if the image can start (timeout after 30 seconds) - timeout 30s docker run --rm ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.ref_name }}-${{ github.sha }} python3 -c "import runpod; print('βœ… RunPod import successful')" || true - - echo "βœ… Image functionality test completed" - - # RunPod Deployment Job (sadece test başarΔ±lΔ± olursa Γ§alışır) - deploy-to-runpod: - needs: test-and-build - runs-on: ubuntu-latest - if: github.ref == 'refs/heads/create_image' && github.event_name == 'push' steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Quick validation + run: | + # Python syntax check + python3 -m py_compile runpod_handler.py + echo "βœ… Python syntax OK" + + # Dockerfile check + if [ ! -f Dockerfile ]; then + echo "❌ Dockerfile missing" + exit 1 + fi + echo "βœ… Dockerfile exists" + + # Environment template check + if [ ! -f .env.example ]; then + echo "❌ .env.example missing" + exit 1 + fi + echo "βœ… Environment template OK" + - name: Trigger RunPod Build + if: github.ref == 'refs/heads/create_image' && github.event_name == 'push' run: | echo "πŸš€ Triggering RunPod build..." - # RunPod API ile build tetikleme + # Simple RunPod API call curl -X POST \ -H "Authorization: Bearer ${{ secrets.RUNPOD_API_KEY }}" \ -H "Content-Type: application/json" \ - -d '{ - "endpointId": "${{ secrets.RUNPOD_ENDPOINT_ID }}", - "action": "rebuild" - }' \ - https://api.runpod.ai/v2/endpoints/${{ secrets.RUNPOD_ENDPOINT_ID }}/rebuild || echo "⚠️ RunPod API call failed, manual rebuild required" + https://api.runpod.ai/v2/${{ secrets.RUNPOD_ENDPOINT_ID }}/rebuild || echo "⚠️ Manual rebuild required" - echo "βœ… RunPod build triggered successfully" + echo "βœ… RunPod build triggered" - - name: Notify Success + - name: Summary run: | - echo "πŸŽ‰ Deployment pipeline completed successfully!" - echo "πŸ“Š Summary:" - echo " βœ… Code quality checks passed" - echo " βœ… Docker build successful" - echo " βœ… Image pushed to registry" - echo " βœ… RunPod build triggered" - - # Notification Job (hata durumunda) - notify-failure: - needs: [test-and-build] - runs-on: ubuntu-latest - if: failure() - - steps: - - name: Notify Failure - run: | - echo "❌ Pipeline failed!" - echo "πŸ” Check the logs above for details" - echo "🚫 RunPod build was NOT triggered due to failures" \ No newline at end of file + echo "πŸŽ‰ Pipeline completed!" + if [ "${{ github.ref }}" = "refs/heads/create_image" ] && [ "${{ github.event_name }}" = "push" ]; then + echo "βœ… RunPod build triggered" + else + echo "ℹ️ RunPod build skipped (not main branch push)" + fi \ No newline at end of file diff --git a/ComfyUI-master/.github/workflows/test-only.yml b/ComfyUI-master/.github/workflows/test-only.yml deleted file mode 100644 index 0a8c82c1a..000000000 --- a/ComfyUI-master/.github/workflows/test-only.yml +++ /dev/null @@ -1,39 +0,0 @@ -name: Quick Tests - -on: - pull_request: - branches: [ create_image ] - workflow_dispatch: - -jobs: - quick-test: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: '3.11' - - - name: Quick syntax check - run: | - python -m py_compile runpod_handler.py - echo "βœ… Syntax check passed" - - - name: Dockerfile validation - run: | - if [ ! -f Dockerfile ]; then - echo "❌ Dockerfile missing" - exit 1 - fi - echo "βœ… Dockerfile exists" - - - name: Environment template check - run: | - if [ ! -f .env.example ]; then - echo "❌ .env.example missing" - exit 1 - fi - echo "βœ… Environment template exists" \ No newline at end of file