]> granicus.if.org Git - esp-idf/blob - .gitlab-ci.yml
Merge branch 'bugfix/ws_opcodes_fix' into 'master'
[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: make
30 # IDF environment
31
32   IDF_PATH: "$CI_PROJECT_DIR"
33   BATCH_BUILD: "1"
34   V: "0"
35   APPLY_BOT_FILTER_SCRIPT: "$CI_PROJECT_DIR/tools/ci/apply_bot_filter.py"
36   CHECKOUT_REF_SCRIPT: "$CI_PROJECT_DIR/tools/ci/checkout_project_ref.py"
37   CUSTOM_TOOLCHAIN_PATH: "/opt/xtensa-custom"
38
39 # Docker images
40   BOT_DOCKER_IMAGE_TAG: ":latest"
41 # target test config file, used by assign test job
42   CI_TARGET_TEST_CONFIG_FILE: "$CI_PROJECT_DIR/tools/ci/config/target-test.yml"
43
44
45 # before each job, we need to check if this job is filtered by bot stage/job filter
46 .apply_bot_filter: &apply_bot_filter
47   python $APPLY_BOT_FILTER_SCRIPT || exit 0
48
49 .setup_custom_toolchain: &setup_custom_toolchain |
50   if [ "$IDF_XTENSA_TOOLCHAIN_URL" ] ; then
51   echo "Use a custom toolchain: ${IDF_XTENSA_TOOLCHAIN_URL:-Unknown}"
52   rm -rf "$CUSTOM_TOOLCHAIN_PATH" &&
53   mkdir -p -v "$CUSTOM_TOOLCHAIN_PATH" &&
54   pushd "$CUSTOM_TOOLCHAIN_PATH" &&
55   curl -sSL -o xtensa-custom.xxx "$IDF_XTENSA_TOOLCHAIN_URL" &&
56   ls -l xtensa-custom.xxx &&
57   tar xf xtensa-custom.xxx --strip-components 1 &&
58   ls -l . &&
59   popd
60   PATH=$CUSTOM_TOOLCHAIN_PATH/bin:$PATH
61   export PATH
62   fi
63
64 .cleanup_custom_toolchain: &cleanup_custom_toolchain |
65   echo "Cleaning up $CUSTOM_TOOLCHAIN_PATH"
66   rm -rf "$CUSTOM_TOOLCHAIN_PATH"
67
68 .setup_tools_unless_target_test: &setup_tools_unless_target_test |
69   if [[ "$SETUP_TOOLS" == "1" || "$CI_JOB_STAGE" != "target_test" ]]; then
70   tools/idf_tools.py --non-interactive install && eval "$(tools/idf_tools.py --non-interactive export)" || exit 1
71   fi
72
73 .show_submodule_urls: &show_submodule_urls |
74   git config --get-regexp '^submodule\..*\.url$' || true
75
76 before_script:
77   - echo "Running common script"
78   - *show_submodule_urls
79   - source tools/ci/setup_python.sh
80   # apply bot filter in before script
81   - *apply_bot_filter
82   # add gitlab ssh key
83   - mkdir -p ~/.ssh
84   - chmod 700 ~/.ssh
85   - echo -n $GITLAB_KEY > ~/.ssh/id_rsa_base64
86   - base64 --decode --ignore-garbage ~/.ssh/id_rsa_base64 > ~/.ssh/id_rsa
87   - chmod 600 ~/.ssh/id_rsa
88   - echo -e "Host gitlab.espressif.cn\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
89   # Set some options and environment for CI
90   - source tools/ci/configure_ci_environment.sh
91
92   - *setup_tools_unless_target_test
93
94   - *setup_custom_toolchain
95
96 # used for check scripts which we want to run unconditionally
97 .before_script_lesser_nofilter:
98   variables:
99     GIT_SUBMODULE_STRATEGY: none
100   before_script:
101     - echo "Not setting up GitLab key, not fetching submodules, not applying bot filter"
102     - source tools/ci/setup_python.sh
103     - source tools/ci/configure_ci_environment.sh
104     - *setup_custom_toolchain
105
106 # used for everything else where we want to do no prep, except for bot filter
107 .before_script_lesser:
108   variables:
109     GIT_SUBMODULE_STRATEGY: none
110   before_script:
111     - echo "Not setting up GitLab key, not fetching submodules"
112     - source tools/ci/setup_python.sh
113     # apply bot filter in before script
114     - *apply_bot_filter
115     - source tools/ci/configure_ci_environment.sh
116     - *setup_custom_toolchain
117
118 after_script:
119   - *cleanup_custom_toolchain
120
121 .check_job_template:
122   stage: check
123   image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
124   tags:
125     - host_test
126   dependencies: []
127   extends: .before_script_lesser_nofilter
128
129 .check_job_template_with_filter:
130   stage: check
131   image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
132   tags:
133     - host_test
134   dependencies: []
135   extends: .before_script_lesser_nofilter
136
137 include:
138   - '/tools/ci/config/build.yml'
139   - '/tools/ci/config/assign-test.yml'
140   - '/tools/ci/config/host-test.yml'
141   - '/tools/ci/config/target-test.yml'
142   - '/tools/ci/config/check.yml'
143   - '/tools/ci/config/deploy.yml'