diff --git a/.gitlab/ci/build.yml b/.gitlab/ci/build.yml index abb077d38a..6cbfa370ca 100644 --- a/.gitlab/ci/build.yml +++ b/.gitlab/ci/build.yml @@ -550,6 +550,38 @@ pytest_build_system_macos: reports: junit: XUNIT_RESULT.xml +.test_build_system_template_win: + stage: host_test + variables: + # Enable ccache for all build jobs. See configure_ci_environment.sh for more ccache related settings. + IDF_CCACHE_ENABLE: "1" + PYTHONPATH: "$PYTHONPATH;$IDF_PATH\\tools;$IDF_PATH\\tools\\esp_app_trace;$IDF_PATH\\components\\partition_table;$IDF_PATH\\tools\\ci\\python_packages" + before_script: [] + after_script: [] + timeout: 4 hours + script: + - .\install.ps1 --enable-ci --enable-pytest + - . .\export.ps1 + - python "${SUBMODULE_FETCH_TOOL}" -s "all" + - cd ${IDF_PATH}\tools\test_build_system + - pytest --junitxml=${CI_PROJECT_DIR}\XUNIT_RESULT.xml + +pytest_build_system_win: + extends: + - .test_build_system_template_win + - .rules:test:windows_pytest_build_system + needs: [] + tags: + - windows-target + artifacts: + paths: + - XUNIT_RESULT.xml + - test_build_system + when: always + expire_in: 2 days + reports: + junit: XUNIT_RESULT.xml + build_docker: extends: - .before_script:minimal diff --git a/.gitlab/ci/dependencies/dependencies.yml b/.gitlab/ci/dependencies/dependencies.yml index 5905f5be9f..e0e0face19 100644 --- a/.gitlab/ci/dependencies/dependencies.yml +++ b/.gitlab/ci/dependencies/dependencies.yml @@ -175,6 +175,12 @@ patterns: - submodule +"test:windows_pytest_build_system": + labels: + - windows + specific_rules: + - if-schedule-test-build-system-windows + ################################# # Triggered Only By Labels Jobs # ################################# diff --git a/.gitlab/ci/rules.yml b/.gitlab/ci/rules.yml index 3fbbeeceeb..f3d65e59ec 100644 --- a/.gitlab/ci/rules.yml +++ b/.gitlab/ci/rules.yml @@ -350,6 +350,9 @@ .if-schedule: &if-schedule if: '$CI_PIPELINE_SOURCE == "schedule"' +.if-schedule-test-build-system-windows: &if-schedule-test-build-system-windows + if: '$CI_PIPELINE_SOURCE == "schedule" && $SCHEDULED_BUILD_SYSTEM_TEST_WIN == "true"' + .if-trigger: &if-trigger if: '$CI_PIPELINE_SOURCE == "trigger"' @@ -561,6 +564,9 @@ .if-label-target_test: &if-label-target_test if: '$BOT_LABEL_TARGET_TEST || $CI_MERGE_REQUEST_LABELS =~ /^(?:[^,\n\r]+,)*target_test(?:,[^,\n\r]+)*$/i' +.if-label-windows: &if-label-windows + if: '$BOT_LABEL_WINDOWS || $CI_MERGE_REQUEST_LABELS =~ /^(?:[^,\n\r]+,)*windows(?:,[^,\n\r]+)*$/i' + .rules:build: rules: - <<: *if-revert-branch @@ -2574,3 +2580,13 @@ - <<: *if-label-submodule - <<: *if-dev-push changes: *patterns-submodule + +.rules:test:windows_pytest_build_system: + rules: + - <<: *if-revert-branch + when: never + - <<: *if-protected + - <<: *if-label-build-only + when: never + - <<: *if-schedule-test-build-system-windows + - <<: *if-label-windows diff --git a/tools/ci/python_packages/gitlab_api.py b/tools/ci/python_packages/gitlab_api.py index b9f3d326ce..1482ddd52f 100644 --- a/tools/ci/python_packages/gitlab_api.py +++ b/tools/ci/python_packages/gitlab_api.py @@ -4,6 +4,7 @@ import argparse import logging import os import re +import sys import tarfile import tempfile import time @@ -230,9 +231,19 @@ class Gitlab(object): @staticmethod def decompress_archive(path: str, destination: str) -> str: - with tarfile.open(path, 'r') as archive_file: - root_name = archive_file.getnames()[0] - archive_file.extractall(destination) + full_destination = os.path.abspath(destination) + # By default max path lenght is set to 260 characters + # Prefix `\\?\` extends it to 32,767 characters + if sys.platform == 'win32': + full_destination = '\\\\?\\' + full_destination + + try: + with tarfile.open(path, 'r') as archive_file: + root_name = archive_file.getnames()[0] + archive_file.extractall(full_destination) + except tarfile.TarError as e: + logging.error(f'Error while decompressing archive {path}') + raise e return os.path.join(os.path.realpath(destination), root_name)