feat(tools): Add pytest build system on Windows runner

This commit is contained in:
Marek Fiala 2023-10-20 10:40:07 +02:00
parent a4ff2decdd
commit 0a3b57e48a
4 changed files with 68 additions and 3 deletions

View File

@ -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

View File

@ -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 #
#################################

View File

@ -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

View File

@ -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)