deploy.yml 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. .clang_tidy_deploy_template:
  2. stage: deploy
  3. image: $CI_DOCKER_REGISTRY/esp32-ci-env
  4. tags:
  5. - deploy
  6. - shiny
  7. script:
  8. - mkdir -p ~/.ssh
  9. - chmod 700 ~/.ssh
  10. - echo -n $DOCS_DEPLOY_KEY > ~/.ssh/id_rsa_base64
  11. - base64 --decode --ignore-garbage ~/.ssh/id_rsa_base64 > ~/.ssh/id_rsa
  12. - chmod 600 ~/.ssh/id_rsa
  13. - echo -e "Host $DOCS_SERVER\n\tStrictHostKeyChecking no\n\tUser $DOCS_SERVER_USER\n" >> ~/.ssh/config
  14. - export GIT_VER=$(git describe --always)
  15. - cd $IDF_PATH/examples/get-started/hello_world/tidybuild
  16. - mv report $GIT_VER
  17. - tar czvf $GIT_VER.tar.gz $GIT_VER
  18. - export STATIC_REPORT_PATH="web/static_analysis/esp-idf/"
  19. - ssh $DOCS_SERVER -x "mkdir -p $STATIC_REPORT_PATH/clang-tidy"
  20. - scp $GIT_VER.tar.gz $DOCS_SERVER:$STATIC_REPORT_PATH/clang-tidy
  21. - ssh $DOCS_SERVER -x "cd $STATIC_REPORT_PATH/clang-tidy && tar xzvf $GIT_VER.tar.gz && rm -f latest && ln -s $GIT_VER latest"
  22. # add link to view the report
  23. - echo "[static analysis][clang tidy] $CI_DOCKER_REGISTRY/static_analysis/esp-idf/clang-tidy/${GIT_VER}/index.html"
  24. - test ! -e ${GIT_VER}/FAILED_RULES || { echo 'Failed static analysis rules!'; cat ${GIT_VER}/FAILED_RULES; exit 1; }
  25. clang_tidy_deploy:
  26. extends: .clang_tidy_deploy_template
  27. dependencies:
  28. - clang_tidy_check
  29. - clang_tidy_check_all
  30. variables:
  31. BOT_NEEDS_TRIGGER_BY_NAME: 1
  32. clang_tidy_deploy_regular:
  33. extends: .clang_tidy_deploy_template
  34. dependencies:
  35. - clang_tidy_check_regular
  36. only:
  37. refs:
  38. - master
  39. - /^release\/v/
  40. - /^v\d+\.\d+(\.\d+)?($|-)/
  41. - triggers
  42. - schedules
  43. variables:
  44. - $BOT_LABEL_STATIC_ANALYSIS
  45. - $BOT_LABEL_STATIC_ANALYSIS_ALL
  46. push_to_github:
  47. stage: deploy
  48. image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
  49. tags:
  50. - deploy
  51. only:
  52. - master
  53. - /^release\/v/
  54. - /^v\d+\.\d+(\.\d+)?($|-)/
  55. when: on_success
  56. dependencies: []
  57. extends: .before_script_lesser
  58. script:
  59. - mkdir -p ~/.ssh
  60. - chmod 700 ~/.ssh
  61. - echo -n $GH_PUSH_KEY > ~/.ssh/id_rsa_base64
  62. - base64 --decode --ignore-garbage ~/.ssh/id_rsa_base64 > ~/.ssh/id_rsa
  63. - chmod 600 ~/.ssh/id_rsa
  64. - echo -e "Host github.com\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
  65. - git remote remove github &>/dev/null || true
  66. - git remote add github git@github.com:espressif/esp-idf.git
  67. - tools/ci/push_to_github.sh
  68. .deploy_docs_template:
  69. extends: .before_script_lesser
  70. stage: deploy
  71. image: $ESP_IDF_DOC_ENV_IMAGE
  72. tags:
  73. - deploy
  74. - shiny
  75. dependencies:
  76. - build_docs_en_esp32
  77. - build_docs_en_esp32s2
  78. - build_docs_zh_CN_esp32
  79. - build_docs_zh_CN_esp32s2
  80. variables:
  81. DOCS_BUILD_DIR: "${IDF_PATH}/docs/_build/"
  82. PYTHONUNBUFFERED: 1
  83. script:
  84. - mkdir -p ~/.ssh
  85. - chmod 700 ~/.ssh
  86. - echo -n $DOCS_DEPLOY_PRIVATEKEY > ~/.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 $DOCS_DEPLOY_SERVER\n\tStrictHostKeyChecking no\n\tUser $DOCS_DEPLOY_SERVER_USER\n" >> ~/.ssh/config
  90. - export GIT_VER=$(git describe --always)
  91. - ${IDF_PATH}/tools/ci/multirun_with_pyenv.sh -p 3.6.10 ${IDF_PATH}/tools/ci/deploy_docs.py
  92. # deploys docs to CI_DOCKER_REGISTRY webserver, for internal review
  93. deploy_docs_preview:
  94. extends: .deploy_docs_template
  95. only:
  96. refs:
  97. - triggers
  98. variables:
  99. - $BOT_TRIGGER_WITH_LABEL == null
  100. - $BOT_LABEL_BUILD_DOCS
  101. variables:
  102. TYPE: "preview"
  103. # older branches use DOCS_DEPLOY_KEY, DOCS_SERVER, DOCS_SERVER_USER, DOCS_PATH for preview server so we keep these names for 'preview'
  104. DOCS_DEPLOY_PRIVATEKEY: "$DOCS_DEPLOY_KEY"
  105. DOCS_DEPLOY_SERVER: "$DOCS_SERVER"
  106. DOCS_DEPLOY_SERVER_USER: "$DOCS_SERVER_USER"
  107. DOCS_DEPLOY_PATH: "$DOCS_PATH"
  108. DOCS_DEPLOY_URL_BASE: "https://$CI_DOCKER_REGISTRY/docs/esp-idf"
  109. # deploy docs to production webserver
  110. deploy_docs_production:
  111. extends: .deploy_docs_template
  112. only:
  113. refs:
  114. # The DOCS_PROD_* variables used by this job are "Protected" so these branches must all be marked "Protected" in Gitlab settings
  115. - master
  116. - /^release\/v/
  117. - /^v\d+\.\d+(\.\d+)?($|-)/
  118. variables:
  119. TYPE: "preview"
  120. DOCS_DEPLOY_PRIVATEKEY: "$DOCS_PROD_DEPLOY_KEY"
  121. DOCS_DEPLOY_SERVER: "$DOCS_PROD_SERVER"
  122. DOCS_DEPLOY_SERVER_USER: "$DOCS_PROD_SERVER_USER"
  123. DOCS_DEPLOY_PATH: "$DOCS_PROD_PATH"
  124. DOCS_DEPLOY_URL_BASE: "https://docs.espressif.com/projects/esp-idf"
  125. deploy_test_result:
  126. stage: deploy
  127. image: $CI_DOCKER_REGISTRY/bot-env
  128. tags:
  129. - deploy_test
  130. when: always
  131. only:
  132. refs:
  133. - master
  134. - schedules
  135. artifacts:
  136. when: always
  137. paths:
  138. - ${CI_PROJECT_DIR}/test-management/*.log
  139. # save all test logs as artifacts, make it easier to track errors
  140. - ${CI_PROJECT_DIR}/TEST_LOGS
  141. - $CI_PROJECT_DIR/$CI_COMMIT_SHA
  142. expire_in: 1 mos
  143. variables:
  144. UNIT_TEST_CASE_FILE: "${CI_PROJECT_DIR}/components/idf_test/unit_test/TestCaseAll.yml"
  145. BOT_ACCOUNT_CONFIG_FILE: "${CI_PROJECT_DIR}/test-management/Config/Account.local.yml"
  146. TEST_FW_PATH: "$CI_PROJECT_DIR/tools/tiny-test-fw"
  147. AUTO_TEST_SCRIPT_PATH: "${CI_PROJECT_DIR}/auto_test_script"
  148. before_script:
  149. - mkdir -p ~/.ssh
  150. - chmod 700 ~/.ssh
  151. - echo -n $GITLAB_KEY > ~/.ssh/id_rsa_base64
  152. - base64 --decode --ignore-garbage ~/.ssh/id_rsa_base64 > ~/.ssh/id_rsa
  153. - chmod 600 ~/.ssh/id_rsa
  154. - echo -e "Host gitlab.espressif.cn\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
  155. script:
  156. - export GIT_SHA=$(echo ${CI_COMMIT_SHA} | cut -c 1-8)
  157. - export REV_COUNT=$(git rev-list --count HEAD)
  158. - export SUMMARY="IDF CI test result for $GIT_SHA (r${REV_COUNT})"
  159. # artifacts of job update_test_cases creates test-management folder
  160. # we need to remove it so we can clone test-management folder again
  161. - rm -r test-management
  162. - git clone $TEST_MANAGEMENT_REPO
  163. - python3 $CHECKOUT_REF_SCRIPT test-management test-management
  164. - cd test-management
  165. - echo $BOT_JIRA_ACCOUNT > ${BOT_ACCOUNT_CONFIG_FILE}
  166. # update test results
  167. - python3 ImportTestResult.py -r "$GIT_SHA (r${REV_COUNT})" -j $JIRA_TEST_MANAGEMENT_PROJECT -s "$SUMMARY" -l CI -p ${CI_PROJECT_DIR}/TEST_LOGS ${CI_PROJECT_DIR}/${CI_COMMIT_SHA} --pipeline_url ${CI_PIPELINE_URL}