From fa760b4ba17bee31f44ba498f1bb652c0b6ccb95 Mon Sep 17 00:00:00 2001 From: danielafoggiattonpu Date: Thu, 30 Oct 2025 09:23:15 -0300 Subject: [PATCH 1/3] New update --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 7bb74fc..80332b7 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ # Descomplicando GitHub Actions +DANIELA FOGGIATTO Se inscreva na aula ao vivo e gratuita: https://quiz.linuxtips.io/github-actions From 27b30a34bddbed0d6b5f15adc33908452f49bd6d Mon Sep 17 00:00:00 2001 From: danielafoggiattonpu Date: Thu, 30 Oct 2025 10:12:28 -0300 Subject: [PATCH 2/3] =?UTF-8?q?atualiza=C3=A7=C3=A3o=20da=20branch=20desaf?= =?UTF-8?q?io-nivel-2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/02-tests-ci.yml | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/.github/workflows/02-tests-ci.yml b/.github/workflows/02-tests-ci.yml index 3a9801b..90833e1 100644 --- a/.github/workflows/02-tests-ci.yml +++ b/.github/workflows/02-tests-ci.yml @@ -20,10 +20,24 @@ jobs: - name: "Checkout do código" uses: actions/checkout@v4 - # INSIRA AQUI A LÓGICA PARA RODAR OS TESTES E VERIFICAR A COBERTURA - ### - ### - ### + - name: "Instalar dependências" + run: | + npm ci + + - name: "Executar testes com cobertura" + run: | + npx nyc --reporter=text-summary npm test + + - name: "Verificar cobertura mínima" + run: | + COVERAGE=$(npx nyc report --reporter=text-summary | grep -oP 'Statements\\s*:\\s*\\K[0-9\\.]+(?=%)' | head -1) + echo "Cobertura obtida: $COVERAGE%" + if (( $(echo "$COVERAGE < $COVERAGE_MIN" | bc -l) )); then + echo "❌ Cobertura abaixo do mínimo exigido ($COVERAGE_MIN%)" + exit 1 + else + echo "✅ Cobertura mínima atingida!" + fi - name: "Extrair porcentagem de cobertura" # Esse step será validado pelo desafio, não altere o nome. No final, ele deve gerar o output "coverage" com a porcentagem de cobertura. id: coverage From 668de7b7e1856c67cc679cfcc363f5d26c2b0855 Mon Sep 17 00:00:00 2001 From: danielafoggiattonpu Date: Thu, 30 Oct 2025 10:20:16 -0300 Subject: [PATCH 3/3] =?UTF-8?q?Adiciona=20workflow=20do=20desafio=20n?= =?UTF-8?q?=C3=ADvel=202?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/03-build-containers.yml | 70 ----------------------- 1 file changed, 70 deletions(-) delete mode 100644 .github/workflows/03-build-containers.yml diff --git a/.github/workflows/03-build-containers.yml b/.github/workflows/03-build-containers.yml deleted file mode 100644 index cbddc24..0000000 --- a/.github/workflows/03-build-containers.yml +++ /dev/null @@ -1,70 +0,0 @@ -name: "Nível 3: Containers e Segurança" - -on: - pull_request: - types: [closed] - branches: [ desafio-nivel-3 ] - -permissions: - contents: read - packages: write - -env: - CHALLENGE_LEVEL: 3 - CHALLENGE_NAME: "containers-e-seguranca" - REGISTRY: ghcr.io - -jobs: - build-scan-and-push: - name: "Build, Lint, Trivy Scan e Push no GHCR" - if: #???? - runs-on: ubuntu-latest - - steps: - # AQUI VAI O CÓDIGO DO DESAFIO :) - - generate-certificate: # DAQUI PARA BAIXO, NÃO ALTERAR - name: "Desafio Nível 3 - Certificado" - needs: build-scan-and-push - if: success() - runs-on: ubuntu-latest - steps: - - name: "Gerar certificado" - run: | - mkdir -p certificates - cat > certificates/level-3-certificate.md << EOF - # Certificado de Conclusão - Nível 3 - - **Descomplicando Github Actions - GitHub Actions Edition** - --- - - Este certificado atesta que **${{ github.actor }}** concluiu com sucesso: - ## Nível 3: Containers e Segurança - - **Competências desenvolvidas:** - - Build de imagem Docker - - Lint de Dockerfile com Hadolint - - Scan de vulnerabilidades com Trivy (CRITICAL = 0) - - Relatório de vulnerabilidades como artefato - - Smoke test de execução do container - - Publicação no GitHub Container Registry (GHCR) condicionada ao scan - - Boas práticas de supply chain - - **Data de conclusão:** $(date) - **Repositório:** ${{ github.repository }} - **Workflow:** ${{ github.run_id }} - - --- - **Badge conquistado:** Containers e Segurança - - --- - *Certificado gerado automaticamente pelo GitHub Actions* - *LINUXtips* - EOF - - - name: "Upload do certificado" - uses: actions/upload-artifact@v4 - with: - name: level-3-certificate - path: certificates/ - retention-days: 30