2021-04-27 00:24:22 -04:00
.patterns-docs : &patterns-docs
- ".gitlab/ci/docs.yml"
- "docs/**/*"
- "components/**/*.h"
- "components/**/Kconfig*"
- "components/**/CMakeList.txt"
- "components/**/sdkconfig*"
- "tools/kconfig_new/**/*"
- "CONTRIBUTING.rst"
.if-protected : &if-protected
if : '($CI_COMMIT_REF_NAME == "master" || $CI_COMMIT_BRANCH =~ /^release\/v/ || $CI_COMMIT_TAG =~ /^v\d+\.\d+(\.\d+)?($|-)/)'
.if-protected-no_label : &if-protected-no_label
if : '($CI_COMMIT_REF_NAME == "master" || $CI_COMMIT_BRANCH =~ /^release\/v/ || $CI_COMMIT_TAG =~ /^v\d+\.\d+(\.\d+)?($|-)/) && $BOT_TRIGGER_WITH_LABEL == null'
.if-label-build_docs : &if-label-build_docs
if : '$BOT_LABEL_BUILD_DOCS || $CI_MERGE_REQUEST_LABELS =~ /^(?:[^,\n\r]+,)*build_docs(?:,[^,\n\r]+)*$/i'
.if-label-docs : &if-label-docs
if : '$BOT_LABEL_DOCS || $CI_MERGE_REQUEST_LABELS =~ /^(?:[^,\n\r]+,)*docs(?:,[^,\n\r]+)*$/i'
.if-label-docs_full : &if-label-docs_full
if : '$BOT_LABEL_DOCS_FULL || $CI_MERGE_REQUEST_LABELS =~ /^(?:[^,\n\r]+,)*docs_full(?:,[^,\n\r]+)*$/i'
.if-dev-push : &if-dev-push
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")'
.doc-rules:build:docs :
rules :
- << : *if-protected
- << : *if-label-build_docs
- << : *if-label-docs
- << : *if-label-docs_full
- << : *if-dev-push
changes : *patterns-docs
2020-11-04 04:07:33 -05:00
# stage: pre_check
check_readme_links :
extends :
- .pre_check_job_template
2021-02-08 23:31:38 -05:00
tags : [ "build" , "amd64" , "internet" ]
2020-11-04 04:07:33 -05:00
allow_failure : true
script :
- python ${IDF_PATH}/tools/ci/check_readme_links.py
check_docs_lang_sync :
extends :
- .pre_check_job_template
2021-04-27 00:24:22 -04:00
- .doc-rules:build:docs
2020-11-04 04:07:33 -05:00
script :
- cd docs
- ./check_lang_folder_sync.sh
2021-02-08 23:31:38 -05:00
.build_docs_template :
image : $ESP_IDF_DOC_ENV_IMAGE
2021-05-26 04:44:20 -04:00
variables :
2021-06-23 04:06:08 -04:00
PYTHON_VER : 3.6 .13
2021-02-08 23:31:38 -05:00
tags :
- build_docs
dependencies : [ ]
script :
- cd docs
2021-08-23 20:56:48 -04:00
- pip install -r requirements.txt
- build-docs -t $DOCTGT -bs $DOC_BUILDERS -l $DOCLANG build
2021-02-08 23:31:38 -05:00
parallel :
matrix :
- DOCLANG : [ "en" , "zh_CN" ]
2021-09-05 21:11:17 -04:00
DOCTGT : [ "esp32" , "esp32s2" , "esp32s3" , "esp32c3" ]
2021-02-08 23:31:38 -05:00
2020-11-04 04:07:33 -05:00
check_docs_gh_links :
2021-06-30 01:30:13 -04:00
image : $ESP_IDF_DOC_ENV_IMAGE
variables :
PYTHON_VER : 3.6 .13
2020-11-04 04:07:33 -05:00
extends :
2021-02-08 23:31:38 -05:00
- .pre_check_job_template
2021-04-27 00:24:22 -04:00
- .doc-rules:build:docs
2020-11-04 04:07:33 -05:00
script :
- cd docs
2021-08-23 20:56:48 -04:00
- pip install -r requirements.txt
- build-docs gh-linkcheck
2020-11-04 04:07:33 -05:00
2021-02-08 23:51:28 -05:00
# stage: build_doc
# Add this stage to let the build_docs job run in parallel with build
2020-11-04 04:07:33 -05:00
.build_docs_build_stage_template :
extends :
- .build_docs_template
2021-02-08 23:51:28 -05:00
stage : build_doc
2020-11-04 04:07:33 -05:00
needs :
2021-02-08 23:31:38 -05:00
- job : check_docs_lang_sync
artifacts : false
- job : check_docs_gh_links
artifacts : false
2020-11-04 04:07:33 -05:00
2021-04-27 00:24:22 -04:00
# Doc jobs have a lot of special cases, we specify rules here directly instead
# in dependencies.yml to simplify things
build_docs_html_full :
2020-11-04 04:07:33 -05:00
extends :
- .build_docs_build_stage_template
2021-04-27 00:24:22 -04:00
rules :
- << : *if-protected
- << : *if-label-docs_full
2020-11-04 04:07:33 -05:00
artifacts :
when : always
paths :
- docs/_build/*/*/*.txt
- docs/_build/*/*/html/*
expire_in : 4 days
variables :
DOC_BUILDERS : "html"
2021-04-27 00:24:22 -04:00
build_docs_html_fast :
extends :
- .build_docs_build_stage_template
rules :
- << : *if-label-docs_full
when : never
- << : *if-label-build_docs
- << : *if-label-docs
- << : *if-dev-push
changes : *patterns-docs
artifacts :
when : always
paths :
- docs/_build/*/*/*.txt
- docs/_build/*/*/html/*
expire_in : 4 days
variables :
DOC_BUILDERS : "html"
DOCS_FAST_BUILD : "yes"
2020-11-04 04:07:33 -05:00
build_docs_pdf :
extends :
- .build_docs_build_stage_template
2021-04-27 00:24:22 -04:00
rules :
- << : *if-protected
- << : *if-label-docs_full
2020-11-04 04:07:33 -05:00
artifacts :
when : always
paths :
- docs/_build/*/*/latex/*
expire_in : 4 days
variables :
DOC_BUILDERS : "latex"
.deploy_docs_template :
extends :
2021-02-08 23:31:38 -05:00
- .before_script_no_sync_submodule
2020-11-04 04:07:33 -05:00
image : $ESP_IDF_DOC_ENV_IMAGE
2021-05-26 04:44:20 -04:00
variables :
2021-06-23 04:06:08 -04:00
PYTHON_VER : 3.6 .13
2021-02-08 23:31:38 -05:00
stage : test_deploy
2020-11-04 04:07:33 -05:00
tags :
- deploy
- shiny
variables :
DOCS_BUILD_DIR : "${IDF_PATH}/docs/_build/"
PYTHONUNBUFFERED : 1
2021-02-08 23:31:38 -05:00
dependencies : [ ]
2020-11-04 04:07:33 -05:00
script :
- add_doc_server_ssh_keys $DOCS_DEPLOY_PRIVATEKEY $DOCS_DEPLOY_SERVER $DOCS_DEPLOY_SERVER_USER
- export GIT_VER=$(git describe --always)
2021-08-23 20:56:48 -04:00
- pip install -r docs/requirements.txt
- deploy-docs
2020-11-04 04:07:33 -05:00
# stage: test_deploy
deploy_docs_preview :
extends :
- .deploy_docs_template
2021-04-27 00:24:22 -04:00
rules :
- << : *if-label-build_docs
- << : *if-label-docs
dependencies :
- build_docs_html_fast
- build_docs_html_full
2020-11-04 04:07:33 -05:00
- build_docs_pdf
variables :
TYPE : "preview"
# older branches use DOCS_DEPLOY_KEY, DOCS_SERVER, DOCS_SERVER_USER, DOCS_PATH for preview server so we keep these names for 'preview'
DOCS_DEPLOY_PRIVATEKEY : "$DOCS_DEPLOY_KEY"
DOCS_DEPLOY_SERVER : "$DOCS_SERVER"
DOCS_DEPLOY_SERVER_USER : "$DOCS_SERVER_USER"
DOCS_DEPLOY_PATH : "$DOCS_PATH"
2021-10-13 04:03:14 -04:00
DOCS_DEPLOY_URL_BASE : "https://$DOCS_PREVIEW_SERVER_URL/docs/esp-idf"
2020-11-04 04:07:33 -05:00
# stage: post_deploy
deploy_docs_production :
# The DOCS_PROD_* variables used by this job are "Protected" so these branches must all be marked "Protected" in Gitlab settings
extends :
- .deploy_docs_template
2021-04-27 00:24:22 -04:00
rules :
- << : *if-protected-no_label
2020-11-04 04:07:33 -05:00
stage : post_deploy
2021-02-08 23:31:38 -05:00
dependencies : # set dependencies to null to avoid missing artifacts issue
2020-11-04 04:07:33 -05:00
needs : # ensure runs after push_to_github succeeded
2021-04-27 00:24:22 -04:00
- build_docs_html_full
2020-11-04 04:07:33 -05:00
- build_docs_pdf
2021-02-08 23:31:38 -05:00
- job : push_to_github
artifacts : false
2020-11-04 04:07:33 -05:00
variables :
TYPE : "preview"
DOCS_DEPLOY_PRIVATEKEY : "$DOCS_PROD_DEPLOY_KEY"
DOCS_DEPLOY_SERVER : "$DOCS_PROD_SERVER"
DOCS_DEPLOY_SERVER_USER : "$DOCS_PROD_SERVER_USER"
DOCS_DEPLOY_PATH : "$DOCS_PROD_PATH"
DOCS_DEPLOY_URL_BASE : "https://docs.espressif.com/projects/esp-idf"
check_doc_links :
extends :
- .build_docs_template
- .rules:protected
stage : post_deploy
tags : [ "build" , "amd64" , "internet" ]
artifacts :
when : always
paths :
- docs/_build/*/*/*.txt
- docs/_build/*/*/linkcheck/*.txt
expire_in : 1 week
allow_failure : true
script :
- cd docs
2021-08-23 20:56:48 -04:00
- pip install -r requirements.txt
2021-03-15 23:28:26 -04:00
# At the moment this check will always fail due to multiple known limitations, ignore result
2021-08-23 20:56:48 -04:00
- build-docs -t $DOCTGT -l $DOCLANG linkcheck || { echo "THERE ARE ISSUES DUE TO KNOWN LIMITATIONS, PLEASE FIX THEM. Nowadays we're ignored them to pass pipeline."; true; }