stages:
  - pre_check
  - build
  - target_test
  - build_docs
  - deploy
  - post_deploy

workflow:
  rules:
    # Disable those non-protected push triggered pipelines
    - if: '$CI_COMMIT_REF_NAME != "master" && $CI_COMMIT_BRANCH !~ /^release\/v/ && $CI_COMMIT_TAG !~ /^v\d+\.\d+(\.\d+)?($|-)/ && $CI_PIPELINE_SOURCE == "push"'
      when: never
    # when running merged result pipelines, it would create a temp commit id. use $CI_MERGE_REQUEST_SOURCE_BRANCH_SHA instead of $CI_COMMIT_SHA.
    # Please use PIPELINE_COMMIT_SHA at all places that require a commit sha
    - if: $CI_OPEN_MERGE_REQUESTS != null
      variables:
        PIPELINE_COMMIT_SHA: $CI_MERGE_REQUEST_SOURCE_BRANCH_SHA
    - if: $CI_OPEN_MERGE_REQUESTS == null
      variables:
        PIPELINE_COMMIT_SHA: $CI_COMMIT_SHA
    - when: always

variables:
  IOT_SOLUTION_PATH: "$CI_PROJECT_DIR"

include:
  - '.gitlab/ci/danger.yml'
  - '.gitlab/ci/rules.yml'
  - '.gitlab/ci/pre_check.yml'
  - '.gitlab/ci/build.yml'
  - '.gitlab/ci/docs.yml'
  - '.gitlab/ci/deploy.yml'
  - '.gitlab/ci/target_test.yml'
