From 49c17f930cba0c288c8f7d818d41526ac39fbdaf Mon Sep 17 00:00:00 2001 From: Luis Feliphe S Batista Date: Wed, 17 Sep 2025 08:12:01 -0400 Subject: [PATCH 1/4] refactor: :recycle: adiciona nome no readme do projeto. #main --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7bb74fc..8176b66 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ Se inscreva na aula ao vivo e gratuita: https://quiz.linuxtips.io/github-actions -Bem-vindo ao **Descomplicando GitHub Actions**! Este projeto foi criado pela comunidade **LINUXtips** para você aprender os conceitos básicos de CI/CD na prática de forma simples e direta. +Bem-vindo Luis Feliphe ao **Descomplicando GitHub Actions**! Este projeto foi criado pela comunidade **LINUXtips** para você aprender os conceitos básicos de CI/CD na prática de forma simples e direta. Este projeto foi desenhado para ser o material de apoio do vídeo "Descomplicando GitHub Actions" no [canal da LINUXtips no YouTube](https://youtube.com/linuxtips). A ideia é que você possa codificar junto e aprender na prática. From 843dd0c58ed2da4cdf6099000aeb22789ab78a9a Mon Sep 17 00:00:00 2001 From: Luis Feliphe S Batista Date: Mon, 29 Sep 2025 23:44:29 -0400 Subject: [PATCH 2/4] add desafio 2 --- .github/workflows/02-tests-ci.yml | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/.github/workflows/02-tests-ci.yml b/.github/workflows/02-tests-ci.yml index 3a9801b..9a3b8ef 100644 --- a/.github/workflows/02-tests-ci.yml +++ b/.github/workflows/02-tests-ci.yml @@ -7,7 +7,7 @@ env: NODE_VERSION: '18' CHALLENGE_LEVEL: 2 CHALLENGE_NAME: "testes-automatizados" - COVERAGE_MIN: 80 # Cobertura mínima exigida em porcentagem + COVERAGE_MIN: 99 # Cobertura mínima exigida em porcentagem jobs: tests-and-coverage: @@ -20,10 +20,14 @@ jobs: - name: "Checkout do código" uses: actions/checkout@v4 - # INSIRA AQUI A LÓGICA PARA RODAR OS TESTES E VERIFICAR A COBERTURA - ### - ### - ### + - name: "Setup Node.js" + uses: actions/setup-node@v4 + with: + node-version: ${{ env.NODE_VERSION }} + - name: "Instalar dependências" + run: npm ci + - name: "Executar testes" + run: npm run tests - 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 @@ -31,6 +35,14 @@ jobs: COVERAGE=$(npx nyc report --reporter=text-summary | grep -oP 'Statements\s*:\s*\K[0-9\.]+(?=%)' | head -1) echo "Coverage: $COVERAGE%" echo "coverage=$COVERAGE" >> $GITHUB_OUTPUT + - name: "Validar cobertura mínima" + run: | + if (( $(echo "$COVERAGE < ${{ env.COVERAGE_MIN }}" | bc -l) )); then + echo "Cobertura insuficiente: $COVERAGE%. Mínimo exigido: ${{ env.COVERAGE_MIN }}%." + exit 1 + else + echo "Cobertura válida: $COVERAGE%. Atingido: ${{ steps.coverage.outputs.coverage }}%." + fi generate-certificate: # DAQUI PARA BAIXO, NÃO ALTERAR name: "Desafio Nível 2 - Certificado" From 2b0456592967b30f47096ae7184ae52b91b9fa6b Mon Sep 17 00:00:00 2001 From: Luis Feliphe S Batista Date: Tue, 30 Sep 2025 00:00:30 -0400 Subject: [PATCH 3/4] Desafio2 teste --- .github/workflows/02-tests-ci.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/02-tests-ci.yml b/.github/workflows/02-tests-ci.yml index 9a3b8ef..7ecf7d2 100644 --- a/.github/workflows/02-tests-ci.yml +++ b/.github/workflows/02-tests-ci.yml @@ -24,8 +24,10 @@ jobs: uses: actions/setup-node@v4 with: node-version: ${{ env.NODE_VERSION }} + - name: "Instalar dependências" run: npm ci + - name: "Executar testes" run: npm run tests @@ -35,14 +37,12 @@ jobs: COVERAGE=$(npx nyc report --reporter=text-summary | grep -oP 'Statements\s*:\s*\K[0-9\.]+(?=%)' | head -1) echo "Coverage: $COVERAGE%" echo "coverage=$COVERAGE" >> $GITHUB_OUTPUT - - name: "Validar cobertura mínima" + + - name: "Valida se os testes passaram" + if: ${{ steps.coverage.outputs.coverage < env.COVERAGE_MIN }} run: | - if (( $(echo "$COVERAGE < ${{ env.COVERAGE_MIN }}" | bc -l) )); then - echo "Cobertura insuficiente: $COVERAGE%. Mínimo exigido: ${{ env.COVERAGE_MIN }}%." - exit 1 - else - echo "Cobertura válida: $COVERAGE%. Atingido: ${{ steps.coverage.outputs.coverage }}%." - fi + echo "Cobertura mínima não atendida: Esperado - ${{ env.COVERAGE_MIN }}%. Atingido: ${{ steps.coverage.outputs.coverage }}%" + exit 1 generate-certificate: # DAQUI PARA BAIXO, NÃO ALTERAR name: "Desafio Nível 2 - Certificado" From d598c1a85c5eab24ffc0fa6114e8c97750461df5 Mon Sep 17 00:00:00 2001 From: Luis Feliphe S Batista Date: Tue, 30 Sep 2025 00:10:36 -0400 Subject: [PATCH 4/4] Desafio2 teste --- .github/workflows/02-tests-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/02-tests-ci.yml b/.github/workflows/02-tests-ci.yml index 7ecf7d2..58fb7a1 100644 --- a/.github/workflows/02-tests-ci.yml +++ b/.github/workflows/02-tests-ci.yml @@ -7,7 +7,7 @@ env: NODE_VERSION: '18' CHALLENGE_LEVEL: 2 CHALLENGE_NAME: "testes-automatizados" - COVERAGE_MIN: 99 # Cobertura mínima exigida em porcentagem + COVERAGE_MIN: 80 # Cobertura mínima exigida em porcentagem jobs: tests-and-coverage: