docs.yml 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  1. .patterns-docs: &patterns-docs
  2. - ".gitlab/ci/docs.yml"
  3. - "docs/**/*"
  4. - "components/**/*.h"
  5. - "components/**/Kconfig*"
  6. - "components/**/CMakeList.txt"
  7. - "components/**/sdkconfig*"
  8. - "tools/kconfig_new/**/*"
  9. - "CONTRIBUTING.rst"
  10. .if-protected: &if-protected
  11. if: '($CI_COMMIT_REF_NAME == "master" || $CI_COMMIT_BRANCH =~ /^release\/v/ || $CI_COMMIT_TAG =~ /^v\d+\.\d+(\.\d+)?($|-)/)'
  12. .if-protected-no_label: &if-protected-no_label
  13. if: '($CI_COMMIT_REF_NAME == "master" || $CI_COMMIT_BRANCH =~ /^release\/v/ || $CI_COMMIT_TAG =~ /^v\d+\.\d+(\.\d+)?($|-)/) && $BOT_TRIGGER_WITH_LABEL == null'
  14. .if-label-build_docs: &if-label-build_docs
  15. if: '$BOT_LABEL_BUILD_DOCS || $CI_MERGE_REQUEST_LABELS =~ /^(?:[^,\n\r]+,)*build_docs(?:,[^,\n\r]+)*$/i'
  16. .if-label-docs: &if-label-docs
  17. if: '$BOT_LABEL_DOCS || $CI_MERGE_REQUEST_LABELS =~ /^(?:[^,\n\r]+,)*docs(?:,[^,\n\r]+)*$/i'
  18. .if-label-docs_full: &if-label-docs_full
  19. if: '$BOT_LABEL_DOCS_FULL || $CI_MERGE_REQUEST_LABELS =~ /^(?:[^,\n\r]+,)*docs_full(?:,[^,\n\r]+)*$/i'
  20. .if-dev-push: &if-dev-push
  21. if: '$CI_COMMIT_REF_NAME != "master" && $CI_COMMIT_BRANCH !~ /^release\/v/ && $CI_COMMIT_TAG !~ /^v\d+\.\d+(\.\d+)?($|-)/ && ($CI_PIPELINE_SOURCE == "push" || $CI_PIPELINE_SOURCE == "merge_request_event")'
  22. .doc-rules:build:docs:
  23. rules:
  24. - <<: *if-protected
  25. - <<: *if-label-build_docs
  26. - <<: *if-label-docs
  27. - <<: *if-label-docs_full
  28. - <<: *if-dev-push
  29. changes: *patterns-docs
  30. # stage: pre_check
  31. check_readme_links:
  32. extends:
  33. - .pre_check_job_template
  34. - .doc-rules:build:docs
  35. tags: ["build", "amd64", "internet"]
  36. allow_failure: true
  37. script:
  38. - python ${IDF_PATH}/tools/ci/check_readme_links.py
  39. check_docs_lang_sync:
  40. extends:
  41. - .pre_check_job_template
  42. - .doc-rules:build:docs
  43. script:
  44. - cd docs
  45. - ./check_lang_folder_sync.sh
  46. .build_docs_template:
  47. image: $ESP_IDF_DOC_ENV_IMAGE
  48. variables:
  49. PYTHON_VER: 3.6.13
  50. tags:
  51. - build_docs
  52. dependencies: []
  53. script:
  54. - cd docs
  55. - python -m pip install -r requirements.txt
  56. - python ./build_docs.py -bs $DOC_BUILDERS -l $DOCLANG -t $DOCTGT build
  57. parallel:
  58. matrix:
  59. - DOCLANG: ["en", "zh_CN"]
  60. DOCTGT: ["esp32", "esp32s2", "esp32c3"]
  61. check_docs_gh_links:
  62. image: $ESP_IDF_DOC_ENV_IMAGE
  63. variables:
  64. PYTHON_VER: 3.6.13
  65. extends:
  66. - .pre_check_job_template
  67. - .doc-rules:build:docs
  68. script:
  69. - cd docs
  70. - python -m pip install -r requirements.txt
  71. - python ./build_docs.py gh-linkcheck
  72. # stage: build_doc
  73. # Add this stage to let the build_docs job run in parallel with build
  74. .build_docs_build_stage_template:
  75. extends:
  76. - .build_docs_template
  77. stage: build_doc
  78. needs:
  79. - job: check_docs_lang_sync
  80. artifacts: false
  81. - job: check_docs_gh_links
  82. artifacts: false
  83. # Doc jobs have a lot of special cases, we specify rules here directly instead
  84. # in dependencies.yml to simplify things
  85. build_docs_html_full:
  86. extends:
  87. - .build_docs_build_stage_template
  88. rules:
  89. - <<: *if-protected
  90. - <<: *if-label-docs_full
  91. artifacts:
  92. when: always
  93. paths:
  94. - docs/_build/*/*/*.txt
  95. - docs/_build/*/*/html/*
  96. expire_in: 4 days
  97. variables:
  98. DOC_BUILDERS: "html"
  99. build_docs_html_fast:
  100. extends:
  101. - .build_docs_build_stage_template
  102. rules:
  103. - <<: *if-label-docs_full
  104. when: never
  105. - <<: *if-label-build_docs
  106. - <<: *if-label-docs
  107. - <<: *if-dev-push
  108. changes: *patterns-docs
  109. artifacts:
  110. when: always
  111. paths:
  112. - docs/_build/*/*/*.txt
  113. - docs/_build/*/*/html/*
  114. expire_in: 4 days
  115. variables:
  116. DOC_BUILDERS: "html"
  117. DOCS_FAST_BUILD: "yes"
  118. # matrix is redefined to include esp32s3 here
  119. # that we can build for S3 MRs during bringup phase without
  120. # anything being built and published from master branch
  121. parallel:
  122. matrix:
  123. - DOCLANG: ["en", "zh_CN"]
  124. DOCTGT: ["esp32", "esp32s2", "esp32s3", "esp32c3"]
  125. build_docs_pdf:
  126. extends:
  127. - .build_docs_build_stage_template
  128. rules:
  129. - <<: *if-protected
  130. - <<: *if-label-docs_full
  131. artifacts:
  132. when: always
  133. paths:
  134. - docs/_build/*/*/latex/*
  135. expire_in: 4 days
  136. variables:
  137. DOC_BUILDERS: "latex"
  138. .deploy_docs_template:
  139. extends:
  140. - .before_script_no_sync_submodule
  141. image: $ESP_IDF_DOC_ENV_IMAGE
  142. variables:
  143. PYTHON_VER: 3.6.13
  144. stage: test_deploy
  145. tags:
  146. - deploy
  147. - shiny
  148. variables:
  149. DOCS_BUILD_DIR: "${IDF_PATH}/docs/_build/"
  150. PYTHONUNBUFFERED: 1
  151. dependencies: []
  152. script:
  153. - add_doc_server_ssh_keys $DOCS_DEPLOY_PRIVATEKEY $DOCS_DEPLOY_SERVER $DOCS_DEPLOY_SERVER_USER
  154. - export GIT_VER=$(git describe --always)
  155. - python ${IDF_PATH}/tools/ci/deploy_docs.py
  156. # stage: test_deploy
  157. deploy_docs_preview:
  158. extends:
  159. - .deploy_docs_template
  160. rules:
  161. - <<: *if-label-build_docs
  162. - <<: *if-label-docs
  163. dependencies:
  164. - build_docs_html_fast
  165. - build_docs_html_full
  166. - build_docs_pdf
  167. variables:
  168. TYPE: "preview"
  169. # older branches use DOCS_DEPLOY_KEY, DOCS_SERVER, DOCS_SERVER_USER, DOCS_PATH for preview server so we keep these names for 'preview'
  170. DOCS_DEPLOY_PRIVATEKEY: "$DOCS_DEPLOY_KEY"
  171. DOCS_DEPLOY_SERVER: "$DOCS_SERVER"
  172. DOCS_DEPLOY_SERVER_USER: "$DOCS_SERVER_USER"
  173. DOCS_DEPLOY_PATH: "$DOCS_PATH"
  174. DOCS_DEPLOY_URL_BASE: "https://$CI_DOCKER_REGISTRY/docs/esp-idf"
  175. # stage: post_deploy
  176. deploy_docs_production:
  177. # The DOCS_PROD_* variables used by this job are "Protected" so these branches must all be marked "Protected" in Gitlab settings
  178. extends:
  179. - .deploy_docs_template
  180. rules:
  181. - <<: *if-protected-no_label
  182. stage: post_deploy
  183. dependencies: # set dependencies to null to avoid missing artifacts issue
  184. needs: # ensure runs after push_to_github succeeded
  185. - build_docs_html_full
  186. - build_docs_pdf
  187. - job: push_to_github
  188. artifacts: false
  189. variables:
  190. TYPE: "preview"
  191. DOCS_DEPLOY_PRIVATEKEY: "$DOCS_PROD_DEPLOY_KEY"
  192. DOCS_DEPLOY_SERVER: "$DOCS_PROD_SERVER"
  193. DOCS_DEPLOY_SERVER_USER: "$DOCS_PROD_SERVER_USER"
  194. DOCS_DEPLOY_PATH: "$DOCS_PROD_PATH"
  195. DOCS_DEPLOY_URL_BASE: "https://docs.espressif.com/projects/esp-idf"
  196. check_doc_links:
  197. extends:
  198. - .build_docs_template
  199. - .rules:protected
  200. stage: post_deploy
  201. tags: ["build", "amd64", "internet"]
  202. artifacts:
  203. when: always
  204. paths:
  205. - docs/_build/*/*/*.txt
  206. - docs/_build/*/*/linkcheck/*.txt
  207. expire_in: 1 week
  208. allow_failure: true
  209. script:
  210. - cd docs
  211. - python -m pip install -r requirements.txt
  212. # At the moment this check will always fail due to multiple known limitations, ignore result
  213. - python ./build_docs.py -l $DOCLANG -t $DOCTGT linkcheck || { echo "THERE ARE ISSUES DUE TO KNOWN LIMITATIONS, PLEASE FIX THEM. Nowadays we're ignored them to pass pipeline."; true; }