diff --git a/.github/workflows/02-tests-ci.yml b/.github/workflows/02-tests-ci.yml index 3a9801b..d493261 100644 --- a/.github/workflows/02-tests-ci.yml +++ b/.github/workflows/02-tests-ci.yml @@ -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 ci + + - 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: "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