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 set -euo pipefail
mkdir -p build mkdir -p build
set +e set +e
python -m pip install --no-cache-dir -r requirements.txt -r requirements-dev.txt \ python -m pip install --no-cache-dir -r requirements.txt -r requirements-dev.txt
&& python -m ruff check ariadne scripts --select PLR \ install_rc=$?
&& python scripts/check_file_sizes.py --roots ariadne scripts tests --max-lines 500 --waivers ci/loc_hygiene_waivers.tsv \ docs_rc=1
&& python -m slipcover \ 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 \ --json \
--out "${COVERAGE_JSON}" \ --out "${COVERAGE_JSON}" \
--source ariadne \ --source ariadne \
--fail-under "${COVERAGE_MIN}" \ --fail-under "${COVERAGE_MIN}" \
-m pytest -ra -vv --durations=20 --junitxml "${JUNIT_XML}" \ -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')" \ tests_rc=$?
&& if [ -f scripts/check_coverage_contract.py ] && [ -f ci/coverage_contract.json ]; then \ 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
python scripts/check_coverage_contract.py "${COVERAGE_JSON}" ci/coverage_contract.json; \ if [ -f "${COVERAGE_JSON}" ] && [ -f scripts/check_coverage_contract.py ] && [ -f ci/coverage_contract.json ]; then
else \ python scripts/check_coverage_contract.py "${COVERAGE_JSON}" ci/coverage_contract.json
echo "coverage contract check skipped: checker or contract missing"; \ coverage_contract_rc=$?
fi else
gate_rc=$? 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 set -e
printf '%s\n' "${gate_rc}" > build/quality-gate.rc printf '%s\n' "${gate_rc}" > build/quality-gate.rc
'''.stripIndent()) '''.stripIndent())