From 18e1b9b3cabd328c975c448422c82534018dca22 Mon Sep 17 00:00:00 2001 From: programedegraca Date: Mon, 15 Sep 2025 14:12:21 -0300 Subject: [PATCH 1/4] Alterando Readme para primeiro Commit. --- README.md | 2 ++ package-lock.json | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 5cb91d8..e089e29 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # Descomplicando GitHub Actions +Desafio realizado pelo Leonardo Vieira Neto + 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. diff --git a/package-lock.json b/package-lock.json index 81ce03d..637f55d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,11 +1,11 @@ { - "name": "LINUXtips-github-actions", + "name": "descomplicando-github-actions", "version": "1.0.0", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "LINUXtips-github-actions", + "name": "descomplicando-github-actions", "version": "1.0.0", "license": "MIT", "dependencies": { @@ -925,4 +925,4 @@ } } } -} \ No newline at end of file +} From b8cc69051f86797d6d2da2702c440c112cc57383 Mon Sep 17 00:00:00 2001 From: Leonardo Vieira Neto Date: Wed, 17 Sep 2025 22:05:32 +0000 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..252c7f2 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,16 @@ 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" + uses: actions/setup-node@v5 + with: + node-version: ${{ env.NODE_VERSION }} + + - name: "Instalar Deps" + run: npm cli + + - name: "Executar tests" + 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 @@ -32,6 +38,12 @@ jobs: echo "Coverage: $COVERAGE%" echo "coverage=$COVERAGE" >> $GITHUB_OUTPUT + - name: "Validar se os testes passaram" + if: ${{ steps.coverage.outputs.coverage < env.COVERAGE_MIN }} + run: | + echo "Cobertura mínima de testes 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" runs-on: ubuntu-latest From bb1b2b1385579fe594c029f6c8f587f5933411d6 Mon Sep 17 00:00:00 2001 From: Leonardo Vieira Neto Date: Wed, 17 Sep 2025 19:18:42 -0300 Subject: [PATCH 3/4] Update 02-tests-ci.yml Arrumando comando npm ci --- .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 252c7f2..0cae5c6 100644 --- a/.github/workflows/02-tests-ci.yml +++ b/.github/workflows/02-tests-ci.yml @@ -26,7 +26,7 @@ jobs: node-version: ${{ env.NODE_VERSION }} - name: "Instalar Deps" - run: npm cli + run: npm ci - name: "Executar tests" run: npm run tests From bc65a0555b530571eba6ef23f066c52dd5e4c449 Mon Sep 17 00:00:00 2001 From: Leonardo Vieira Neto Date: Wed, 17 Sep 2025 19:24:57 -0300 Subject: [PATCH 4/4] Update 02-tests-ci.yml MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Voltando cobertura mínima de testes para 80% --- .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 0cae5c6..0ece965 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: