diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 3cc1248180a2e88f906a26f360fb91cdc5beef42..17b127c62b4e4bec6c137636507572ac7b17065f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -12,6 +12,8 @@ include: file: - 'dco.yaml' - 'reuse.yaml' + - project: 'OSTC/OHOS/manifest' + file: '.ostc-ci/build-generic.yaml' dco: extends: .dco @@ -24,52 +26,36 @@ reuse: rules: - if: '$CI_PIPELINE_SOURCE == "merge_request_event"' -.doc-workspace: - image: - name: registry.ostc-eu.org/ostc/containers/ostc-docs-builder - tags: [large-disk] +# Customize the .workspace job to set 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. +.workspace: variables: - OHOS_MANIFEST_URL: https://git.ostc-eu.org/OSTC/OHOS/manifest - OHOS_MANIFEST_BRANCH: develop - OHOS_MANIFEST_NAME: default.xml OHOS_GIT_REPO_PATH: docs - before_script: &doc-workspace-before - - test ! -e "$CI_PROJECT_DIR"/.scratch-dir-name || ( - echo "precondition failed - concurrent modification of $CI_PROJECT_DIR" - && env | grep CI_ | sort - && ls -l - && exit 1 ) - - SCRATCH_DIR="$(mktemp -p /tmp -d workspace.XXXXXXXXXX)" - - echo "$SCRATCH_DIR" > "$CI_PROJECT_DIR"/.scratch-dir-name - - cd "$SCRATCH_DIR" - - repo init --reference - /var/shared/pub/git-repo-mirrors/ostc-develop - --manifest-url "$OHOS_MANIFEST_URL" - --manifest-name "$OHOS_MANIFEST_NAME" - --manifest-branch "$OHOS_MANIFEST_BRANCH" - - time repo sync --no-clone-bundle - - ( cd "$SCRATCH_DIR"/"$OHOS_GIT_REPO_PATH" && git checkout "$CI_COMMIT_SHA" ) - script: &doc-workspace-do - - SCRATCH_DIR="$(cat "$CI_PROJECT_DIR"/.scratch-dir-name)" - - cd "$SCRATCH_DIR"/docs -build: - extends: .doc-workspace - stage: build - script: - - *doc-workspace-do - - make BUILD_DIR="$CI_PROJECT_DIR/build" - artifacts: - paths: - - build +# Disable all the bitbake jobs, since we are not building any code here. +.bitbake-workspace: rules: - - if: '$CI_PIPELINE_SOURCE == "merge_request_event"' + - when: never + +# Define a build-docs job that extends both the .workspace, for the general +# workspace setup, and .build-docs, for the documentation build logic. The +# script first assembles the workspace and then proceeds to build the +# documentation. +# +# The job extends more than one parent, with the order being relevant for, +# among others, the "rules" section. +build-docs: + extends: [.workspace, .build-docs] + script: + - !reference [.workspace, script] + - !reference [.build-docs, script] deploy: - extends: .doc-workspace + extends: .workspace stage: deploy script: - - *doc-workspace-do + - !reference [.workspace, script] - git clone https://user:$OHOS_AGGREGATED_DOCS_TOKEN@git.ostc-eu.org/OSTC/infrastructure/openharmony-readthedocs-aggregated.git - cd openharmony-readthedocs-aggregated - git checkout origin/main # only main for now - needs to match the rules