diff --git a/.gitea/workflows/deploy.yaml b/.gitea/workflows/deploy.yaml index c785985..e5232d7 100644 --- a/.gitea/workflows/deploy.yaml +++ b/.gitea/workflows/deploy.yaml @@ -1,4 +1,4 @@ -name: Punisher CI/CD Advanced +name: Punisher CI/CD Full Monitor on: [push] jobs: @@ -6,34 +6,32 @@ jobs: runs-on: ubuntu-latest container: image: catthehacker/ubuntu:act-latest - options: --memory=128mb --cpus=0.5 # Limite di sicurezza per la VPS + options: --memory=128mb --cpus=0.5 steps: - name: Checkout del codice uses: actions/checkout@v3 - - name: Setup Strumenti di Analisi - run: | - apt-get update - apt-get install -y build-essential valgrind curl + - name: Installazione Tool SOC + run: apt-get update && apt-get install -y build-essential valgrind curl - - name: Compilazione Professionale + - name: Compilazione run: make build - - name: Analisi Memoria e Esecuzione Sandbox - # Valgrind monitora ogni byte allocato. Se superi i 128MB o sballi un puntatore, lo vedrai qui. + - name: Esecuzione Sandbox con Valgrind + # Eseguiamo e salviamo tutto in un file run: | - valgrind --leak-check=full \ - --show-leak-kinds=all \ - --track-origins=yes \ - --verbose \ - --log-file=valgrind_report.txt \ - ./lab_app > output.log 2>&1 || echo "CRASH DETECTED" >> output.log + valgrind --leak-check=full --log-file=v_report.txt ./lab_app > app_output.log 2>&1 || true - - name: Invio Report a n8n - # Inviamo sia l'output del programma che il report della memoria - if: always() # Eseguito anche se il codice crasha + - name: Invio Report Finale + if: always() run: | - LOG_CONTENT=$(cat output.log valgrind_report.txt | base64 -w 0) + # Uniamo i log in un unico report leggibile + echo "--- OUTPUT PROGRAMMA ---" > final.txt + cat app_output.log >> final.txt + echo -e "\n\n--- ANALISI VALGRIND ---" >> final.txt + cat v_report.txt >> final.txt + + # Spediamo tutto codificato a n8n curl -X POST -H "Content-Type: application/json" \ - -d "{\"project\":\"${{ github.repository }}\", \"status\":\"finished\", \"log\":\"$LOG_CONTENT\"}" \ - https://n8n.thepunisher-lab.duckdns.org/webhook/LOG_REPORT_ID \ No newline at end of file + -d "{\"log\":\"$(cat final.txt | base64 -w 0)\"}" \ + https://n8n.thepunisher-lab.duckdns.org/webhook/punisher-logs \ No newline at end of file