Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 2 additions & 80 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ on:
- fix/**
pull_request:
workflow_dispatch:
schedule:
- cron: '*/10 * * * *'

jobs:
backend-tests:
Expand Down Expand Up @@ -100,83 +102,3 @@ jobs:
if [ -f package.json ]; then
npm test --if-present -- --watch=false --coverage --passWithNoTests
fi

# PROD Verifier - Verifica estado real de producción (no rompe CI)
prod-verifier:
name: PROD Verifier (no blocking)
runs-on: ubuntu-latest
# Ejecutar cada 10 minutos + manual
schedule:
- cron: '*/10 * * * *' # Cada 10 minutos
# Permitir ejecución manual
workflow_dispatch:
steps:
- uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.10'

- name: Install requests
run: pip install requests

- name: Run PROD Verifier
id: prod_verify
run: npm --prefix .. run prod-verifier
continue-on-error: true # No rompe CI, solo informa

- name: Generate Job Summary
if: always()
run: |
echo "## 🔍 PROD Verification Status" >> $GITHUB_STEP_SUMMARY
echo "**Run:** [${GITHUB_RUN_ID}](${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID})" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY

if [ -f docs/deploy/prod_evidence.json ]; then
STATUS=$(jq -r '.status' docs/deploy/prod_evidence.json)
CHECKED_AT=$(jq -r '.checked_at' docs/deploy/prod_evidence.json)

echo "**Status:** $STATUS | **Checked:** $CHECKED_AT" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY

# Listar todos los endpoints chequeados
echo "**Endpoints Checked:**" >> $GITHUB_STEP_SUMMARY
jq -r '.results[] | "- \(.name): \(.url) → HTTP \(.status_code)"' docs/deploy/prod_evidence.json >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY

# Status final
if [ "$STATUS" = "FAIL" ]; then
echo "❌ **PRODUCCIÓN EN ERROR** - afirmaciones bloqueadas" >> $GITHUB_STEP_SUMMARY
else
echo "✅ **PRODUCCIÓN VERIFICADA** - afirmaciones permitidas" >> $GITHUB_STEP_SUMMARY
fi

echo "" >> $GITHUB_STEP_SUMMARY
echo "**Artifact:** \`prod-evidence-${GITHUB_RUN_ID}\`" >> $GITHUB_STEP_SUMMARY
else
echo "**Status:** ERROR - No evidence generated" >> $GITHUB_STEP_SUMMARY
echo "❌ **VERIFICATION FAILED** - Check prod-verifier logs" >> $GITHUB_STEP_SUMMARY
fi

- name: Upload evidence artifacts
uses: actions/upload-artifact@v4
if: always()
with:
name: prod-evidence-${{ github.run_id }}
path: |
docs/deploy/prod_evidence.json
docs/deploy/prod_evidence.md
retention-days: 7
run: npm --prefix .. run prod-verifier
continue-on-error: true # No rompe CI, solo informa

- name: Upload evidence
uses: actions/upload-artifact@v4
if: always()
with:
name: prod-evidence-${{ github.run_id }}
path: |
docs/deploy/prod_evidence.json
docs/deploy/prod_evidence.md
retention-days: 7
63 changes: 63 additions & 0 deletions .github/workflows/prod-verifier.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: PROD Verifier (non-blocking)

on:
schedule:
- cron: '*/10 * * * *'
workflow_dispatch:

jobs:
prod-verifier:
name: PROD Verifier
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.10'

- name: Install requests
run: pip install requests

- name: Run PROD Verifier
id: prod_verify
run: python3 tools/prod_verifier.py
continue-on-error: true

- name: Generate Job Summary
if: always()
run: |
echo "## PROD Verification" >> "$GITHUB_STEP_SUMMARY"
echo "Run: ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}" >> "$GITHUB_STEP_SUMMARY"
if [ -f docs/deploy/prod_evidence.json ]; then
python3 - <<'PY' >> "$GITHUB_STEP_SUMMARY"
import json
with open("docs/deploy/prod_evidence.json", "r", encoding="utf-8") as f:
data = json.load(f)
status = data.get("status", "UNKNOWN")
checked_at = data.get("checked_at", "unknown")
print(f"Status: {status} | Checked: {checked_at}")
results = data.get("results", [])
if results:
print("Endpoints:")
for item in results:
name = item.get("name", "endpoint")
url = item.get("url", "")
code = item.get("status_code", "n/a")
print(f"- {name}: {url} -> HTTP {code}")
PY
echo "Artifact: prod-evidence-${GITHUB_RUN_ID}" >> "$GITHUB_STEP_SUMMARY"
else
echo "Status: ERROR - No evidence generated" >> "$GITHUB_STEP_SUMMARY"
fi

- name: Upload evidence artifact
uses: actions/upload-artifact@v4
if: always()
with:
name: prod-evidence-${{ github.run_id }}
path: |
docs/deploy/prod_evidence.json
docs/deploy/prod_evidence.md
retention-days: 7
Loading