|
26 | 26 | .if-label-build_docs: &if-label-build_docs |
27 | 27 | if: '$BOT_LABEL_BUILD_DOCS || $CI_MERGE_REQUEST_LABELS =~ /^(?:[^,\n\r]+,)*build_docs(?:,[^,\n\r]+)*$/i' |
28 | 28 |
|
| 29 | +.if-label-docs_full: &if-label-docs_full |
| 30 | + if: '$BOT_LABEL_DOCS_FULL || $CI_MERGE_REQUEST_LABELS =~ /^(?:[^,\n\r]+,)*docs_full(?:,[^,\n\r]+)*$/i' |
| 31 | + |
29 | 32 | .doc-rules:build:docs: |
30 | 33 | rules: |
31 | 34 | - <<: *if-protected |
|
34 | 37 | when: never |
35 | 38 | - <<: *if-label-build_docs |
36 | 39 |
|
37 | | -build_docs: |
| 40 | +.doc-rules:deploy:docs_production: |
| 41 | + rules: |
| 42 | + - <<: *if-protected |
| 43 | + |
| 44 | +.before_script_install_requirements: |
38 | 45 | stage: build |
39 | | - extends: |
40 | | - - .doc-rules:build:docs |
41 | | - image: $CI_DOCKER_REGISTRY/esp-idf-doc-env:v7 |
| 46 | + image: "$CI_DOCKER_REGISTRY/esp-idf-doc-env-v5.0:4-4" |
42 | 47 | tags: |
43 | 48 | - build_docs |
| 49 | + variables: |
| 50 | + DOCS_DIR: $CI_PROJECT_DIR/docs |
| 51 | + IDF_VERSION_TAG: "v5.0" |
| 52 | + IDF_TAG_FLAG: "true" |
| 53 | + dependencies: [] |
| 54 | + |
| 55 | +.build_docs_html_template: |
| 56 | + extends: |
| 57 | + - .before_script_install_requirements |
| 58 | + variables: |
| 59 | + DOC_BUILDERS: "html" |
| 60 | + script: |
| 61 | + - pip install -r docs/requirements.txt |
| 62 | + - cd $DOCS_DIR |
| 63 | + - mkdir -p $ADF_PATH/docs/_build/${DOCLANG}/generic/inc |
| 64 | + - build-docs -bs $DOC_BUILDERS -l $DOCLANG build |
| 65 | + - ./check_lang_folder_sync.sh |
| 66 | + - echo "ESP-ADF Guide preview available at $CI_JOB_URL/artifacts/file/docs/_build/$DOCLANG/generic/html/index.html" |
| 67 | + |
| 68 | +.build_docs_pdf_template: |
| 69 | + extends: |
| 70 | + - .before_script_install_requirements |
| 71 | + script: |
| 72 | + - pip install -r docs/requirements.txt |
| 73 | + - cd $DOCS_DIR |
| 74 | + - mkdir -p $ADF_PATH/docs/_build/${DOCLANG}/generic/inc |
| 75 | + - build-docs --skip-reqs-check -l $DOCLANG -bs latex |
| 76 | + |
| 77 | +build_docs_html: |
| 78 | + extends: |
| 79 | + - .build_docs_html_template |
| 80 | + - .doc-rules:build:docs |
44 | 81 | artifacts: |
45 | 82 | when: always |
46 | 83 | paths: |
47 | | - # English version of documentation |
48 | | - - docs/en/doxygen-warning-log.txt |
49 | | - - docs/en/sphinx-warning-log.txt |
50 | | - - docs/en/sphinx-warning-log-sanitized.txt |
51 | | - - docs/en/_build/html |
52 | | - # Chinese version of documentation |
53 | | - - docs/zh_CN/doxygen-warning-log.txt |
54 | | - - docs/zh_CN/sphinx-warning-log.txt |
55 | | - - docs/zh_CN/sphinx-warning-log-sanitized.txt |
56 | | - - docs/zh_CN/_build/html |
57 | | - expire_in: 1 mos |
| 84 | + - $DOCS_DIR/_build/*/*/*.txt |
| 85 | + - $DOCS_DIR/_build/*/*/html/* |
| 86 | + expire_in: 4 days |
| 87 | + parallel: |
| 88 | + matrix: |
| 89 | + - DOCLANG: "en" |
| 90 | + - DOCLANG: "zh_CN" |
| 91 | + |
| 92 | +build_docs_pdf: |
| 93 | + extends: |
| 94 | + - .build_docs_pdf_template |
| 95 | + - .doc-rules:build:docs |
| 96 | + artifacts: |
| 97 | + when: always |
| 98 | + paths: |
| 99 | + - $DOCS_DIR/_build/*/*/latex/* |
| 100 | + - $DOCS_DIR/_build/*/*/*.txt |
| 101 | + expire_in: 4 days |
| 102 | + parallel: |
| 103 | + matrix: |
| 104 | + - DOCLANG: "en" |
| 105 | + - DOCLANG: "zh_CN" |
| 106 | + |
| 107 | +.deploy_docs_template: |
| 108 | + stage: test_deploy |
| 109 | + image: "$CI_DOCKER_REGISTRY/esp-idf-doc-env-v5.0" |
| 110 | + variables: |
| 111 | + DOCS_BUILD_DIR: "${CI_PROJECT_DIR}/docs/_build/" |
| 112 | + PYTHONUNBUFFERED: 1 |
| 113 | + tags: |
| 114 | + - deploy |
| 115 | + - shiny |
| 116 | + needs: |
| 117 | + - job: "build_docs_html" |
| 118 | + artifacts: true |
| 119 | + optional: true |
| 120 | + - job: "build_docs_pdf" |
| 121 | + artifacts: true |
| 122 | + optional: true |
58 | 123 | script: |
59 | | - - source /opt/pyenv/activate && pyenv global 3.6.10 |
60 | | - - pip install "setuptools<57.5.0" |
61 | | - - pip install "funcparserlib==0.3.6" |
62 | | - - /opt/pyenv/pyenv-1.2.16/versions/3.6.10/bin/python -m pip install --user -r $ADF_PATH/docs/requirements.txt |
63 | | - - cd docs |
64 | | - - ./check_lang_folder_sync.sh |
65 | | - - cd en |
66 | | - - make gh-linkcheck |
67 | | - - make html |
68 | | - - ../check_doc_warnings.sh |
69 | | - - cd ../zh_CN |
70 | | - - make gh-linkcheck |
71 | | - - make html |
72 | | - - ../check_doc_warnings.sh |
| 124 | + - source ${CI_PROJECT_DIR}/tools/ci/utils.sh |
| 125 | + - add_doc_server_ssh_keys $DOCS_DEPLOY_PRIVATEKEY $DOCS_DEPLOY_SERVER $DOCS_DEPLOY_SERVER_USER |
| 126 | + - export GIT_VER=$(git describe --always ${PIPELINE_COMMIT_SHA} --) |
| 127 | + - deploy-docs |
| 128 | + |
| 129 | +# stage: test_deploy |
| 130 | +.deploy_docs_preview: |
| 131 | + extends: |
| 132 | + - .deploy_docs_template |
| 133 | + rules: |
| 134 | + - <<: *if-merge_request_event |
| 135 | + - <<: *if-open-merge-request |
| 136 | + when: never |
| 137 | + - <<: *if-dev-push |
| 138 | + when: never |
| 139 | + - <<: *if-label-build_docs |
| 140 | + - <<: *if-label-docs_full |
| 141 | + changes: *patterns-docs-preview |
| 142 | + variables: |
| 143 | + TYPE: "preview" |
| 144 | + # older branches use DOCS_DEPLOY_KEY, DOCS_SERVER, DOCS_SERVER_USER, DOCS_PATH for preview server so we keep these names for 'preview' |
| 145 | + DOCS_DEPLOY_PRIVATEKEY: "$DOCS_DEPLOY_KEY" |
| 146 | + DOCS_DEPLOY_SERVER: "$DOCS_SERVER" |
| 147 | + DOCS_DEPLOY_SERVER_USER: "$DOCS_SERVER_USER" |
| 148 | + DOCS_DEPLOY_PATH: "$DOCS_PATH" |
| 149 | + DOCS_DEPLOY_URL_BASE: "https://$DOCS_PREVIEW_SERVER_URL/docs/esp-adf" |
| 150 | + |
| 151 | +# stage: post_deploy |
| 152 | +deploy_docs_production: |
| 153 | + # The DOCS_PROD_* variables used by this job are "Protected" so these branches must all be marked "Protected" in Gitlab settings |
| 154 | + extends: |
| 155 | + - .deploy_docs_template |
| 156 | + - .doc-rules:deploy:docs_production |
| 157 | + stage: post_deploy |
| 158 | + dependencies: # set dependencies to null to avoid missing artifacts issue |
| 159 | + needs: # ensure runs after push_to_github succeeded |
| 160 | + - job: "build_docs_html" |
| 161 | + artifacts: true |
| 162 | + optional: true |
| 163 | + - job: "build_docs_pdf" |
| 164 | + artifacts: true |
| 165 | + optional: true |
| 166 | + - job: push_to_github |
| 167 | + artifacts: false |
| 168 | + variables: |
| 169 | + TYPE: "preview" |
| 170 | + DOCS_DEPLOY_PRIVATEKEY: "$DOCS_PROD_DEPLOY_KEY" |
| 171 | + DOCS_DEPLOY_SERVER: "$DOCS_PROD_SERVER" |
| 172 | + DOCS_DEPLOY_SERVER_USER: "$DOCS_PROD_SERVER_USER" |
| 173 | + DOCS_DEPLOY_PATH: "$DOCS_PROD_PATH" |
| 174 | + DOCS_DEPLOY_URL_BASE: "https://docs.espressif.com/projects/esp-adf" |
| 175 | + DEPLOY_STABLE: 1 |
0 commit comments