1stages:
2  - pre_check
3  - build
4  - assign_test
5  - host_test
6  - target_test
7  - test_deploy
8  - post_check
9  - deploy
10  - post_deploy
11
12# pipelines will not be created in such two cases:
13# 1. MR push
14# 2. push not on "master/release" branches, and not tagged
15# This behavior could be changed after the `rules: changes` feature is implemented
16workflow:
17  rules:
18    - if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
19      when: never
20    - if: '$CI_COMMIT_REF_NAME != "master" && $CI_COMMIT_BRANCH !~ /^release\/v/ && $CI_COMMIT_TAG !~ /^v\d+\.\d+(\.\d+)?($|-)/ && $CI_PIPELINE_SOURCE == "push"'
21      when: never
22    - when: always
23
24variables:
25# System environment
26
27  # Common parameters for the 'make' during CI tests
28  MAKEFLAGS: "-j5 --no-keep-going"
29
30# GitLab-CI environment
31
32  # XXX_ATTEMPTS variables (https://docs.gitlab.com/ce/ci/yaml/README.html#job-stages-attempts) are not defined here.
33  # Use values from  "CI / CD Settings" - "Variables".
34
35  # GIT_STRATEGY is not defined here.
36  # Use an option from  "CI / CD Settings" - "General pipelines".
37
38  # we will download archive for each submodule instead of clone.
39  # we don't do "recursive" when fetch submodule as they're not used in CI now.
40  GIT_SUBMODULE_STRATEGY: none
41  SUBMODULE_FETCH_TOOL: "tools/ci/ci_fetch_submodule.py"
42  # by default we will fetch all submodules
43  # jobs can overwrite this variable to only fetch submodules they required
44  # set to "none" if don't need to fetch submodules
45  SUBMODULES_TO_FETCH: "all"
46  # tell build system do not check submodule update as we download archive instead of clone
47  IDF_SKIP_CHECK_SUBMODULES: 1
48
49  IDF_PATH: "$CI_PROJECT_DIR"
50  BATCH_BUILD: "1"
51  V: "0"
52  CHECKOUT_REF_SCRIPT: "$CI_PROJECT_DIR/tools/ci/checkout_project_ref.py"
53
54  # Docker images
55  BOT_DOCKER_IMAGE_TAG: ":latest"
56
57  # target test config file, used by assign test job
58  CI_TARGET_TEST_CONFIG_FILE: "$CI_PROJECT_DIR/tools/ci/config/target-test.yml"
59
60  # target test repo parameters
61  TEST_ENV_CONFIG_REPO: "https://gitlab-ci-token:${BOT_TOKEN}@${CI_SERVER_HOST}:${CI_SERVER_PORT}/qa/ci-test-runner-configs.git"
62  CI_AUTO_TEST_SCRIPT_REPO_URL: "https://gitlab-ci-token:${BOT_TOKEN}@${CI_SERVER_HOST}:${CI_SERVER_PORT}/qa/auto_test_script.git"
63  CI_AUTO_TEST_SCRIPT_REPO_BRANCH: "ci/v3.1"
64
65  # Versioned esp-idf-doc env image to use for all document building jobs
66  ESP_IDF_DOC_ENV_IMAGE: "$CI_DOCKER_REGISTRY/esp-idf-doc-env:v8"
67
68.setup_tools_unless_target_test: &setup_tools_unless_target_test |
69  if [[ -n "$IDF_DONT_USE_MIRRORS" ]]; then
70  export IDF_MIRROR_PREFIX_MAP=
71  fi
72  if [[ "$SETUP_TOOLS" == "1" || "$CI_JOB_STAGE" != "target_test" ]]; then
73  tools/idf_tools.py --non-interactive install && eval "$(tools/idf_tools.py --non-interactive export)" || exit 1
74  fi
75
76before_script:
77  - source tools/ci/utils.sh
78  - source tools/ci/setup_python.sh
79  - apply_bot_filter
80  - add_gitlab_ssh_keys
81  - source tools/ci/configure_ci_environment.sh
82  - *setup_tools_unless_target_test
83  - fetch_submodules
84
85# used for check scripts which we want to run unconditionally
86.before_script_lesser_nofilter:
87  before_script:
88    - echo "Not setting up GitLab key, not fetching submodules, not applying bot filter"
89    - source tools/ci/utils.sh
90    - source tools/ci/setup_python.sh
91    - source tools/ci/configure_ci_environment.sh
92
93# used for everything else where we want to do no prep, except for bot filter
94.before_script_lesser:
95  before_script:
96    - echo "Not setting up GitLab key, not fetching submodules"
97    - source tools/ci/utils.sh
98    - source tools/ci/setup_python.sh
99    - apply_bot_filter
100    - source tools/ci/configure_ci_environment.sh
101
102.before_script_slim:
103  before_script:
104    - echo "Only load utils.sh inside"
105    - source tools/ci/utils.sh
106
107.before_script_macos:
108  before_script:
109    - source tools/ci/utils.sh
110    - apply_bot_filter
111    - $IDF_PATH/tools/idf_tools.py install-python-env
112    # On macOS, these tools need to be installed
113    - $IDF_PATH/tools/idf_tools.py --non-interactive install cmake ninja
114    # This adds tools (compilers) and the version-specific Python environment to PATH
115    - *setup_tools_unless_target_test
116    # Install packages required by CI scripts into IDF Python environment
117    - pip install -r $IDF_PATH/tools/ci/python_packages/ttfw_idf/requirements.txt
118    - source tools/ci/configure_ci_environment.sh
119    # Part of tools/ci/setup_python.sh; we don't use pyenv on macOS, so can't run the rest of the script.
120    - export PYTHONPATH="$IDF_PATH/tools:$IDF_PATH/tools/ci/python_packages:$PYTHONPATH"
121    - fetch_submodules
122
123include:
124  - '/tools/ci/config/rules.yml'
125  - '/tools/ci/config/pre_check.yml'
126  - '/tools/ci/config/build.yml'
127  - '/tools/ci/config/assign-test.yml'
128  - '/tools/ci/config/host-test.yml'
129  - '/tools/ci/config/target-test.yml'
130  - '/tools/ci/config/post_check.yml'
131  - '/tools/ci/config/deploy.yml'
132  - '/tools/ci/config/post_deploy.yml'
133