ci(atlasbot): enforce docs/style before loc and publish docs_naming
This commit is contained in:
parent
2f42c176ba
commit
abcb38a3f7
29
Jenkinsfile
vendored
29
Jenkinsfile
vendored
@ -218,19 +218,33 @@ PY
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
set +e
|
set +e
|
||||||
docker buildx build --platform "${TEST_PLATFORM_RESOLVED}" --target test --load -t atlasbot-test . \
|
docker buildx build --platform "${TEST_PLATFORM_RESOLVED}" --target test --load -t atlasbot-test .
|
||||||
&& docker run --rm -v "$PWD/build:/out" atlasbot-test \
|
prep_rc=$?
|
||||||
python -m ruff check atlasbot scripts --select E,F,W,B,C90,I,RUF,ARG --ignore E501 \
|
docs_rc=1
|
||||||
&& docker run --rm -v "$PWD/build:/out" atlasbot-test \
|
gate_rc=1
|
||||||
|
if [ "${prep_rc}" -eq 0 ]; then
|
||||||
|
docker run --rm -v "$PWD/build:/out" atlasbot-test \
|
||||||
|
python -m ruff check atlasbot scripts --select E,F,W,B,C90,I,RUF,ARG --ignore E501
|
||||||
|
ruff_rc=$?
|
||||||
|
if [ "${ruff_rc}" -eq 0 ]; then
|
||||||
|
docker run --rm -v "$PWD/build:/out" atlasbot-test \
|
||||||
|
python scripts/check_docstrings.py --root atlasbot
|
||||||
|
docs_rc=$?
|
||||||
|
else
|
||||||
|
docs_rc=${ruff_rc}
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
printf '%s\n' "${docs_rc}" > build/docs-naming.rc
|
||||||
|
if [ "${prep_rc}" -eq 0 ] && [ "${docs_rc}" -eq 0 ]; then
|
||||||
|
docker run --rm -v "$PWD/build:/out" atlasbot-test \
|
||||||
python scripts/check_file_sizes.py --root atlasbot --max-lines 500 \
|
python scripts/check_file_sizes.py --root atlasbot --max-lines 500 \
|
||||||
&& docker run --rm -v "$PWD/build:/out" atlasbot-test \
|
|
||||||
python scripts/check_docstrings.py --root atlasbot \
|
|
||||||
&& docker run --rm -v "$PWD/build:/out" atlasbot-test \
|
&& docker run --rm -v "$PWD/build:/out" atlasbot-test \
|
||||||
python -m slipcover --json --out /out/coverage.json --source atlasbot --fail-under 95 \
|
python -m slipcover --json --out /out/coverage.json --source atlasbot --fail-under 95 \
|
||||||
-m pytest -q --junitxml /out/junit.xml \
|
-m pytest -q --junitxml /out/junit.xml \
|
||||||
&& docker run --rm -v "$PWD/build:/out" atlasbot-test \
|
&& docker run --rm -v "$PWD/build:/out" atlasbot-test \
|
||||||
python scripts/check_coverage.py /out/coverage.json --root atlasbot --threshold 95
|
python scripts/check_coverage.py /out/coverage.json --root atlasbot --threshold 95
|
||||||
gate_rc=$?
|
gate_rc=$?
|
||||||
|
fi
|
||||||
set -e
|
set -e
|
||||||
printf '%s\n' "${gate_rc}" > build/quality-gate.rc
|
printf '%s\n' "${gate_rc}" > build/quality-gate.rc
|
||||||
'''
|
'''
|
||||||
@ -247,6 +261,7 @@ PY
|
|||||||
export COVERAGE_PATH='build/coverage.json'
|
export COVERAGE_PATH='build/coverage.json'
|
||||||
export SOURCE_ROOT='atlasbot'
|
export SOURCE_ROOT='atlasbot'
|
||||||
export QUALITY_GATE_RC_PATH='build/quality-gate.rc'
|
export QUALITY_GATE_RC_PATH='build/quality-gate.rc'
|
||||||
|
export QUALITY_GATE_DOCS_RC_PATH='build/docs-naming.rc'
|
||||||
python scripts/publish_test_metrics.py || true
|
python scripts/publish_test_metrics.py || true
|
||||||
'''
|
'''
|
||||||
}
|
}
|
||||||
|
|||||||
@ -178,12 +178,14 @@ def main() -> int:
|
|||||||
junit_path = Path(os.getenv("JUNIT_PATH", "build/junit.xml"))
|
junit_path = Path(os.getenv("JUNIT_PATH", "build/junit.xml"))
|
||||||
coverage_path = Path(os.getenv("COVERAGE_PATH", "build/coverage.json"))
|
coverage_path = Path(os.getenv("COVERAGE_PATH", "build/coverage.json"))
|
||||||
gate_rc_path = Path(os.getenv("QUALITY_GATE_RC_PATH", "build/quality-gate.rc"))
|
gate_rc_path = Path(os.getenv("QUALITY_GATE_RC_PATH", "build/quality-gate.rc"))
|
||||||
|
docs_rc_path = Path(os.getenv("QUALITY_GATE_DOCS_RC_PATH", "build/docs-naming.rc"))
|
||||||
source_root = Path(os.getenv("SOURCE_ROOT", "atlasbot"))
|
source_root = Path(os.getenv("SOURCE_ROOT", "atlasbot"))
|
||||||
build_dir = Path(os.getenv("BUILD_DIR", "build"))
|
build_dir = Path(os.getenv("BUILD_DIR", "build"))
|
||||||
|
|
||||||
totals = _load_junit(junit_path)
|
totals = _load_junit(junit_path)
|
||||||
coverage_pct = _load_coverage_percent(coverage_path)
|
coverage_pct = _load_coverage_percent(coverage_path)
|
||||||
gate_rc = _load_gate_rc(gate_rc_path)
|
gate_rc = _load_gate_rc(gate_rc_path)
|
||||||
|
docs_rc = _load_gate_rc(docs_rc_path)
|
||||||
source_lines_over_500 = _count_source_lines_over_500(source_root)
|
source_lines_over_500 = _count_source_lines_over_500(source_root)
|
||||||
passed = max(totals["tests"] - totals["failures"] - totals["errors"] - totals["skipped"], 0)
|
passed = max(totals["tests"] - totals["failures"] - totals["errors"] - totals["skipped"], 0)
|
||||||
outcome = "ok" if totals["tests"] > 0 and totals["failures"] == 0 and totals["errors"] == 0 else "failed"
|
outcome = "ok" if totals["tests"] > 0 and totals["failures"] == 0 and totals["errors"] == 0 else "failed"
|
||||||
@ -193,7 +195,7 @@ def main() -> int:
|
|||||||
"tests": "ok" if outcome == "ok" else "failed",
|
"tests": "ok" if outcome == "ok" else "failed",
|
||||||
"coverage": "ok" if coverage_pct >= 95.0 else "failed",
|
"coverage": "ok" if coverage_pct >= 95.0 else "failed",
|
||||||
"loc": "ok" if source_lines_over_500 == 0 else "failed",
|
"loc": "ok" if source_lines_over_500 == 0 else "failed",
|
||||||
"docs_naming": "not_applicable",
|
"docs_naming": "ok" if docs_rc == 0 else "failed",
|
||||||
"gate_glue": "ok",
|
"gate_glue": "ok",
|
||||||
"sonarqube": _sonarqube_check_status(build_dir),
|
"sonarqube": _sonarqube_check_status(build_dir),
|
||||||
"supply_chain": _supply_chain_check_status(build_dir),
|
"supply_chain": _supply_chain_check_status(build_dir),
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user