diff --git a/Jenkinsfile b/Jenkinsfile index e6f9c5f..eac1a72 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -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 - 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=$? + 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 + python scripts/check_docstrings.py --root atlasbot + docs_rc=$? + else + docs_rc=${ruff_rc} 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 - 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 + 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 set -e printf '%s\n' "${gate_rc}" > build/quality-gate.rc '''