Skip to content
Snippets Groups Projects
gitlab-ci.yml 2.74 KiB
Newer Older
# 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.

stages:
include:
 - project: 'OSTC/infrastructure/pipelines'
   file:
    - 'dco.yaml'
    - 'reuse.yaml'
 - project: 'OSTC/OHOS/manifest'
   file:
    # Include the set of build flavours.
    - '.ostc-ci/build-generic.yaml'
    # Include the set of build flavours.
    - '.ostc-ci/build-flavours.yaml'
    # Include the set of templates and jobs that use develop.xml.
    - '.ostc-ci/develop-targets.yaml'

reuse:
  extends: .reuse
  # FIXME: https://git.ostc-eu.org/OSTC/OHOS/meta-ohos/-/issues/19
  allow_failure: true

# Customize the generic .build job, included from build-generic.yaml above,
# with an unique set of rules that enable the job and an override for the
# OHOS_MANIFEST_BRANCH variable.
.build:
  variables:
    # The path of the git repository to deviate from what the git-repo manifest
    # prepares. This effectively allows testing incoming changes that match the
    # repository holding this CI pipeline.
    #
    # The path is relative to the checked out "sources/" directory.
    OHOS_GIT_REPO_PATH: "meta-ohos"
  before_script:
    # XXX: This test is repeated from build-generic.yaml .build before_script,
    # de-duplicate that by moving this logic back to the generic script.
    - test -n "$OHOS_RECIPE_NAME" || (
        echo "precondition failed - set OHOS_RECIPE_NAME to the name of the recipe to build"
        && exit 1 )
    # Check if the job is configured properly.
    - test -n "$OHOS_GIT_REPO_PATH" || (
        echo "precondition failed - set OHOS_GIT_REPO_PATH to the path of the git repository as described by the manifest"
        && exit 1 )
    - !reference [.workspace, before_script]
    # Switch the git repository which is being tested to the revision described
    # by the CI environment variables. This effectively performs the update
    # corresponding to the layer landing in either stable manifest or the
    # development manifest.
    - ( cd "$SCRATCH_DIR"/sources/"$OHOS_GIT_REPO_PATH" && git checkout "$CI_COMMIT_SHA" )
  artifacts:
    # Disable collection of image artifacts. They are not used here and they
    # are expensive to upload and store.
    paths: []