ci(atlasbot): run quality gate without docker daemon
This commit is contained in:
parent
cd8d5397cb
commit
6f955ad5a3
31
Jenkinsfile
vendored
31
Jenkinsfile
vendored
@ -213,59 +213,38 @@ PY
|
||||
}
|
||||
stage('Run quality gate') {
|
||||
steps {
|
||||
container('builder') {
|
||||
container('tester') {
|
||||
sh '''
|
||||
set -euo pipefail
|
||||
mkdir -p build
|
||||
case "${TEST_PLATFORM:-$(uname -m)}" in
|
||||
x86_64|amd64|linux/amd64)
|
||||
TEST_PLATFORM_RESOLVED=linux/amd64
|
||||
;;
|
||||
aarch64|arm64|linux/arm64)
|
||||
TEST_PLATFORM_RESOLVED=linux/arm64
|
||||
;;
|
||||
*)
|
||||
TEST_PLATFORM_RESOLVED=linux/amd64
|
||||
;;
|
||||
esac
|
||||
python3 -m pip install --no-cache-dir -r requirements.txt -r requirements-dev.txt
|
||||
set +e
|
||||
docker buildx build --platform "${TEST_PLATFORM_RESOLVED}" --target test --load -t atlasbot-test .
|
||||
prep_rc=$?
|
||||
docs_rc=1
|
||||
loc_rc=1
|
||||
tests_rc=1
|
||||
coverage_contract_rc=1
|
||||
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
|
||||
docker run --rm -v "$PWD/build:/out" atlasbot-test \
|
||||
python scripts/check_file_sizes.py --root atlasbot --max-lines 500
|
||||
loc_rc=$?
|
||||
docker run --rm -v "$PWD/build:/out" atlasbot-test \
|
||||
python -m slipcover --json --out /out/coverage.json --source atlasbot --fail-under 95 \
|
||||
-m pytest -q --junitxml /out/junit.xml
|
||||
python -m slipcover --json --out build/coverage.json --source atlasbot --fail-under 95 \
|
||||
-m pytest -q --junitxml build/junit.xml
|
||||
tests_rc=$?
|
||||
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 build/coverage.json --root atlasbot --threshold 95
|
||||
coverage_contract_rc=$?
|
||||
fi
|
||||
printf '%s\n' "${docs_rc}" > build/docs-naming.rc
|
||||
if [ "${prep_rc}" -eq 0 ]; then
|
||||
gate_rc=0
|
||||
[ "${docs_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
|
||||
'''
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user