From d0e4942913356774871aec5948f1e25f64ffcd11 Mon Sep 17 00:00:00 2001 From: Marius Vikhammer Date: Tue, 6 Sep 2022 11:39:19 +0800 Subject: [PATCH 1/2] Add support for building C6 docs. Release 1.3.0 --- examples/basic/_static/docs_version.js | 3 ++- examples/basic/build_example.sh | 2 +- examples/basic/conf_common.py | 2 +- examples/doxygen/build_example.sh | 2 +- setup.cfg | 2 +- src/esp_docs/build_docs.py | 2 +- src/esp_docs/conf_docs.py | 1 + .../esp_extensions/format_esp_target.py | 19 ++++++++++++------- .../idf_extensions/build_system/__init__.py | 2 +- 9 files changed, 21 insertions(+), 14 deletions(-) diff --git a/examples/basic/_static/docs_version.js b/examples/basic/_static/docs_version.js index b767d6b..de93ee1 100644 --- a/examples/basic/_static/docs_version.js +++ b/examples/basic/_static/docs_version.js @@ -3,7 +3,7 @@ var DOCUMENTATION_VERSIONS = { supported_targets: [ "esp32" ] }, VERSIONS: [ - { name: "latest", has_targets: true, supported_targets: [ "esp32", "esp32s2", "esp32s3", "esp32c3", "esp32h2", "esp8266", "esp32c2" ] }, + { name: "latest", has_targets: true, supported_targets: [ "esp32", "esp32s2", "esp32s3", "esp32c3", "esp32h2", "esp8266", "esp32c2", "esp32c6" ] }, ], IDF_TARGETS: [ { text: "ESP32", value: "esp32"}, @@ -13,5 +13,6 @@ var DOCUMENTATION_VERSIONS = { { text: "ESP32-H2", value: "esp32h2"}, { text: "ESP8266", value: "esp8266"}, { text: "ESP32C2", value: "esp32c2"}, + { text: "ESP32C6", value: "esp32c6"}, ] }; diff --git a/examples/basic/build_example.sh b/examples/basic/build_example.sh index 5132298..f890028 100755 --- a/examples/basic/build_example.sh +++ b/examples/basic/build_example.sh @@ -1 +1 @@ -build-docs -t esp32 esp32s2 esp32c3 esp32s3 esp32h2 esp8266 esp32c2 +build-docs -t esp32 esp32s2 esp32c3 esp32s3 esp32h2 esp8266 esp32c2 esp32c6 diff --git a/examples/basic/conf_common.py b/examples/basic/conf_common.py index eefa9a3..921bce7 100644 --- a/examples/basic/conf_common.py +++ b/examples/basic/conf_common.py @@ -1,7 +1,7 @@ from esp_docs.conf_docs import * # noqa: F403,F401 languages = ['en', 'zh_CN'] -idf_targets = ['esp8266', 'esp32', 'esp32s2', 'esp32s3', 'esp32c3', 'esp32h2', 'esp32c2'] +idf_targets = ['esp8266', 'esp32', 'esp32s2', 'esp32s3', 'esp32c3', 'esp32h2', 'esp32c2', 'esp32c6'] extensions += ['sphinx_copybutton', 'sphinxcontrib.wavedrom', diff --git a/examples/doxygen/build_example.sh b/examples/doxygen/build_example.sh index 00eb5a2..0a3757c 100755 --- a/examples/doxygen/build_example.sh +++ b/examples/doxygen/build_example.sh @@ -1 +1 @@ -build-docs -t esp32 esp32s2 esp32c3 esp32s3 esp32h2 esp8266 esp32c2 --project-path src/ \ No newline at end of file +build-docs -t esp32 esp32s2 esp32c3 esp32s3 esp32h2 esp8266 esp32c2 esp32c6 --project-path src/ \ No newline at end of file diff --git a/setup.cfg b/setup.cfg index bec2ff1..b55d1cf 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = esp-docs -version = 1.2.1 +version = 1.3.0 author = Espressif author_email = marius.vikhammer@espressif.com description = Documentation building package used at Espressif diff --git a/src/esp_docs/build_docs.py b/src/esp_docs/build_docs.py index e819073..bec3049 100755 --- a/src/esp_docs/build_docs.py +++ b/src/esp_docs/build_docs.py @@ -39,7 +39,7 @@ LANGUAGES = ['en', 'zh_CN'] -TARGETS = ['esp8266', 'esp32', 'esp32s2', 'esp32s3', 'esp32c3', 'esp32h2', 'esp32c2'] +TARGETS = ['esp8266', 'esp32', 'esp32s2', 'esp32s3', 'esp32c3', 'esp32h2', 'esp32c2', 'esp32c6'] SPHINX_WARN_LOG = 'sphinx-warning-log.txt' SPHINX_SANITIZED_LOG = 'sphinx-warning-log-sanitized.txt' diff --git a/src/esp_docs/conf_docs.py b/src/esp_docs/conf_docs.py index 8bbf147..3adf140 100644 --- a/src/esp_docs/conf_docs.py +++ b/src/esp_docs/conf_docs.py @@ -350,6 +350,7 @@ def setup_config_values(app, config): 'esp32c3': 'ESP32-C3', 'esp32h2': 'ESP32-H2', 'esp32c2': 'ESP32-C2', + 'esp32c6': 'ESP32-C6', } app.add_config_value('idf_target_title_dict', idf_target_title_dict, 'env') diff --git a/src/esp_docs/esp_extensions/format_esp_target.py b/src/esp_docs/esp_extensions/format_esp_target.py index 7ca715f..d7756b9 100644 --- a/src/esp_docs/esp_extensions/format_esp_target.py +++ b/src/esp_docs/esp_extensions/format_esp_target.py @@ -55,7 +55,7 @@ class StringSubstituter: """ TARGET_NAMES = {'esp8266': 'ESP8266', 'esp32': 'ESP32', 'esp32s2': 'ESP32-S2', 'esp32s3': 'ESP32-S3', 'esp32c3': 'ESP32-C3', 'esp32c2': 'ESP32-C2', - 'esp32h2': 'ESP32-H2'} + 'esp32h2': 'ESP32-H2', 'esp32c6': 'ESP32-C6'} TOOLCHAIN_PREFIX = {'esp8266': 'xtensa-lx106-elf', 'esp32': 'xtensa-esp32-elf', @@ -63,12 +63,13 @@ class StringSubstituter: 'esp32s3': 'xtensa-esp32s3-elf', 'esp32c3': 'riscv32-esp-elf', 'esp32h2': 'riscv32-esp-elf', - 'esp32c2': 'riscv32-esp-elf' + 'esp32c2': 'riscv32-esp-elf', + 'esp32c6': 'riscv32-esp-elf' } CONFIG_PREFIX = {'esp8266': 'esp8266', 'esp32': 'ESP32', 'esp32s2': 'ESP32S2', 'esp32s3': 'ESP32S3', 'esp32c3': 'ESP32C3', 'esp32h2': 'ESP32H2', - 'esp32c2': 'ESP32C2'} + 'esp32c2': 'ESP32C2', 'esp32c6': 'ESP32C6'} TRM_EN_URL = {'esp8266': 'https://www.espressif.com/sites/default/files/documentation/esp8266-technical_reference_en.pdf', 'esp32': 'https://www.espressif.com/sites/default/files/documentation/esp32_technical_reference_manual_en.pdf', @@ -76,7 +77,8 @@ class StringSubstituter: 'esp32c3': 'https://www.espressif.com/sites/default/files/documentation/esp32-c3_technical_reference_manual_en.pdf', 'esp32s3': 'https://www.espressif.com/sites/default/files/documentation/esp32-s3_technical_reference_manual_en.pdf', 'esp32h2': '#', - 'esp32c2': 'https://www.espressif.com/sites/default/files/documentation/esp8684_technical_reference_manual_en.pdf'} + 'esp32c2': 'https://www.espressif.com/sites/default/files/documentation/esp8684_technical_reference_manual_en.pdf', + 'esp32c6': 'https://www.espressif.com/sites/default/files/documentation/esp32-c6_technical_reference_manual_en.pdf'} TRM_CN_URL = {'esp8266': 'https://www.espressif.com/sites/default/files/documentation/esp8266-technical_reference_cn.pdf', 'esp32': 'https://www.espressif.com/sites/default/files/documentation/esp32_technical_reference_manual_cn.pdf', @@ -84,7 +86,8 @@ class StringSubstituter: 'esp32c3': 'https://www.espressif.com/sites/default/files/documentation/esp32-c3_technical_reference_manual_cn.pdf', 'esp32s3': 'https://www.espressif.com/sites/default/files/documentation/esp32-s3_technical_reference_manual_cn.pdf', 'esp32h2': '#', - 'esp32c2': 'https://www.espressif.com/sites/default/files/documentation/esp8684_technical_reference_manual_cn.pdf'} + 'esp32c2': 'https://www.espressif.com/sites/default/files/documentation/esp8684_technical_reference_manual_cn.pdf', + 'esp32c6': 'https://www.espressif.com/sites/default/files/documentation/esp32-c6_technical_reference_manual_cn.pdf'} DATASHEET_EN_URL = {'esp8266': 'https://www.espressif.com/sites/default/files/documentation/0a-esp8266ex_datasheet_en.pdf', 'esp32': 'https://www.espressif.com/sites/default/files/documentation/esp32_datasheet_en.pdf', @@ -92,7 +95,8 @@ class StringSubstituter: 'esp32c3': 'https://www.espressif.com/sites/default/files/documentation/esp32-c3_datasheet_en.pdf', 'esp32s3': 'https://www.espressif.com/sites/default/files/documentation/esp32-s3_datasheet_en.pdf', 'esp32h2': '#', - 'esp32c2': 'https://www.espressif.com/sites/default/files/documentation/esp8684_datasheet_en.pdf'} + 'esp32c2': 'https://www.espressif.com/sites/default/files/documentation/esp8684_datasheet_en.pdf', + 'esp32c6': 'https://www.espressif.com/sites/default/files/documentation/esp32-c6_datasheet_en.pdf'} DATASHEET_CN_URL = {'esp8266': 'https://www.espressif.com/sites/default/files/documentation/0a-esp8266ex_datasheet_cn.pdf', 'esp32': 'https://www.espressif.com/sites/default/files/documentation/esp32_datasheet_cn.pdf', @@ -100,7 +104,8 @@ class StringSubstituter: 'esp32c3': 'https://www.espressif.com/sites/default/files/documentation/esp32-c3_datasheet_cn.pdf', 'esp32s3': 'https://www.espressif.com/sites/default/files/documentation/esp32-s3_datasheet_cn.pdf', 'esp32h2': '#', - 'esp32c2': 'https://www.espressif.com/sites/default/files/documentation/esp8684_datasheet_cn.pdf'} + 'esp32c2': 'https://www.espressif.com/sites/default/files/documentation/esp8684_datasheet_cn.pdf', + 'esp32c6': 'https://www.espressif.com/sites/default/files/documentation/esp32-c6_datasheet_cn.pdf'} RE_PATTERN = re.compile(r'^\s*{IDF_TARGET_(\w+?):(.+?)}', re.MULTILINE) diff --git a/src/esp_docs/idf_extensions/build_system/__init__.py b/src/esp_docs/idf_extensions/build_system/__init__.py index 4c64983..5196339 100644 --- a/src/esp_docs/idf_extensions/build_system/__init__.py +++ b/src/esp_docs/idf_extensions/build_system/__init__.py @@ -16,7 +16,7 @@ project_path = os.path.abspath(os.path.dirname(__file__)) # Targets which needs --preview to build -PREVIEW_TARGETS = ['esp32h2', 'esp32c2'] +PREVIEW_TARGETS = ['esp32h2', 'esp32c2', 'esp32c6'] def setup(app): From 13463bc78f80df5a574ee2e7e9a5500aff67ffed Mon Sep 17 00:00:00 2001 From: Marius Vikhammer Date: Tue, 6 Sep 2022 12:07:34 +0800 Subject: [PATCH 2/2] CI: change jobs to only do shallow clones --- .gitlab-ci.yml | 43 ++++++++++++++++++++----------------------- ci/setup_idf.sh | 29 +++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+), 23 deletions(-) create mode 100755 ci/setup_idf.sh diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ea61e43..8faf741 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -9,14 +9,12 @@ stages: variables: # Versioned esp-idf-doc env image to use for all document building jobs ESP_DOCS_ENV_IMAGE: "$CI_DOCKER_REGISTRY/esp-idf-doc-env-v5.0:2-2" - PYTHON_VER: 3.7.10 ESP_DOCS_PATH: "$CI_PROJECT_DIR" IDF_PATH: $CI_PROJECT_DIR/esp-idf IDF_REPO: ${GITLAB_SSH_SERVER}/espressif/esp-idf.git .before_script_minimal: before_script: - - source ci/setup_python.sh - source ci/utils.sh .before_script_prepare_build: @@ -24,11 +22,10 @@ variables: # Use CI Tools - curl -sSL ${CIT_LOADER_URL} | sh - source citools/import_functions - - source ci/setup_python.sh - source ci/utils.sh # Purge any old esp-docs versions - - pip3 uninstall -y esp-docs - - pip3 install . + - pip uninstall -y esp-docs + - pip install . check_setup: stage: check @@ -36,7 +33,7 @@ check_setup: extends: - .before_script_minimal script: - - pip3 install . + - pip install . check_python_style: stage: check @@ -71,12 +68,6 @@ test_builds: image: $ESP_DOCS_ENV_IMAGE extends: - .before_script_prepare_build - artifacts: - when: always - paths: - - $DOCS_DIR/_build/*/*/html/* - - $DOCS_DIR/_build/*/*/*.txt - expire_in: 4 days build_example_basic: extends: @@ -102,14 +93,17 @@ build_idf_docs_html: variables: DOCS_DIR: $CI_PROJECT_DIR/esp-idf/docs IDF_COMMIT_ID: 7d680980894fbcc1532f6934c1e3a2f0f8181d64 + artifacts: + when: always + paths: + - $DOCS_DIR/_build/*/*/html/* + - $DOCS_DIR/_build/*/*/*.txt + expire_in: 4 days script: # add gitlab ssh key - cit_add_ssh_key "${GITLAB_KEY_PEM}" - - git clone "${IDF_REPO}" - - $ESP_DOCS_PATH/ci/set_repo.sh $IDF_COMMIT_ID $IDF_PATH - - cd $IDF_PATH && tools/idf_tools.py --non-interactive install - - $IDF_PATH/tools/idf_tools.py install-python-env - - eval "$($IDF_PATH/tools/idf_tools.py export)" + - $ESP_DOCS_PATH/ci/setup_idf.sh ${IDF_REPO} $IDF_COMMIT_ID $IDF_PATH $DOCTGT + - eval "$($IDF_PATH/tools/idf_tools.py --non-interactive export)" - pip install $ESP_DOCS_PATH - cd $DOCS_DIR - build-docs --skip-reqs-check -l $DOCLANG -t $DOCTGT @@ -124,14 +118,17 @@ build_idf_docs_pdf: variables: DOCS_DIR: $CI_PROJECT_DIR/esp-idf/docs IDF_COMMIT_ID: 7d680980894fbcc1532f6934c1e3a2f0f8181d64 + artifacts: + when: always + paths: + - $DOCS_DIR/_build/*/*/html/* + - $DOCS_DIR/_build/*/*/*.txt + expire_in: 4 days script: # add gitlab ssh key - cit_add_ssh_key "${GITLAB_KEY_PEM}" - - git clone "${IDF_REPO}" - - $ESP_DOCS_PATH/ci/set_repo.sh $IDF_COMMIT_ID $IDF_PATH - - cd $IDF_PATH && tools/idf_tools.py --non-interactive install - - $IDF_PATH/tools/idf_tools.py install-python-env - - eval "$($IDF_PATH/tools/idf_tools.py export)" + - $ESP_DOCS_PATH/ci/setup_idf.sh ${IDF_REPO} $IDF_COMMIT_ID $IDF_PATH $DOCTGT + - eval "$($IDF_PATH/tools/idf_tools.py --non-interactive export)" - pip install $ESP_DOCS_PATH - cd $DOCS_DIR - build-docs --skip-reqs-check -l $DOCLANG -t $DOCTGT -bs latex @@ -216,5 +213,5 @@ deploy_package: dependencies: - build_package script: - - pip3 install . + - pip install . - python $ESP_DOCS_PATH/ci/deploy_package.py diff --git a/ci/setup_idf.sh b/ci/setup_idf.sh new file mode 100755 index 0000000..51087f2 --- /dev/null +++ b/ci/setup_idf.sh @@ -0,0 +1,29 @@ +#!/usr/bin/env bash + +# $1: repo url +# $2: commit id +# $3: IDF_PATH +# $4: toolchain target + +# sets up the repo incl submodules +set -o errexit # Exit if command failed. + +if [ -z $2 ] || [ -z $1 ] || [ -z $3 ] || [ -z $4 ] ; then + echo "Mandatory variables undefined" + exit 1; +fi; + +# sets up the repo incl submodules with specified version as $2 +echo "Checking out repo $1 with commit $2" +mkdir $3 && cd $3 +git init +git remote add origin $1 +git fetch --depth 1 origin $2 +git checkout FETCH_HEAD + +git submodule init +git submodule update --depth 1 + +# Setup IDF env +tools/idf_tools.py --non-interactive install --targets $4 +tools/idf_tools.py install-python-env