# include the common jobs defined for android pipeline setup
include:
  - 'https://gitlab.com/Linaro/lkft/users/yongqin.liu/lkft-common/-/raw/development/gitlab-ci-common-for-android.yml'
  - 'https://gitlab.com/Linaro/lkft/users/yongqin.liu/lkft-common/-/raw/development/gitlab-ci-jobs/gitlab-ci-android-common-jobs-triggers.yml'

variables:
  BUILD_TYPE: "tuxsuite-bake"
  URL_LKFT_COMMON_RAW: "https://gitlab.com/Linaro/lkft/users/yongqin.liu/lkft-common/-/raw/development/"
  RUN_TEST: "1"

workflow:
  rules:
    - if: $CI_PIPELINE_SOURCE == "web"
    - if: $CI_PIPELINE_SOURCE == "schedule"
    - if: $CI_PIPELINE_SOURCE == "parent_pipeline"
    - when: never

create_squad_projects_and_builds_mainline:
  rules:
    - when: never
build_android_mainline_db845c:
  rules:
    - when: never
trigger-android-mainline-pipeline:
  rules:
    - when: never
trigger-android-mainline-pipeline-private:
  rules:
    - when: never

###########################################################
#### define jobs for the android-mainline branch ##########
###########################################################
create_squad_projects_and_builds_mainline_test:
  extends:
    - .create_squad_projects_and_builds
  variables:
    ANDROID_BUILD_CONFIGS: "lkft-db845c-aosp-master-mainline-gki-for-test"
  rules:
    - if: '$CI_COMMIT_BRANCH == "android-mainline"'
    - when: never
  needs:
    - new_changes_notification

build_android_mainline_db845c_test:
  extends:
    - .build_android_with_tuxsuite_bake
  allow_failure: true
  variables:
    LKFT_ANDROID_BUILD_CONFIG: lkft-db845c-aosp-master-mainline-gki-for-test
  rules:
    - if: '$CI_COMMIT_BRANCH == "android-mainline"'
    - when: never
  needs:
    - new_changes_notification

submit-test-for-mainline-db845c-test:
  extends:
    - .submit-test-for-android
  variables:
    BUILD_TYPE: "tuxsuite-bake"
    lkft_build_config: lkft-db845c-aosp-master-mainline-gki-for-test
    SQUAD_PROJECT_CALLBACKS: "~yongqin.liu/mainline-gki-aosp-master-db845c=callback-for-squad-lkft-db845c-aosp-master-mainline-gki-test"
  rules:
    - if: '$CI_COMMIT_BRANCH == "android-mainline"'
    - when: never
  needs:
    - build_android_mainline_db845c_test

callback-for-squad-lkft-db845c-aosp-master-mainline-gki-test:
  extends:
    - .callback-for-squad
  rules:
    - if: '$CI_COMMIT_BRANCH == "android-mainline"'
      when: manual
    - when: never
  needs:
    - submit-test-for-mainline-db845c-test

report-for-android-mainline-test:
  extends:
    - .report_with_squad_report
  variables:
    kernel_branch: android-mainline-test
    REVIEW_TO_NAME: REVIEW_TO
  rules:
    - if: '$CI_COMMIT_BRANCH == "android-mainline"'
    - when: never
  needs:
    - callback-for-squad-lkft-db845c-aosp-master-mainline-gki-test

###########################################################
######## end for the android-mainline branch ##############
###########################################################
### common jobs not have branch check set will run for all branches ######
# This will only build and test branches specified here.
workflow:
  rules:
    - if: '$CI_COMMIT_BRANCH == "android-mainline"'
      when: always
    - when: never

### common jobs not have branch check set will run for all branches ######
