]> granicus.if.org Git - esp-idf/blob - .gitlab-ci.yml
Merge branch 'feature/esp32s2beta_merge_fix_bootloader_ld' into 'feature/esp32s2beta'
[esp-idf] / .gitlab-ci.yml
1 stages:
2   - build
3   - assign_test
4   - host_test
5   - target_test
6   - check
7   - deploy
8   - post_check
9
10 variables:
11 # System environment
12
13   # Common parameters for the 'make' during CI tests
14   MAKEFLAGS: "-j5 --no-keep-going"
15
16 # GitLab-CI environment
17
18   # more attempts for more robust
19   GET_SOURCES_ATTEMPTS: "10"
20   ARTIFACT_DOWNLOAD_ATTEMPTS: "10"
21
22   # GIT_STRATEGY is not defined here.
23   # Use an option from  "CI / CD Settings" - "General pipelines".
24
25   # "normal" strategy for fetching only top-level submodules since nothing requires the sub-submodules code for building IDF.
26   # If the "recursive" strategy is used we have a problem with using relative URLs for sub-submodules.
27   GIT_SUBMODULE_STRATEGY: normal
28
29   UNIT_TEST_BUILD_SYSTEM: cmake
30   EXAMPLE_TEST_BUILD_SYSTEM: cmake
31 # IDF environment
32
33   IDF_PATH: "$CI_PROJECT_DIR"
34   BATCH_BUILD: "1"
35   V: "0"
36   APPLY_BOT_FILTER_SCRIPT: "$CI_PROJECT_DIR/tools/ci/apply_bot_filter.py"
37   CHECKOUT_REF_SCRIPT: "$CI_PROJECT_DIR/tools/ci/checkout_project_ref.py"
38   CUSTOM_TOOLCHAIN_PATH: "/opt/xtensa-custom"
39
40 # Docker images
41   BOT_DOCKER_IMAGE_TAG: ":latest"
42 # target test config file, used by assign test job
43   CI_TARGET_TEST_CONFIG_FILE: "$CI_PROJECT_DIR/tools/ci/config/target-test.yml"
44
45
46 # before each job, we need to check if this job is filtered by bot stage/job filter
47 .apply_bot_filter: &apply_bot_filter
48   python $APPLY_BOT_FILTER_SCRIPT || exit 0
49
50 .setup_custom_toolchain: &setup_custom_toolchain |
51   if [ "$IDF_XTENSA_TOOLCHAIN_URL" ] ; then
52   echo "Use a custom toolchain: ${IDF_XTENSA_TOOLCHAIN_URL:-Unknown}"
53   rm -rf "$CUSTOM_TOOLCHAIN_PATH" &&
54   mkdir -p -v "$CUSTOM_TOOLCHAIN_PATH" &&
55   pushd "$CUSTOM_TOOLCHAIN_PATH" &&
56   curl -sSL -o xtensa-custom.xxx "$IDF_XTENSA_TOOLCHAIN_URL" &&
57   ls -l xtensa-custom.xxx &&
58   tar xf xtensa-custom.xxx --strip-components 1 &&
59   ls -l . &&
60   popd
61   PATH=$CUSTOM_TOOLCHAIN_PATH/bin:$PATH
62   export PATH
63   fi
64
65 .cleanup_custom_toolchain: &cleanup_custom_toolchain |
66   echo "Cleaning up $CUSTOM_TOOLCHAIN_PATH"
67   rm -rf "$CUSTOM_TOOLCHAIN_PATH"
68
69 .setup_tools_unless_target_test: &setup_tools_unless_target_test |
70   if [ "$CI_JOB_STAGE" != "target_test" ]; then
71   tools/idf_tools.py --non-interactive install && eval "$(tools/idf_tools.py --non-interactive export)" || exit 1
72   fi
73
74 .show_submodule_urls: &show_submodule_urls |
75   git config --get-regexp '^submodule\..*\.url$' || true
76
77 before_script:
78   - echo "Running common script"
79   - *show_submodule_urls
80   - source tools/ci/setup_python.sh
81   # apply bot filter in before script
82   - *apply_bot_filter
83   # add gitlab ssh key
84   - mkdir -p ~/.ssh
85   - chmod 700 ~/.ssh
86   - echo -n $GITLAB_KEY > ~/.ssh/id_rsa_base64
87   - base64 --decode --ignore-garbage ~/.ssh/id_rsa_base64 > ~/.ssh/id_rsa
88   - chmod 600 ~/.ssh/id_rsa
89   - echo -e "Host gitlab.espressif.cn\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
90   # Set some options and environment for CI
91   - source tools/ci/configure_ci_environment.sh
92
93   - *setup_tools_unless_target_test
94
95   - *setup_custom_toolchain
96
97 # used for check scripts which we want to run unconditionally
98 .before_script_lesser_nofilter:
99   variables:
100     GIT_SUBMODULE_STRATEGY: none
101   before_script:
102     - echo "Not setting up GitLab key, not fetching submodules, not applying bot filter"
103     - source tools/ci/setup_python.sh
104     - source tools/ci/configure_ci_environment.sh
105     - *setup_custom_toolchain
106
107 # used for everything else where we want to do no prep, except for bot filter
108 .before_script_lesser:
109   variables:
110     GIT_SUBMODULE_STRATEGY: none
111   before_script:
112     - echo "Not setting up GitLab key, not fetching submodules"
113     - source tools/ci/setup_python.sh
114     # apply bot filter in before script
115     - *apply_bot_filter
116     - source tools/ci/configure_ci_environment.sh
117     - *setup_custom_toolchain
118
119 after_script:
120   - *cleanup_custom_toolchain
121
122 .check_job_template:
123   stage: check
124   image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
125   tags:
126     - host_test
127   dependencies: []
128   extends: .before_script_lesser_nofilter
129
130 .check_job_template_with_filter:
131   stage: check
132   image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
133   tags:
134     - host_test
135   dependencies: []
136   extends: .before_script_lesser_nofilter
137
138 include:
139   - '/tools/ci/config/build.yml'
140   - '/tools/ci/config/assign-test.yml'
141   - '/tools/ci/config/host-test.yml'
142   - '/tools/ci/config/target-test.yml'
143   - '/tools/ci/config/check.yml'
144   - '/tools/ci/config/deploy.yml'