feat(ci): Migrate macOS runners to Parallels VM

This commit is contained in:
Peter Macko
2025-05-22 17:50:20 +02:00
parent a2257490d2
commit c205f50f93
6 changed files with 16 additions and 9 deletions

View File

@ -231,13 +231,18 @@ pytest_build_system_macos:
- .after_script:build:macos:upload-failed-job-logs:ccache-show-stats - .after_script:build:macos:upload-failed-job-logs:ccache-show-stats
- .rules:build:macos - .rules:build:macos
tags: tags:
- macos_shell - macos
parallel: 3 parallel: 3
variables: variables:
PYENV_VERSION: "3.9" PYENV_VERSION: "3.9"
# CCACHE_DIR: "/cache/idf_ccache". On macOS, you cannot write to this folder due to insufficient permissions. # CCACHE_DIR: "/cache/idf_ccache". On macOS, you cannot write to this folder due to insufficient permissions.
CCACHE_DIR: "" # ccache will use "$HOME/Library/Caches/ccache". CCACHE_DIR: "" # ccache will use "$HOME/Library/Caches/ccache".
CCACHE_MAXSIZE: "5G" # To preserve the limited Macbook storage. CCACHE automatically prunes old caches to fit the set limit. CCACHE_MAXSIZE: "5G" # To preserve the limited Macbook storage. CCACHE automatically prunes old caches to fit the set limit.
# Workaround for a bug in Parallels executor where CI_PROJECT_DIR is not an absolute path,
# but a relative path to the build directory (builds/espressif/esp-idf instead of ~/builds/espressif/esp-idf.
# GitLab sets the project dir to this template `<builds_dir>/<namespace>/<project_name>`
IDF_PATH: "/Users/espressif/builds/espressif/esp-idf"
build_docker: build_docker:
extends: extends:
- .before_script:minimal - .before_script:minimal

View File

@ -243,8 +243,6 @@ variables:
# Ensure pyenv and PYENV_VERSION installed # Ensure pyenv and PYENV_VERSION installed
- eval "$(pyenv init -)" - eval "$(pyenv init -)"
- *common-before_scripts - *common-before_scripts
# On macOS, these tools need to be installed
- export IDF_TOOLS_PATH="${HOME}/.espressif_runner_${CI_RUNNER_ID}_${CI_CONCURRENT_ID}"
# remove idf-env.json, since it may contains enabled "features" # remove idf-env.json, since it may contains enabled "features"
- rm -f $IDF_TOOLS_PATH/idf-env.json - rm -f $IDF_TOOLS_PATH/idf-env.json
# This adds tools (compilers) and the version-specific Python environment to PATH # This adds tools (compilers) and the version-specific Python environment to PATH

View File

@ -348,7 +348,7 @@ test_pytest_macos:
- .host_test_template - .host_test_template
- .before_script:build:macos - .before_script:build:macos
tags: tags:
- macos_shell - macos
artifacts: artifacts:
paths: paths:
- XUNIT_RESULT.xml - XUNIT_RESULT.xml
@ -359,18 +359,22 @@ test_pytest_macos:
variables: variables:
PYENV_VERSION: "3.9" PYENV_VERSION: "3.9"
PYTEST_IGNORE_COLLECT_IMPORT_ERROR: "1" PYTEST_IGNORE_COLLECT_IMPORT_ERROR: "1"
# Workaround for a bug in Parallels executor where CI_PROJECT_DIR is not an absolute path,
# but a relative path to the build directory (builds/espressif/esp-idf instead of ~/builds/espressif/esp-idf.
# GitLab sets the project dir to this template `<builds_dir>/<namespace>/<project_name>`
IDF_PATH: "/Users/espressif/builds/espressif/esp-idf"
script: script:
- run_cmd python tools/ci/ci_build_apps.py components examples tools/test_apps -v - run_cmd python tools/ci/ci_build_apps.py components examples tools/test_apps -v
--target linux --target linux
--pytest-apps --pytest-apps
-m \"host_test and macos_shell\" -m \"host_test and macos\"
--collect-app-info "list_job_${CI_JOB_NAME_SLUG}.txt" --collect-app-info "list_job_${CI_JOB_NAME_SLUG}.txt"
--modified-components ${MR_MODIFIED_COMPONENTS} --modified-components ${MR_MODIFIED_COMPONENTS}
--modified-files ${MR_MODIFIED_FILES} --modified-files ${MR_MODIFIED_FILES}
- python tools/ci/get_known_failure_cases_file.py - python tools/ci/get_known_failure_cases_file.py
- run_cmd pytest - run_cmd pytest
--target linux --target linux
-m \"host_test and macos_shell\" -m \"host_test and macos\"
--junitxml=XUNIT_RESULT.xml --junitxml=XUNIT_RESULT.xml
--ignore-result-files ${KNOWN_FAILURE_CASES_FILE_NAME} --ignore-result-files ${KNOWN_FAILURE_CASES_FILE_NAME}
--app-info-filepattern \"list_job_*.txt\" --app-info-filepattern \"list_job_*.txt\"

View File

@ -25,7 +25,7 @@ def test_hello_world_linux(dut: IdfDut) -> None:
@pytest.mark.host_test @pytest.mark.host_test
@pytest.mark.macos_shell @pytest.mark.macos
@idf_parametrize('target', ['linux'], indirect=['target']) @idf_parametrize('target', ['linux'], indirect=['target'])
def test_hello_world_macos(dut: IdfDut) -> None: def test_hello_world_macos(dut: IdfDut) -> None:
dut.expect('Hello world!') dut.expect('Hello world!')

View File

@ -35,7 +35,7 @@ fi
# https://ccache.dev/manual/latest.html#_configuring_ccache # https://ccache.dev/manual/latest.html#_configuring_ccache
# Set ccache base directory to the project checkout path, to cancel out differences between runners # Set ccache base directory to the project checkout path, to cancel out differences between runners
export CCACHE_BASEDIR="${CI_PROJECT_DIR}" export CCACHE_BASEDIR="${IDF_PATH}"
# host mapping volume to share ccache fbetween runner concurrent jobs # host mapping volume to share ccache fbetween runner concurrent jobs
export CCACHE_SLOPPINESS="time_macros" export CCACHE_SLOPPINESS="time_macros"

View File

@ -63,7 +63,7 @@ SPECIAL_MARKERS = {
ENV_MARKERS = { ENV_MARKERS = {
# special markers # special markers
'qemu': 'build and test using qemu, not real target', 'qemu': 'build and test using qemu, not real target',
'macos_shell': 'tests should be run on macos hosts', 'macos': 'tests should be run on macos hosts',
# single-dut markers # single-dut markers
'generic': 'tests should be run on generic runners', 'generic': 'tests should be run on generic runners',
'flash_suspend': 'support flash suspend feature', 'flash_suspend': 'support flash suspend feature',