diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 10ef71a5d8d27b18207fd2ce1620f10a665b6d9b..d1060feb512564056b386f6c8cad3e351ed7f4d3 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -92,9 +92,7 @@ lint: before_script: - mkdir -p "$PRE_COMMIT_HOME" script: - - 'echo "Running Lint Stage: verifying code formatting and hygiene"' - - 'echo "User: $(whoami), UID: $(id -u)"' - - pre-commit run --config .pre-commit-config.yaml --all-files + - bash ci/scripts/lint.sh # Build stage: produce Python wheel build: @@ -110,10 +108,7 @@ build: image: $IMAGE tags: *runner-tags script: - - 'echo "Running Build Stage: starting build for OS = $OS"' - - bazel version - - echo "Building Python wheel" - - python -m build --wheel + - bash ci/scripts/build.sh cache: - <<: *global_cache - key: "$CI_PIPELINE_ID" @@ -124,10 +119,7 @@ build: test-cli: <<: *test-template script: - - 'echo "Running Test-CLI Stage: installing wheel and running tests on OS = $OS"' - - python -m pip install dist/*.whl - - echo "Executing pytest" - - python -m pytest -v tests/test_cli.py --log-cli-level=DEBUG --junit-xml=junit-cli-${OS}.xml + - bash ci/scripts/test_cli.sh artifacts: when: always expire_in: 7 days @@ -140,10 +132,7 @@ test-cli: test-python-api: <<: *test-template script: - - 'echo "Running Test-Python-API Stage: installing wheel and running tests on OS = $OS"' - - python -m pip install dist/*.whl - - echo "Executing pytest" - - python -m pytest tests/test_python_api.py -v --log-cli-level=DEBUG --junit-xml=junit-python-api-${OS}.xml + - bash ci/scripts/test_python_api.sh artifacts: when: always expire_in: 7 days diff --git a/ci/scripts/build.sh b/ci/scripts/build.sh new file mode 100755 index 0000000000000000000000000000000000000000..c35cecfe8b9528c815ff91d8e183202753d7f216 --- /dev/null +++ b/ci/scripts/build.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash +# +# SPDX-FileCopyrightText: Copyright 2025 Arm Limited and/or its affiliates +# +# SPDX-License-Identifier: Apache-2.0 +# +set -euo pipefail + +echo "Running Build Stage: starting build for OS = $OS" +bazel version + +echo "Building Python wheel" +python -m build --wheel diff --git a/ci/scripts/lint.sh b/ci/scripts/lint.sh new file mode 100755 index 0000000000000000000000000000000000000000..16318897cc3b920c0a4eae2a3819f50d3dfbba75 --- /dev/null +++ b/ci/scripts/lint.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash +# +# SPDX-FileCopyrightText: Copyright 2025 Arm Limited and/or its affiliates +# +# SPDX-License-Identifier: Apache-2.0 +# +set -euo pipefail + +# Ensure pre-commit cache directory exists +mkdir -p "$PRE_COMMIT_HOME" + +echo "Running Lint Stage: verifying code formatting and hygiene" +echo "User: $(whoami), UID: $(id -u)" + +pre-commit run --config .pre-commit-config.yaml --all-files diff --git a/ci/scripts/test_cli.sh b/ci/scripts/test_cli.sh new file mode 100755 index 0000000000000000000000000000000000000000..1af8daffbf3d5c88c61907022790d5b183897d89 --- /dev/null +++ b/ci/scripts/test_cli.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash +# +# SPDX-FileCopyrightText: Copyright 2025 Arm Limited and/or its affiliates +# +# SPDX-License-Identifier: Apache-2.0 +# +set -euo pipefail + +echo "Running Test CLI Stage: installing wheel and running tests on OS = $OS" +python -m pip install dist/*.whl + +echo "Executing pytest" +python -m pytest -v tests/test_cli.py \ + --log-cli-level=DEBUG \ + --junit-xml=junit-cli-${OS}.xml diff --git a/ci/scripts/test_python_api.sh b/ci/scripts/test_python_api.sh new file mode 100755 index 0000000000000000000000000000000000000000..d23066116eb7efde147b0f6fc073c2ed25476d4a --- /dev/null +++ b/ci/scripts/test_python_api.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash +# +# SPDX-FileCopyrightText: Copyright 2025 Arm Limited and/or its affiliates +# +# SPDX-License-Identifier: Apache-2.0 +# +set -euo pipefail + +echo "Running Test-Python-API Stage: installing wheel and running tests on OS = $OS" +python -m pip install dist/*.whl + +echo "Executing pytest" +python -m pytest tests/test_python_api.py \ + -v --log-cli-level=DEBUG \ + --junit-xml=junit-python-api-${OS}.xml