From 0d79dea16905fcc679c297abddf132b9e3d13c67 Mon Sep 17 00:00:00 2001 From: Junior Date: Thu, 9 Oct 2025 10:03:37 -0300 Subject: [PATCH 1/6] teste 1 github actions --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 7bb74fc..554e6ea 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +## Testando GitHub Actions Vivaldo Junior + # Descomplicando GitHub Actions Se inscreva na aula ao vivo e gratuita: https://quiz.linuxtips.io/github-actions From 7e4d8588696c28c45a4533880150c963aa0cda55 Mon Sep 17 00:00:00 2001 From: Junior Date: Thu, 9 Oct 2025 10:07:24 -0300 Subject: [PATCH 2/6] teste 1 github actions --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 554e6ea..4e295d9 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -## Testando GitHub Actions Vivaldo Junior +## Testando GitHub Actions Vivaldo Junior 09/10/2025 # Descomplicando GitHub Actions From 20a347f2eca87e166122e32534d0623fc02691ca Mon Sep 17 00:00:00 2001 From: Junior Date: Thu, 9 Oct 2025 19:14:31 -0300 Subject: [PATCH 3/6] add desafio 2 --- .github/workflows/02-tests-ci.yml | 106 +++++++++++++++++------------- 1 file changed, 60 insertions(+), 46 deletions(-) diff --git a/.github/workflows/02-tests-ci.yml b/.github/workflows/02-tests-ci.yml index 3a9801b..284d69e 100644 --- a/.github/workflows/02-tests-ci.yml +++ b/.github/workflows/02-tests-ci.yml @@ -1,10 +1,10 @@ name: "Nível 2: Testes Automatizados" on: pull_request: - branches: [ main ] + branches: [main] env: - NODE_VERSION: '18' + NODE_VERSION: "18" CHALLENGE_LEVEL: 2 CHALLENGE_NAME: "testes-automatizados" COVERAGE_MIN: 80 # Cobertura mínima exigida em porcentagem @@ -20,7 +20,21 @@ 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 ci + + - name: "Executar tests" + run: npm run tests + + + + + # INSIRA AQUI A LÓGICA PARA RODAR OS TESTES E VERIFICAR A COBERTURA ### ### ### @@ -33,46 +47,46 @@ jobs: echo "coverage=$COVERAGE" >> $GITHUB_OUTPUT generate-certificate: # DAQUI PARA BAIXO, NÃO ALTERAR - name: "Desafio Nível 2 - Certificado" - runs-on: ubuntu-latest - needs: tests-and-coverage - if: success() && needs.tests-and-coverage.outputs.coverage != '' - - steps: - - name: "Gerar certificado" - run: | - mkdir -p certificates - cat > certificates/level-2-certificate.md << EOF - # Certificado de Conclusão - Nível 2 - - **Descomplicando Github Actions - GitHub Actions Edition** - --- - - Este certificado atesta que **${{ github.actor }}** concluiu com sucesso: - ## Nível 2: Testes Automatizados - - **Competências desenvolvidas:** - - Automação de testes - - Análise de cobertura - - Lógica de validação com coverage mínimo - - Upload de artefatos - - **Cobertura:** >= ${{ env.COVERAGE_MIN }}% - **Data de conclusão:** $(date) - **Repositório:** ${{ github.repository }} - **Workflow:** ${{ github.run_id }} - - --- - **Badge conquistado:** Testes Automatizados - - --- - *Certificado gerado automaticamente pelo GitHub Actions* - *LINUXtips* - EOF - - - name: "Upload do certificado" - uses: actions/upload-artifact@v4 - with: - name: level-2-certificate - path: certificates/ - retention-days: 30 + name: "Desafio Nível 2 - Certificado" + runs-on: ubuntu-latest + needs: tests-and-coverage + if: success() && needs.tests-and-coverage.outputs.coverage != '' + + steps: + - name: "Gerar certificado" + run: | + mkdir -p certificates + cat > certificates/level-2-certificate.md << EOF + # Certificado de Conclusão - Nível 2 + + **Descomplicando Github Actions - GitHub Actions Edition** + --- + + Este certificado atesta que **${{ github.actor }}** concluiu com sucesso: + ## Nível 2: Testes Automatizados + + **Competências desenvolvidas:** + - Automação de testes + - Análise de cobertura + - Lógica de validação com coverage mínimo + - Upload de artefatos + + **Cobertura:** >= ${{ env.COVERAGE_MIN }}% + **Data de conclusão:** $(date) + **Repositório:** ${{ github.repository }} + **Workflow:** ${{ github.run_id }} + + --- + **Badge conquistado:** Testes Automatizados + + --- + *Certificado gerado automaticamente pelo GitHub Actions* + *LINUXtips* + EOF + + - name: "Upload do certificado" + uses: actions/upload-artifact@v4 + with: + name: level-2-certificate + path: certificates/ + retention-days: 30 From 9f202c96c4b98ccf3311f4cea93090ce59ad0004 Mon Sep 17 00:00:00 2001 From: Junior Date: Thu, 9 Oct 2025 19:29:55 -0300 Subject: [PATCH 4/6] add desafio 2 --- .github/workflows/02-tests-ci.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/02-tests-ci.yml b/.github/workflows/02-tests-ci.yml index 284d69e..0be590d 100644 --- a/.github/workflows/02-tests-ci.yml +++ b/.github/workflows/02-tests-ci.yml @@ -21,20 +21,22 @@ jobs: uses: actions/checkout@v4 - name: "Setup Node" - - uses: actions/setup-node@v5 + uses: actions/setup-node@v5 with: node-version: ${{ env.NODE_VERSION }} - name: "Instalar Deps" run: npm ci - + - name: "Executar tests" run: npm run tests + + - # INSIRA AQUI A LÓGICA PARA RODAR OS TESTES E VERIFICAR A COBERTURA + # INSIRA AQUI A LÓGICA PARA RODAR OS TESTES E VERIFICAR A COBERTURA ### ### ### From d1ae9270b5ff730b86b208dfcd70a05764802ac3 Mon Sep 17 00:00:00 2001 From: Junior Date: Thu, 9 Oct 2025 19:50:40 -0300 Subject: [PATCH 5/6] add desafio 2 --- .github/workflows/02-tests-ci.yml | 19 +++++++++---------- README.md | 2 +- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/.github/workflows/02-tests-ci.yml b/.github/workflows/02-tests-ci.yml index 0be590d..0df0d0f 100644 --- a/.github/workflows/02-tests-ci.yml +++ b/.github/workflows/02-tests-ci.yml @@ -2,6 +2,7 @@ name: "Nível 2: Testes Automatizados" on: pull_request: branches: [main] + env: NODE_VERSION: "18" @@ -20,7 +21,7 @@ jobs: - name: "Checkout do código" uses: actions/checkout@v4 - - name: "Setup Node" + - name: "Setup Node.js" uses: actions/setup-node@v5 with: node-version: ${{ env.NODE_VERSION }} @@ -32,15 +33,6 @@ jobs: run: npm run tests - - - - - # INSIRA AQUI A LÓGICA PARA RODAR OS TESTES E VERIFICAR A COBERTURA - ### - ### - ### - - 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 run: | @@ -48,6 +40,13 @@ jobs: echo "Coverage: $COVERAGE%" echo "coverage=$COVERAGE" >> $GITHUB_OUTPUT + + - name: "Valida se os testes passaram" + if: ${{ steps.coverage.outputs.coverage < env.COVERAGE_MIN }} + run: | + 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" runs-on: ubuntu-latest diff --git a/README.md b/README.md index 4e295d9..c283a5c 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,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 ao Vivaldo Junior 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 fc4f86fded70c32ab8040892dc700866549678f7 Mon Sep 17 00:00:00 2001 From: Junior Date: Thu, 9 Oct 2025 20:12:28 -0300 Subject: [PATCH 6/6] add desafio 2 --- .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 0df0d0f..a215434 100644 --- a/.github/workflows/02-tests-ci.yml +++ b/.github/workflows/02-tests-ci.yml @@ -8,7 +8,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: