From fa776a7d5071f2ff80f354a95dacf4c6b44ce718 Mon Sep 17 00:00:00 2001 From: Fu Hanxi Date: Wed, 19 Nov 2025 10:54:26 +0100 Subject: [PATCH] ci: move host test jobs into host-test.yml --- .gitlab/ci/build.yml | 132 ------------------------ .gitlab/ci/host-test.yml | 213 ++++++++++++++++++++++++++++++++------- 2 files changed, 174 insertions(+), 171 deletions(-) diff --git a/.gitlab/ci/build.yml b/.gitlab/ci/build.yml index 7070e3d38d..abee0d6a8f 100644 --- a/.gitlab/ci/build.yml +++ b/.gitlab/ci/build.yml @@ -110,138 +110,6 @@ build_clang_test_apps_riscv: matrix: - IDF_TARGET: [esp32c3, esp32c2, esp32c6, esp32c5, esp32h2, esp32p4] -###################### -# Build System Tests # -###################### -.test_build_system_template: - stage: host_test - extends: - - .build_template - - .rules:build:check - dependencies: # set dependencies to null to avoid missing artifacts issue - needs: - - job: fast_template_app - artifacts: false - optional: true - artifacts: - reports: - junit: XUNIT_RESULT.xml - paths: - - XUNIT_RESULT.xml - - test_build_system - expire_in: 1 week - when: always - script: - - ${IDF_PATH}/tools/ci/test_configure_ci_environment.sh - - cd ${IDF_PATH}/tools/test_build_system - - run_cmd idf-ci gitlab download-known-failure-cases-file ${KNOWN_FAILURE_CASES_FILE_NAME} - - pytest - --cleanup-idf-copy - --parallel-count ${CI_NODE_TOTAL:-1} - --parallel-index ${CI_NODE_INDEX:-1} - --work-dir ${CI_PROJECT_DIR}/test_build_system - --junitxml ${CI_PROJECT_DIR}/XUNIT_RESULT.xml - --ignore-result-files ${KNOWN_FAILURE_CASES_FILE_NAME} - -.test_build_system_minimal_cmake_template: - extends: .test_build_system_template - variables: - INSTALL_EXTRA_TOOLS: cmake@3.22.1 - script: - - MINIMAL_SUPPORTED_CMAKE_VERSION=$(echo "${INSTALL_EXTRA_TOOLS}" | sed -n 's/.*cmake@\([0-9.]*\).*/\1/p') - - export PATH=$(echo "$PATH" | sed -E "s|/tools/cmake/[0-9.]+|/tools/cmake/${MINIMAL_SUPPORTED_CMAKE_VERSION}|") - - ACTUAL_CMAKE_VERSION=$(cmake --version | head -n1 | awk '{print $3}') - - | - if [ "${ACTUAL_CMAKE_VERSION}" != "${MINIMAL_SUPPORTED_CMAKE_VERSION}" ]; then - echo "ERROR: Wrong minimal CMake version! Detected: ${ACTUAL_CMAKE_VERSION}, but should be: ${MINIMAL_SUPPORTED_CMAKE_VERSION}" - exit 1 - fi - - ${IDF_PATH}/tools/ci/test_configure_ci_environment.sh - - cd ${IDF_PATH}/tools/test_build_system - - run_cmd idf-ci gitlab download-known-failure-cases-file ${KNOWN_FAILURE_CASES_FILE_NAME} - - pytest - -k cmake - --cleanup-idf-copy - --parallel-count ${CI_NODE_TOTAL:-1} - --parallel-index ${CI_NODE_INDEX:-1} - --work-dir ${CI_PROJECT_DIR}/test_build_system - --junitxml ${CI_PROJECT_DIR}/XUNIT_RESULT.xml - --ignore-result-files ${KNOWN_FAILURE_CASES_FILE_NAME} - -pytest_build_system: - extends: .test_build_system_template - parallel: 3 - -pytest_buildv2_system: - extends: - - .test_build_system_template - - .rules:labels:buildv2 - parallel: 3 - script: - - ${IDF_PATH}/tools/ci/test_configure_ci_environment.sh - - cd ${IDF_PATH}/tools/test_build_system - - run_cmd idf-ci gitlab download-known-failure-cases-file ${KNOWN_FAILURE_CASES_FILE_NAME} - - pytest - --buildv2 - --cleanup-idf-copy - --parallel-count ${CI_NODE_TOTAL:-1} - --parallel-index ${CI_NODE_INDEX:-1} - --work-dir ${CI_PROJECT_DIR}/test_build_system - --junitxml ${CI_PROJECT_DIR}/XUNIT_RESULT.xml - --ignore-result-files ${KNOWN_FAILURE_CASES_FILE_NAME} - -- - test_non_default_target.py - test_component_manager.py - test_build.py - test_bootloader.py - test_git.py - test_kconfig.py - test_partition.py - test_reproducible_build.py - test_sdkconfig.py - test_versions.py - test_common.py - test_components.py - test_cmake.py - test_idf_extension.py - test_rebuild.py - -pytest_build_system_macos: - extends: - - .test_build_system_template - - .brew-macos-settings - - .rules:build:macos - parallel: 3 - -pytest_build_system_minimal_cmake: - extends: .test_build_system_minimal_cmake_template - -pytest_build_system_macos_minimal_cmake: - extends: - - .test_build_system_minimal_cmake_template - - .brew-macos-settings - - .rules:build:macos - variables: - INSTALL_EXTRA_TOOLS: ninja cmake@3.22.1 - -build_docker: - extends: - - .before_script:minimal - - .rules:build:docker - stage: host_test - needs: [] - image: espressif/docker-builder:1 - tags: [shiny, dind] - variables: - DOCKER_TMP_IMAGE_NAME: "idf_tmp_image" - script: - - export DOCKER_BUILD_ARGS="--build-arg IDF_CLONE_URL=${CI_REPOSITORY_URL} --build-arg IDF_CLONE_BRANCH_OR_TAG=${CI_COMMIT_REF_NAME} --build-arg IDF_CHECKOUT_REF=${CI_COMMIT_TAG:-$CI_COMMIT_SHA} --build-arg IDF_CLONE_SHALLOW=1 --build-arg IDF_GITHUB_ASSETS=${INTERNAL_GITHUB_ASSETS}" - - docker build --tag ${DOCKER_TMP_IMAGE_NAME} ${DOCKER_BUILD_ARGS} tools/docker/ - # We can't mount $PWD/examples/get-started/blink into the container, see https://gitlab.com/gitlab-org/gitlab-ce/issues/41227. - # The workaround mentioned there works, but leaves around directories which need to be cleaned up manually. - # Therefore, build a copy of the example located inside the container. - - docker run --rm --workdir /opt/esp/idf/examples/get-started/blink ${DOCKER_TMP_IMAGE_NAME} idf.py build - #################### # Dynamic Pipeline # #################### diff --git a/.gitlab/ci/host-test.yml b/.gitlab/ci/host-test.yml index 762e2d285a..58b990448a 100644 --- a/.gitlab/ci/host-test.yml +++ b/.gitlab/ci/host-test.yml @@ -258,6 +258,75 @@ test_gen_soc_caps_kconfig: - cd ${IDF_PATH}/tools/gen_soc_caps_kconfig/ - ./test/test_gen_soc_caps_kconfig.py +test_idf_build_apps_load_soc_caps: + extends: .host_test_template + script: + - python tools/ci/check_soc_headers_load_in_idf_build_apps.py + +test_nvs_gen_check: + extends: .host_test_template + artifacts: + paths: + - XUNIT_RESULT.xml + - components/nvs_flash/nvs_partition_tool + reports: + junit: XUNIT_RESULT.xml + variables: + LC_ALL: C.UTF-8 + script: + - cd ${IDF_PATH}/components/nvs_flash/nvs_partition_tool + - pytest --noconftest test_nvs_gen_check.py --junitxml=XUNIT_RESULT.xml + +test_esp_rom: + extends: .host_test_template + artifacts: + paths: + - XUNIT_RESULT.xml + reports: + junit: XUNIT_RESULT.xml + script: + - cd ${IDF_PATH}/components/esp_rom/ + - pytest --noconftest test_esp_rom.py --junitxml=XUNIT_RESULT.xml + +make_sure_soc_caps_compatible_in_idf_build_apps: + extends: + - .host_test_template + - .rules:dev-push + artifacts: + paths: + - new.json + - base.json + when: always + when: manual + script: + - python tools/ci/idf_build_apps_dump_soc_caps.py new.json + - git fetch --depth=1 origin $CI_MERGE_REQUEST_DIFF_BASE_SHA + - git checkout -f $CI_MERGE_REQUEST_DIFF_BASE_SHA + - git checkout $CI_COMMIT_SHA -- tools/ci/idf_build_apps_dump_soc_caps.py + - python tools/ci/idf_build_apps_dump_soc_caps.py base.json + - diff new.json base.json + +build_docker: + extends: + - .before_script:minimal + - .rules:build:docker + stage: host_test + needs: [] + image: espressif/docker-builder:1 + tags: [shiny, dind] + variables: + DOCKER_TMP_IMAGE_NAME: "idf_tmp_image" + script: + - export DOCKER_BUILD_ARGS="--build-arg IDF_CLONE_URL=${CI_REPOSITORY_URL} --build-arg IDF_CLONE_BRANCH_OR_TAG=${CI_COMMIT_REF_NAME} --build-arg IDF_CHECKOUT_REF=${CI_COMMIT_TAG:-$CI_COMMIT_SHA} --build-arg IDF_CLONE_SHALLOW=1 --build-arg IDF_GITHUB_ASSETS=${INTERNAL_GITHUB_ASSETS}" + - docker build --tag ${DOCKER_TMP_IMAGE_NAME} ${DOCKER_BUILD_ARGS} tools/docker/ + # We can't mount $PWD/examples/get-started/blink into the container, see https://gitlab.com/gitlab-org/gitlab-ce/issues/41227. + # The workaround mentioned there works, but leaves around directories which need to be cleaned up manually. + # Therefore, build a copy of the example located inside the container. + - docker run --rm --workdir /opt/esp/idf/examples/get-started/blink ${DOCKER_TMP_IMAGE_NAME} idf.py build + +############################ +# Host test with test apps # +############################ test_pytest_qemu: extends: - .host_test_template @@ -344,50 +413,116 @@ test_pytest_macos: --junitxml=XUNIT_RESULT.xml --ignore-result-files ${KNOWN_FAILURE_CASES_FILE_NAME} -test_idf_build_apps_load_soc_caps: - extends: .host_test_template - script: - - python tools/ci/check_soc_headers_load_in_idf_build_apps.py - -test_nvs_gen_check: - extends: .host_test_template +###################### +# Build System Tests # +###################### +.test_build_system_template: + stage: host_test + extends: + - .build_template + - .rules:build:check + dependencies: # set dependencies to null to avoid missing artifacts issue + needs: + - job: fast_template_app + artifacts: false + optional: true artifacts: - paths: - - XUNIT_RESULT.xml - - components/nvs_flash/nvs_partition_tool reports: junit: XUNIT_RESULT.xml + paths: + - XUNIT_RESULT.xml + - test_build_system + expire_in: 1 week + when: always + script: + - ${IDF_PATH}/tools/ci/test_configure_ci_environment.sh + - cd ${IDF_PATH}/tools/test_build_system + - run_cmd idf-ci gitlab download-known-failure-cases-file ${KNOWN_FAILURE_CASES_FILE_NAME} + - pytest + --cleanup-idf-copy + --parallel-count ${CI_NODE_TOTAL:-1} + --parallel-index ${CI_NODE_INDEX:-1} + --work-dir ${CI_PROJECT_DIR}/test_build_system + --junitxml ${CI_PROJECT_DIR}/XUNIT_RESULT.xml + --ignore-result-files ${KNOWN_FAILURE_CASES_FILE_NAME} + +.test_build_system_minimal_cmake_template: + extends: .test_build_system_template variables: - LC_ALL: C.UTF-8 + INSTALL_EXTRA_TOOLS: cmake@3.22.1 script: - - cd ${IDF_PATH}/components/nvs_flash/nvs_partition_tool - - pytest --noconftest test_nvs_gen_check.py --junitxml=XUNIT_RESULT.xml + - MINIMAL_SUPPORTED_CMAKE_VERSION=$(echo "${INSTALL_EXTRA_TOOLS}" | sed -n 's/.*cmake@\([0-9.]*\).*/\1/p') + - export PATH=$(echo "$PATH" | sed -E "s|/tools/cmake/[0-9.]+|/tools/cmake/${MINIMAL_SUPPORTED_CMAKE_VERSION}|") + - ACTUAL_CMAKE_VERSION=$(cmake --version | head -n1 | awk '{print $3}') + - | + if [ "${ACTUAL_CMAKE_VERSION}" != "${MINIMAL_SUPPORTED_CMAKE_VERSION}" ]; then + echo "ERROR: Wrong minimal CMake version! Detected: ${ACTUAL_CMAKE_VERSION}, but should be: ${MINIMAL_SUPPORTED_CMAKE_VERSION}" + exit 1 + fi + - ${IDF_PATH}/tools/ci/test_configure_ci_environment.sh + - cd ${IDF_PATH}/tools/test_build_system + - run_cmd idf-ci gitlab download-known-failure-cases-file ${KNOWN_FAILURE_CASES_FILE_NAME} + - pytest + -k cmake + --cleanup-idf-copy + --parallel-count ${CI_NODE_TOTAL:-1} + --parallel-index ${CI_NODE_INDEX:-1} + --work-dir ${CI_PROJECT_DIR}/test_build_system + --junitxml ${CI_PROJECT_DIR}/XUNIT_RESULT.xml + --ignore-result-files ${KNOWN_FAILURE_CASES_FILE_NAME} -test_esp_rom: - extends: .host_test_template - artifacts: - paths: - - XUNIT_RESULT.xml - reports: - junit: XUNIT_RESULT.xml +pytest_build_system: + extends: .test_build_system_template + parallel: 3 + +pytest_buildv2_system: + extends: + - .test_build_system_template + - .rules:labels:buildv2 + parallel: 3 script: - - cd ${IDF_PATH}/components/esp_rom/ - - pytest --noconftest test_esp_rom.py --junitxml=XUNIT_RESULT.xml + - ${IDF_PATH}/tools/ci/test_configure_ci_environment.sh + - cd ${IDF_PATH}/tools/test_build_system + - run_cmd idf-ci gitlab download-known-failure-cases-file ${KNOWN_FAILURE_CASES_FILE_NAME} + - pytest + --buildv2 + --cleanup-idf-copy + --parallel-count ${CI_NODE_TOTAL:-1} + --parallel-index ${CI_NODE_INDEX:-1} + --work-dir ${CI_PROJECT_DIR}/test_build_system + --junitxml ${CI_PROJECT_DIR}/XUNIT_RESULT.xml + --ignore-result-files ${KNOWN_FAILURE_CASES_FILE_NAME} + -- + test_non_default_target.py + test_component_manager.py + test_build.py + test_bootloader.py + test_git.py + test_kconfig.py + test_partition.py + test_reproducible_build.py + test_sdkconfig.py + test_versions.py + test_common.py + test_components.py + test_cmake.py + test_idf_extension.py + test_rebuild.py -make_sure_soc_caps_compatible_in_idf_build_apps: - extends: - - .host_test_template - - .rules:dev-push - artifacts: - paths: - - new.json - - base.json - when: always - when: manual - script: - - python tools/ci/idf_build_apps_dump_soc_caps.py new.json - - git fetch --depth=1 origin $CI_MERGE_REQUEST_DIFF_BASE_SHA - - git checkout -f $CI_MERGE_REQUEST_DIFF_BASE_SHA - - git checkout $CI_COMMIT_SHA -- tools/ci/idf_build_apps_dump_soc_caps.py - - python tools/ci/idf_build_apps_dump_soc_caps.py base.json - - diff new.json base.json +pytest_build_system_macos: + extends: + - .test_build_system_template + - .brew-macos-settings + - .rules:build:macos + parallel: 3 + +pytest_build_system_minimal_cmake: + extends: .test_build_system_minimal_cmake_template + +pytest_build_system_macos_minimal_cmake: + extends: + - .test_build_system_minimal_cmake_template + - .brew-macos-settings + - .rules:build:macos + variables: + INSTALL_EXTRA_TOOLS: ninja cmake@3.22.1