ci(ariadne): always run tests for quality metrics visibility

This commit is contained in:
codex 2026-04-20 10:49:30 -03:00
parent 6e2d5ea6ed
commit b9951da1ae

48
Jenkinsfile vendored
View File

@ -171,22 +171,46 @@ PY
set -euo pipefail
mkdir -p build
set +e
python -m pip install --no-cache-dir -r requirements.txt -r requirements-dev.txt \
&& python -m ruff check ariadne scripts --select PLR \
&& python scripts/check_file_sizes.py --roots ariadne scripts tests --max-lines 500 --waivers ci/loc_hygiene_waivers.tsv \
&& python -m slipcover \
python -m pip install --no-cache-dir -r requirements.txt -r requirements-dev.txt
install_rc=$?
docs_rc=1
lint_rc=1
loc_rc=1
tests_rc=1
coverage_contract_rc=0
gate_rc=1
if [ "${install_rc}" -eq 0 ]; then
python scripts/check_docstrings.py --root ariadne
docs_rc=$?
python -m ruff check ariadne scripts --select PLR
lint_rc=$?
python scripts/check_file_sizes.py --roots ariadne scripts tests --max-lines 500 --waivers ci/loc_hygiene_waivers.tsv
loc_rc=$?
python -m slipcover \
--json \
--out "${COVERAGE_JSON}" \
--source ariadne \
--fail-under "${COVERAGE_MIN}" \
-m pytest -ra -vv --durations=20 --junitxml "${JUNIT_XML}" \
&& python -c "import json; payload=json.load(open('build/coverage.json', encoding='utf-8')); percent=(payload.get('summary') or {}).get('percent_covered'); print(f'Coverage summary: {percent:.2f}%' if percent is not None else 'Coverage summary unavailable')" \
&& if [ -f scripts/check_coverage_contract.py ] && [ -f ci/coverage_contract.json ]; then \
python scripts/check_coverage_contract.py "${COVERAGE_JSON}" ci/coverage_contract.json; \
else \
echo "coverage contract check skipped: checker or contract missing"; \
fi
gate_rc=$?
-m pytest -ra -vv --durations=20 --junitxml "${JUNIT_XML}"
tests_rc=$?
python -c "import json; payload=json.load(open('build/coverage.json', encoding='utf-8')); percent=(payload.get('summary') or {}).get('percent_covered'); print(f'Coverage summary: {percent:.2f}%' if percent is not None else 'Coverage summary unavailable')" || true
if [ -f "${COVERAGE_JSON}" ] && [ -f scripts/check_coverage_contract.py ] && [ -f ci/coverage_contract.json ]; then
python scripts/check_coverage_contract.py "${COVERAGE_JSON}" ci/coverage_contract.json
coverage_contract_rc=$?
else
echo "coverage contract check skipped: checker, contract, or coverage report missing"
fi
fi
printf '%s\n' "${docs_rc}" > build/docs-naming.rc
if [ "${install_rc}" -eq 0 ]; then
gate_rc=0
[ "${docs_rc}" -eq 0 ] || gate_rc=1
[ "${lint_rc}" -eq 0 ] || gate_rc=1
[ "${loc_rc}" -eq 0 ] || gate_rc=1
[ "${tests_rc}" -eq 0 ] || gate_rc=1
[ "${coverage_contract_rc}" -eq 0 ] || gate_rc=1
fi
set -e
printf '%s\n' "${gate_rc}" > build/quality-gate.rc
'''.stripIndent())