fix: audit fixes — dead tools bridge, Prometheus /metrics, Research R… #85
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: EVA-Mind CI/CD | |
| on: | |
| push: | |
| branches: [main] | |
| env: | |
| GO_VERSION: "1.24" | |
| VM_IP: "34.35.36.178" | |
| VM_USER: "web2a" | |
| jobs: | |
| # ============================================================================ | |
| # BUILD & TEST (local no GitHub Actions) | |
| # ============================================================================ | |
| build: | |
| name: Build & Test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: ${{ env.GO_VERSION }} | |
| - name: Cache Go modules | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/go/pkg/mod | |
| key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
| restore-keys: | | |
| ${{ runner.os }}-go- | |
| - name: Build | |
| run: | | |
| go mod tidy | |
| CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o eva-mind . | |
| echo "Build OK: $(ls -lh eva-mind | awk '{print $5}')" | |
| # ============================================================================ | |
| # DEPLOY TO VM | |
| # ============================================================================ | |
| deploy: | |
| name: Deploy to VM | |
| runs-on: ubuntu-latest | |
| needs: build | |
| if: github.ref == 'refs/heads/main' | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Authenticate to Google Cloud | |
| uses: google-github-actions/auth@v2 | |
| with: | |
| credentials_json: ${{ secrets.GCP_SA_KEY }} | |
| - name: Set up Cloud SDK | |
| uses: google-github-actions/setup-gcloud@v2 | |
| - name: Deploy via SSH | |
| run: | | |
| gcloud compute ssh ${{ env.VM_USER }}@malaria-vm \ | |
| --zone=africa-south1-a \ | |
| --project=malaria-487614 \ | |
| --command="bash /home/web2a/EVA-Mind/scripts/redeploy.sh" \ | |
| --ssh-flag="-o StrictHostKeyChecking=no" | |
| - name: Health check | |
| run: | | |
| sleep 5 | |
| HTTP_CODE=$(curl -s -o /dev/null -w "%{http_code}" --connect-timeout 10 http://${{ env.VM_IP }}:8091/api/health || echo "000") | |
| if [ "$HTTP_CODE" = "200" ]; then | |
| echo "Health check OK (HTTP $HTTP_CODE)" | |
| else | |
| echo "WARNING: Health check returned HTTP $HTTP_CODE" | |
| fi | |
| - name: Notify | |
| if: always() | |
| run: echo "Deploy ${{ job.status }} - commit ${{ github.sha }}" |