pre_check.yml 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. .pre_check_template:
  2. stage: pre_check
  3. image: $ESP_ENV_IMAGE
  4. tags:
  5. - host_test
  6. dependencies: []
  7. check_pre_commit:
  8. extends:
  9. - .pre_check_template
  10. - .before_script:minimal
  11. image: $PRE_COMMIT_IMAGE
  12. needs:
  13. - pipeline_variables
  14. script:
  15. - fetch_submodules
  16. - pre-commit run --files $MODIFIED_FILES
  17. check_MR_style_dangerjs:
  18. extends:
  19. - .pre_check_template
  20. image: node:18.15.0-alpine3.16
  21. variables:
  22. DANGER_GITLAB_API_TOKEN: ${ESPCI_TOKEN}
  23. DANGER_GITLAB_HOST: ${GITLAB_HTTP_SERVER}
  24. DANGER_GITLAB_API_BASE_URL: ${GITLAB_HTTP_SERVER}/api/v4
  25. DANGER_JIRA_USER: ${DANGER_JIRA_USER}
  26. DANGER_JIRA_PASSWORD: ${DANGER_JIRA_PASSWORD}
  27. cache:
  28. # pull only for most of the use cases since it's cache dir.
  29. # Only set "push" policy for "upload_cache" stage jobs
  30. key:
  31. files:
  32. - .gitlab/dangerjs/package-lock.json
  33. paths:
  34. - .gitlab/dangerjs/node_modules/
  35. policy: pull
  36. before_script:
  37. - cd .gitlab/dangerjs
  38. - npm install --no-progress --no-update-notifier # Install danger dependencies
  39. script:
  40. - npx danger ci --failOnErrors -v
  41. rules:
  42. - if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
  43. check_version:
  44. # Don't run this for feature/bugfix branches, so that it is possible to modify
  45. # esp_idf_version.h in a branch before tagging the next version.
  46. extends:
  47. - .pre_check_template
  48. - .rules:protected
  49. - .before_script:fetch:git_describe
  50. script:
  51. - export IDF_PATH=$PWD
  52. - tools/ci/check_idf_version.sh
  53. check_api_usage:
  54. extends: .pre_check_template
  55. script:
  56. - tools/ci/check_examples_rom_header.sh
  57. - tools/ci/check_api_violation.sh
  58. - tools/ci/check_examples_extra_component_dirs.sh
  59. check_blobs:
  60. extends:
  61. - .pre_check_template
  62. - .rules:build:check
  63. variables:
  64. SUBMODULES_TO_FETCH: "components/esp_wifi/lib;components/esp_phy/lib;components/esp_coex/lib"
  65. script:
  66. # Check if Wi-Fi library header files match between IDF and the version used when compiling the libraries
  67. - IDF_TARGET=esp32 $IDF_PATH/components/esp_wifi/test_md5/test_md5.sh
  68. - IDF_TARGET=esp32s2 $IDF_PATH/components/esp_wifi/test_md5/test_md5.sh
  69. - IDF_TARGET=esp32s3 $IDF_PATH/components/esp_wifi/test_md5/test_md5.sh
  70. - IDF_TARGET=esp32c2 $IDF_PATH/components/esp_wifi/test_md5/test_md5.sh
  71. - IDF_TARGET=esp32c3 $IDF_PATH/components/esp_wifi/test_md5/test_md5.sh
  72. - IDF_TARGET=esp32c6 $IDF_PATH/components/esp_wifi/test_md5/test_md5.sh
  73. # Check if Coexistence library header files match between IDF and the version used when compiling the libraries
  74. - IDF_TARGET=esp32 $IDF_PATH/components/esp_coex/test_md5/test_md5.sh
  75. - IDF_TARGET=esp32s2 $IDF_PATH/components/esp_coex/test_md5/test_md5.sh
  76. - IDF_TARGET=esp32s3 $IDF_PATH/components/esp_coex/test_md5/test_md5.sh
  77. - IDF_TARGET=esp32c2 $IDF_PATH/components/esp_coex/test_md5/test_md5.sh
  78. - IDF_TARGET=esp32c3 $IDF_PATH/components/esp_coex/test_md5/test_md5.sh
  79. - IDF_TARGET=esp32c6 $IDF_PATH/components/esp_coex/test_md5/test_md5.sh
  80. - IDF_TARGET=esp32h2 $IDF_PATH/components/esp_coex/test_md5/test_md5.sh
  81. # Check if Wi-Fi, PHY, BT blobs contain references to specific symbols
  82. - bash $IDF_PATH/tools/ci/check_blobs.sh
  83. check_public_headers:
  84. extends:
  85. - .pre_check_template
  86. - .rules:build:check
  87. script:
  88. - IDF_TARGET=esp32 python tools/ci/check_public_headers.py --jobs 4 --prefix xtensa-esp32-elf-
  89. - IDF_TARGET=esp32s2 python tools/ci/check_public_headers.py --jobs 4 --prefix xtensa-esp32s2-elf-
  90. - IDF_TARGET=esp32s3 python tools/ci/check_public_headers.py --jobs 4 --prefix xtensa-esp32s3-elf-
  91. - IDF_TARGET=esp32c3 python tools/ci/check_public_headers.py --jobs 4 --prefix riscv32-esp-elf-
  92. - IDF_TARGET=esp32c2 python tools/ci/check_public_headers.py --jobs 4 --prefix riscv32-esp-elf-
  93. - IDF_TARGET=esp32c6 python tools/ci/check_public_headers.py --jobs 4 --prefix riscv32-esp-elf-
  94. - IDF_TARGET=esp32h2 python tools/ci/check_public_headers.py --jobs 4 --prefix riscv32-esp-elf-
  95. - IDF_TARGET=esp32p4 python tools/ci/check_public_headers.py --jobs 4 --prefix riscv32-esp-elf-
  96. check_chip_support_components:
  97. extends:
  98. - .pre_check_template
  99. - .rules:build:check
  100. artifacts:
  101. when: on_failure
  102. paths:
  103. - esp_hw_support_part.h
  104. - bootloader_support_part.h
  105. expire_in: 1 week
  106. script:
  107. - python tools/ci/check_soc_headers_leak.py
  108. - find ${IDF_PATH}/components/soc/*/include/soc/ -name "*_struct.h" -print0 | xargs -0 -n1 ./tools/ci/check_soc_struct_headers.py
  109. - tools/ci/check_esp_memory_utils_headers.sh
  110. check_esp_err_to_name:
  111. extends:
  112. - .pre_check_template
  113. - .rules:build:check
  114. artifacts:
  115. when: on_failure
  116. paths:
  117. - components/esp_common/esp_err_to_name.c
  118. expire_in: 1 week
  119. script:
  120. - cd ${IDF_PATH}/tools/
  121. - ./gen_esp_err_to_name.py
  122. - git diff --exit-code -- ../components/esp_common/src/esp_err_to_name.c || { echo 'Differences found. Please run gen_esp_err_to_name.py and commit the changes.'; exit 1; }
  123. check_esp_system:
  124. extends:
  125. - .pre_check_template
  126. - .rules:build
  127. script:
  128. - python components/esp_system/check_system_init_priorities.py
  129. # For release tag pipelines only, make sure the tag was created with 'git tag -a' so it will update
  130. # the version returned by 'git describe'
  131. # Don't forget to update the env var `LATEST_GIT_TAG` in .gitlab/ci/common.yml
  132. check_version_tag:
  133. extends:
  134. - .pre_check_template
  135. - .rules:tag:release
  136. - .before_script:fetch:git_describe
  137. script:
  138. - (git cat-file -t $CI_COMMIT_REF_NAME | grep tag) || (echo "ESP-IDF versions must be annotated tags." && exit 1)
  139. check_artifacts_expire_time:
  140. extends: .pre_check_template
  141. script:
  142. # check if we have set expire time for all artifacts
  143. - python tools/ci/check_artifacts_expire_time.py
  144. check_test_scripts_build_test_rules:
  145. extends:
  146. - .pre_check_template
  147. - .before_script:build
  148. script:
  149. # required pytest related packages
  150. - run_cmd bash install.sh --enable-pytest
  151. - python tools/ci/check_build_test_rules.py check-test-scripts examples/ tools/test_apps components
  152. check_configure_ci_environment_parsing:
  153. extends:
  154. - .pre_check_template
  155. - .before_script:build
  156. - .rules:build
  157. script:
  158. - cd tools/ci
  159. - python -m unittest ci_build_apps.py
  160. pipeline_variables:
  161. extends:
  162. - .pre_check_template
  163. - .before_script:fetch:git_diff
  164. tags:
  165. - build
  166. script:
  167. - MODIFIED_FILES=$(echo $GIT_DIFF_OUTPUT | xargs)
  168. - echo "MODIFIED_FILES=$MODIFIED_FILES" >> pipeline.env
  169. - echo "MODIFIED_COMPONENTS=$(run_cmd python tools/ci/ci_get_mr_info.py components --modified-files $MODIFIED_FILES | xargs)" >> pipeline.env
  170. - |
  171. if echo "$CI_MERGE_REQUEST_LABELS" | egrep "(^|,)BUILD_AND_TEST_ALL_APPS(,|$)"; then
  172. echo "BUILD_AND_TEST_ALL_APPS=1" >> pipeline.env
  173. fi
  174. - cat pipeline.env
  175. artifacts:
  176. reports:
  177. dotenv: pipeline.env
  178. expire_in: 4 days