From c234771d282bdb8bde2096c926914b93aaf05204 Mon Sep 17 00:00:00 2001 From: pm Date: Thu, 11 Jun 2026 23:54:58 +0100 Subject: [PATCH] deploy atualizado; test correto --- .gitea/workflows/deploy.yml | 14 ++++++++++---- tests/core.test.js | 2 +- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index 27b2c5c..8252776 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -17,6 +17,12 @@ jobs: - name: 1. Build Application Image run: docker build -f backend/Dockerfile -t apex-solutions:latest . + - name: 1.5. Run Unit Tests (Lógica de Negócio) + run: | + echo ">>> A instalar dependências e correr testes..." + npm ci + npm test + # ========================================== # ETAPAS ESTÁTICAS DE SEGURANÇA SEPARADAS # ========================================== @@ -24,12 +30,12 @@ jobs: - name: 2. Secret Scanning (Gitleaks) run: | curl -sL https://github.com/gitleaks/gitleaks/releases/download/v8.18.2/gitleaks_8.18.2_linux_x64.tar.gz | tar -xz -C /tmp - /tmp/gitleaks detect --source . --verbose --redact --exit-code 1 || echo "[ALERTA] Credenciais detetadas! Ignorado temporariamente." + /tmp/gitleaks detect --source . --verbose --redact --exit-code 1 - name: 3. Software Composition Analysis (Trivy) run: | curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin - trivy image --severity HIGH,CRITICAL apex-solutions:latest || echo "[ALERTA] Vulnerabilidades de infraestrutura encontradas!" + trivy image --severity HIGH,CRITICAL apex-solutions:latest - name: 4. Static Application Security Testing (SonarQube) run: | @@ -40,7 +46,7 @@ jobs: -Dsonar.sources=. \ -Dsonar.host.url=https://sonar.each-cs.com \ -Dsonar.token=${{ secrets.SONAR_TOKEN }} \ - -Dsonar.qualitygate.wait=true || echo "[ALERTA] SonarQube falhou no Quality Gate." + -Dsonar.qualitygate.wait=true # ========================================== # ETAPAS DINÂMICAS E DEPLOY @@ -91,7 +97,7 @@ jobs: echo ">>> Publicando Relatório ZAP no servidor Web..." docker cp qatests/report.html portal-corporativo:/usr/src/app/frontend/zap-report.html || true - + - name: 7. Archive ZAP Report (Gitea Artifacts) if: always() uses: actions/upload-artifact@v3 diff --git a/tests/core.test.js b/tests/core.test.js index d16a5f1..aac418c 100644 --- a/tests/core.test.js +++ b/tests/core.test.js @@ -1 +1 @@ -test('Pipeline flow: 1 + 1 deve ser 2', () => { expect(1 + 1).toBe(); }); +test('Pipeline flow: 1 + 1 deve ser 2', () => { expect(1 + 1).toBe(2); });