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