diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000000000000000000000000000000000000..b1c75fb654d8fdd5d3d9eba518b9994445810ca1 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,122 @@ +# +# SPDX-FileCopyrightText: Copyright 2025 Arm Limited and/or its affiliates +# +# SPDX-License-Identifier: Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the License); you may +# not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an AS IS BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +stages: +- build +- test + +default: + image: registry.gitlab.arm.com/artificial-intelligence/ethos-u/ethos-u-vela/image:latest + tags: + - arm64 + interruptible: true + # Cache the virtual Python environment and the cache content to speed up builds + cache: + paths: + - .cache/ + - .venv/ + # Initialize a cached virtual Python environment + before_script: + - python3 -m venv .venv + - source .venv/bin/activate + +# Move the cache directory inside the project directory so that we can cache +# output from e.g. pip, ccache and pre-commit +variables: + XDG_CACHE_HOME: $CI_PROJECT_DIR/.cache + +workflow: + auto_cancel: + on_new_commit: interruptible + +# This job does not produce any artifacts, however the result from the build +# will be stored in the cache +build-python: + stage: build + script: + - pip install -v -e .[dev] + +build-unit-tests-gcc: + stage: build + script: + - cmake -S ethosu/regor -B ${CI_JOB_NAME_SLUG} --toolchain cmake/toolchains/gcc.cmake -DCMAKE_BUILD_TYPE=Debug -DREGOR_SANITIZE=address + - cmake --build ${CI_JOB_NAME_SLUG} -t unit_tests -j$(nproc) + # Copy the output, since archiving results does not follow symlinks + - cp ${CI_JOB_NAME_SLUG}/unit_tests unit_tests-gcc + artifacts: + public: false + expire_in: 1 day + paths: + - unit_tests-gcc + +build-unit-tests-clang: + stage: build + script: + - cmake -S ethosu/regor -B ${CI_JOB_NAME_SLUG} --toolchain cmake/toolchains/clang.cmake -DCMAKE_BUILD_TYPE=Debug -DREGOR_SANITIZE=address + - cmake --build ${CI_JOB_NAME_SLUG} -t unit_tests -j$(nproc) + # Copy the output, since archiving results does not follow symlinks + - cp ${CI_JOB_NAME_SLUG}/unit_tests unit_tests-clang + artifacts: + public: false + expire_in: 1 day + paths: + - unit_tests-clang + +test-pre-commit-hooks: + stage: test + needs: + - build-python + script: + # Restore the installation from the cache + - pip install -e .[dev] + # Skip pytest since it's run as a separate job below + - SKIP=pytest pre-commit run --all-files + +test-linux-aarch64: + stage: test + parallel: + matrix: + - BUILD_JOB_PROVIDER: [clang, gcc] + needs: + - build-unit-tests-clang + - build-unit-tests-gcc + script: + - ./unit_tests-${BUILD_JOB_PROVIDER} --reporter JUnit --out results-${BUILD_JOB_PROVIDER}.xml + artifacts: + when: always + expire_in: 1 day + paths: + - results-${BUILD_JOB_PROVIDER}.xml + reports: + junit: results-${BUILD_JOB_PROVIDER}.xml + +test-python: + stage: test + needs: + - build-python + script: + # Restore the installation from the cache + - pip install -e .[dev] + - pytest --junit-xml=results-python.xml + artifacts: + when: always + expire_in: 1 day + paths: + - results-python.xml + reports: + junit: results-python.xml diff --git a/Dockerfiles/Dockerfile b/Dockerfiles/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..99edc45dcd2b2051160b0dd49f9c83d5a1a0edc3 --- /dev/null +++ b/Dockerfiles/Dockerfile @@ -0,0 +1,38 @@ +# +# SPDX-FileCopyrightText: Copyright 2025 Arm Limited and/or its affiliates +# +# SPDX-License-Identifier: Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the License); you may +# not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an AS IS BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +FROM ubuntu:22.04 +ENV DEBIAN_FRONTEND=noninteractive + +# Packages +RUN apt-get update && \ + apt-get install -y \ + git \ + git-lfs \ + build-essential \ + cmake \ + clang \ + clang-format \ + llvm \ + curl \ + zip \ + unzip \ + ccache \ + python3-pip \ + python3-venv \ + python3-dev