From 300988ad1673bb2de50b8e6a9a896f5af41f5a4b Mon Sep 17 00:00:00 2001 From: Zygmunt Krynicki <zygmunt.krynicki@huawei.com> Date: Tue, 2 Mar 2021 15:30:14 +0100 Subject: [PATCH] Add CI job running yocto-layer-checker This will ensure that easy-to-spot mistakes don't get merged unnoticed. Closes: https://git.ostc-eu.org/OSTC/OHOS/meta-python-dunfellplus/-/issues/2 Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@huawei.com> --- .ostc-ci/gitlab-ci.yml | 62 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 .ostc-ci/gitlab-ci.yml diff --git a/.ostc-ci/gitlab-ci.yml b/.ostc-ci/gitlab-ci.yml new file mode 100644 index 0000000..4bb29bf --- /dev/null +++ b/.ostc-ci/gitlab-ci.yml @@ -0,0 +1,62 @@ +# SPDX-License-Identifier: Apache-2.0 +# +# Copyright 2020-2021 Huawei Inc. +# +# 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 +# +# http://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. + +check-layer: + stage: test + image: + name: registry.ostc-eu.org/ostc/containers/ostc-builder:latest + before_script: + # Bitbake requires a non-root user to operate. + # The container should have a non-root user by default. + - test "$(id -u)" -ne 0 || ( echo "precondition failed - this job cannot run as root" && exit 1 ) + + # Create scratch space, being careful not to pollute the working directory. + - SCRATCH_DIR="$(mktemp -d)" + - echo "$SCRATCH_DIR" > "$CI_PROJECT_DIR"/.scratch-dir-name + + - cd "$SCRATCH_DIR" + + # Clone poky and meta-openembedded at the dunfell branch. This repository + # is an extension built on top of dunfell, so those have to be in sync. + # + # FIXME: use local mirror to speed up this step. + # https://git.ostc-eu.org/OSTC/infrastructure/ostc-manifest-mirror/-/issues/1 + - git clone --depth 1 --branch dunfell git://git.yoctoproject.org/poky.git + + # FIXME: use local mirror to speed up this step. + # https://git.ostc-eu.org/OSTC/infrastructure/ostc-manifest-mirror/-/issues/2 + - git clone --depth 1 --branch dunfell git://git.openembedded.org/meta-openembedded.git + + script: + # Reload the value of SCRATCH_DIR set in the before_script phase. Those run + # in separate shell processes and do not share environment variables. + - SCRATCH_DIR="$(cat "$CI_PROJECT_DIR"/.scratch-dir-name)" + - cd "$SCRATCH_DIR" && . ./poky/oe-init-build-env build + # xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + # NOTE: From now on, we are running inside "$SCRATCH_DIR"/build + # with bash modified by oe-init-build-env. We now have access to bitbake, + # devtool and other related tools. + # xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + + # Run yocto-layer-check with the meta-python and meta-oe layers as dependencies. + - yocto-check-layer --dependency "$SCRATCH_DIR"/meta-openembedded/meta-python/ "$SCRATCH_DIR"/meta-openembedded/meta-oe/ --with-software-layer-signature-check --debug "$CI_PROJECT_DIR" + + after_script: + # Reload the value of SCRATCH_DIR set in the before_script phase. + - SCRATCH_DIR="$(cat "$CI_PROJECT_DIR"/.scratch-dir-name)" + # Clean up after ourselves. + - rm -f "$CI_PROJECT_DIR"/.scratch-dir-name + - rm -rf "$SCRATCH_DIR" -- GitLab