From 7e281e654813bde9a21905e612d27df4a875812f Mon Sep 17 00:00:00 2001 From: codex Date: Mon, 20 Apr 2026 10:49:30 -0300 Subject: [PATCH] ci(ariadne): always run tests for quality metrics visibility --- Jenkinsfile | 45 +++++++++++++++++++++++++++++---------------- 1 file changed, 29 insertions(+), 16 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 2c3d8e6..df0e2ac 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -174,29 +174,42 @@ set +e 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}" + 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 ] && [ "${docs_rc}" -eq 0 ]; then - 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 \ - --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=$? +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