2021-04-27 04:24:22 +00:00
.patterns-docs : &patterns-docs
- ".gitlab/ci/docs.yml"
- "docs/**/*"
- "components/**/*.h"
- "components/**/Kconfig*"
- "components/**/CMakeList.txt"
- "components/**/sdkconfig*"
- "tools/kconfig_new/**/*"
- "CONTRIBUTING.rst"
2021-10-13 10:19:05 +00:00
.patterns-docs-preview : &patterns-docs-preview
- "docs/**/*"
2021-04-27 04:24:22 +00:00
.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 09:07:33 +00:00
# stage: pre_check
check_readme_links :
extends :
- .pre_check_job_template
2021-02-09 04:31:38 +00:00
tags : [ "build" , "amd64" , "internet" ]
2020-11-04 09:07:33 +00: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 04:24:22 +00:00
- .doc-rules:build:docs
2020-11-04 09:07:33 +00:00
script :
- cd docs
- ./check_lang_folder_sync.sh
2021-02-09 04:31:38 +00:00
.build_docs_template :
image : $ESP_IDF_DOC_ENV_IMAGE
2021-05-26 08:44:20 +00:00
variables :
2022-01-31 06:20:59 +00:00
PYTHON_VER : 3.7 .10
2021-02-09 04:31:38 +00:00
tags :
- build_docs
dependencies : [ ]
script :
- cd docs
2021-08-24 00:56:48 +00:00
- pip install -r requirements.txt
- build-docs -t $DOCTGT -bs $DOC_BUILDERS -l $DOCLANG build
2021-02-09 04:31:38 +00:00
parallel :
matrix :
- DOCLANG : [ "en" , "zh_CN" ]
2022-01-20 07:49:48 +00:00
DOCTGT : [ "esp32" , "esp32s2" , "esp32s3" , "esp32c3" , "esp32c2" ]
2021-02-09 04:31:38 +00:00
2020-11-04 09:07:33 +00:00
check_docs_gh_links :
2021-06-30 05:30:13 +00:00
image : $ESP_IDF_DOC_ENV_IMAGE
variables :
2022-01-31 06:20:59 +00:00
PYTHON_VER : 3.7 .10
2020-11-04 09:07:33 +00:00
extends :
2021-02-09 04:31:38 +00:00
- .pre_check_job_template
2021-04-27 04:24:22 +00:00
- .doc-rules:build:docs
2020-11-04 09:07:33 +00:00
script :
- cd docs
2021-08-24 00:56:48 +00:00
- pip install -r requirements.txt
- build-docs gh-linkcheck
2020-11-04 09:07:33 +00:00
2021-02-09 04:51:28 +00:00
# stage: build_doc
# Add this stage to let the build_docs job run in parallel with build
2020-11-04 09:07:33 +00:00
.build_docs_build_stage_template :
extends :
- .build_docs_template
2021-02-09 04:51:28 +00:00
stage : build_doc
2020-11-04 09:07:33 +00:00
needs :
2021-02-09 04:31:38 +00:00
- job : check_docs_lang_sync
artifacts : false
- job : check_docs_gh_links
artifacts : false
2020-11-04 09:07:33 +00:00
2021-04-27 04:24:22 +00: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 09:07:33 +00:00
extends :
- .build_docs_build_stage_template
2021-04-27 04:24:22 +00:00
rules :
- << : *if-protected
- << : *if-label-docs_full
2020-11-04 09:07:33 +00:00
artifacts :
when : always
paths :
- docs/_build/*/*/*.txt
- docs/_build/*/*/html/*
expire_in : 4 days
variables :
DOC_BUILDERS : "html"
2021-04-27 04:24:22 +00: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 09:07:33 +00:00
build_docs_pdf :
extends :
- .build_docs_build_stage_template
2021-04-27 04:24:22 +00:00
rules :
- << : *if-protected
- << : *if-label-docs_full
2020-11-04 09:07:33 +00:00
artifacts :
when : always
paths :
- docs/_build/*/*/latex/*
expire_in : 4 days
variables :
DOC_BUILDERS : "latex"
.deploy_docs_template :
extends :
2021-02-09 04:31:38 +00:00
- .before_script_no_sync_submodule
2020-11-04 09:07:33 +00:00
image : $ESP_IDF_DOC_ENV_IMAGE
2021-05-26 08:44:20 +00:00
variables :
2022-01-31 06:20:59 +00:00
PYTHON_VER : 3.7 .10
2021-12-06 05:36:21 +00:00
DOCS_BUILD_DIR : "${IDF_PATH}/docs/_build/"
PYTHONUNBUFFERED : 1
2021-02-09 04:31:38 +00:00
stage : test_deploy
2020-11-04 09:07:33 +00:00
tags :
- deploy
- shiny
script :
- add_doc_server_ssh_keys $DOCS_DEPLOY_PRIVATEKEY $DOCS_DEPLOY_SERVER $DOCS_DEPLOY_SERVER_USER
2021-10-28 04:07:02 +00:00
- export GIT_VER=$(git describe --always ${PIPELINE_COMMIT_SHA} --)
2021-08-24 00:56:48 +00:00
- pip install -r docs/requirements.txt
- deploy-docs
2020-11-04 09:07:33 +00:00
# stage: test_deploy
deploy_docs_preview :
extends :
- .deploy_docs_template
2021-04-27 04:24:22 +00:00
rules :
- << : *if-label-build_docs
- << : *if-label-docs
2021-10-13 10:19:05 +00:00
- << : *if-dev-push
changes : *patterns-docs-preview
2022-03-25 08:18:54 +00:00
needs :
- job : build_docs_html_fast
optional : true
- job : build_docs_html_full
optional : true
- job : build_docs_pdf
optional : true
2020-11-04 09:07:33 +00:00
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 08:03:14 +00:00
DOCS_DEPLOY_URL_BASE : "https://$DOCS_PREVIEW_SERVER_URL/docs/esp-idf"
2020-11-04 09:07:33 +00: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 04:24:22 +00:00
rules :
- << : *if-protected-no_label
2020-11-04 09:07:33 +00:00
stage : post_deploy
2021-02-09 04:31:38 +00:00
dependencies : # set dependencies to null to avoid missing artifacts issue
2020-11-04 09:07:33 +00:00
needs : # ensure runs after push_to_github succeeded
2021-04-27 04:24:22 +00:00
- build_docs_html_full
2020-11-04 09:07:33 +00:00
- build_docs_pdf
2021-02-09 04:31:38 +00:00
- job : push_to_github
artifacts : false
2020-11-04 09:07:33 +00: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"
2021-11-09 09:11:01 +00:00
DEPLOY_STABLE : 1
2020-11-04 09:07:33 +00:00
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-24 00:56:48 +00:00
- pip install -r requirements.txt
2021-03-16 03:28:26 +00:00
# At the moment this check will always fail due to multiple known limitations, ignore result
2021-08-24 00:56:48 +00: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; }