From b970f54deaab23d33acc227890c235d3347afc54 Mon Sep 17 00:00:00 2001 From: Bruno Domingues Date: Wed, 14 May 2025 15:36:07 -0300 Subject: [PATCH] Add quality gate workflow 14. --- .github/workflows/quality-gate.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/.github/workflows/quality-gate.yml b/.github/workflows/quality-gate.yml index 9acdc14..028daff 100644 --- a/.github/workflows/quality-gate.yml +++ b/.github/workflows/quality-gate.yml @@ -75,7 +75,20 @@ jobs: - name: 🧪 Run Tests with Pytest run: | + set +e pytest tests --junitxml=pytest.xml --cov=scouter --cov-report=xml --cov-report=term + PYTEST_EXIT_CODE=$? + set -e + + if [ $PYTEST_EXIT_CODE -eq 0 ]; then + echo "Pytest executado com sucesso." + elif [ $PYTEST_EXIT_CODE -eq 5 ]; then + echo "Pytest finalizado com código 5 (Nenhum teste encontrado). Tratando como sucesso para este workflow." + exit 0 + else + echo "Pytest falhou com código de saída $PYTEST_EXIT_CODE." + exit $PYTEST_EXIT_CODE + fi - name: 📊 Run SonarQube Analysis env: