Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 20 additions & 5 deletions .github/workflows/02-tests-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: 80 # Cobertura mínima exigida em porcentagem.

jobs:
tests-and-coverage:
Expand All @@ -20,10 +20,17 @@ 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 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
Expand All @@ -32,6 +39,14 @@ jobs:
echo "Coverage: $COVERAGE%"
echo "coverage=$COVERAGE" >> $GITHUB_OUTPUT

- name: "Validar cobertura mínima"
if: ${{ fromJSON(steps.coverage.outputs.coverage) < fromJSON(env.COVERAGE_MIN) }}
run: |
echo "Validando cobertura mínima de ${{ env.COVERAGE_MIN }}%..."
COVERAGE=$(echo "${{ steps.coverage.outputs.coverage }}" | awk '{print int($1+0.5)}')
exit 1 # Falha o job


generate-certificate: # DAQUI PARA BAIXO, NÃO ALTERAR
name: "Desafio Nível 2 - Certificado"
runs-on: ubuntu-latest
Expand Down