From b9951da1ae58da45f25d46410167d5b40120b161 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 | 48 ++++++++++++++++++++++++++++++++++++------------ 1 file changed, 36 insertions(+), 12 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index d73b1b3..df0e2ac 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -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())