name: AI Brain CI/CD on: push: branches: [ "main" ] pull_request: branches: [ "main" ] jobs: build: runs-on: ubuntu-latest steps: - name: Checkout repo uses: actions/checkout@v3 - name: Set up Python uses: actions/setup-python@v4 with: python-version: "3.11" - name: Heal all files run: | echo "🔧 Healing scripts..." find . -type f -name "*.sh" -exec chmod +x {} \; find . -type f -exec dos2unix {} \; || true python3 -m compileall . || true - name: Verify sub-brains run: | echo "🧠 Checking sub-brains..." for brain in sub_brains/*; do if [ -x "$brain/launch.sh" ]; then echo "🚀 Launching $brain..." timeout 5s bash "$brain/launch.sh" > test.log 2>&1 || true if grep -q "❌" test.log; then echo "❌ Failure in $brain" cat test.log exit 1 fi echo "✅ $brain OK" fi done docker: needs: build runs-on: ubuntu-latest steps: - name: Checkout repo uses: actions/checkout@v3 - name: Log in to GitHub Container Registry uses: docker/login-action@v2 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: Log in to Docker Hub uses: docker/login-action@v2 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - name: Build and push Docker image uses: docker/build-push-action@v4 with: context: . push: true tags: | ghcr.io/${{ github.repository }}/ai-brain:latest ${{ secrets.DOCKERHUB_USERNAME }}/ai-brain:latest deploy: needs: docker runs-on: ubuntu-latest steps: - name: Deploy placeholder run: | echo "🌍 Ready to deploy anywhere!" echo "Image available at:" echo " ghcr.io/${GITHUB_REPOSITORY}/ai-brain:latest" echo " docker.io/${{ secrets.DOCKERHUB_USERNAME }}/ai-brain:latest" echo "🔗 Hook this job into Kubernetes, AWS, GCP, or bare-metal servers."