diff --git a/.ci/setup.sh b/.ci/setup.sh index 7fe54db9c2fc..3fd3356e34d7 100755 --- a/.ci/setup.sh +++ b/.ci/setup.sh @@ -14,7 +14,7 @@ if [[ $OS_NAME == "macos" ]]; then if [[ $COMPILER == "clang" ]]; then brew install libomp if [[ $AZURE == "true" ]]; then - sudo xcode-select -s /Applications/Xcode_11.7.app/Contents/Developer || exit 1 + sudo xcode-select -s /Applications/Xcode_13.1.0.app/Contents/Developer || exit 1 fi else # gcc # Check https://github.com/actions/runner-images/tree/main/images/macos for available diff --git a/.ci/test.sh b/.ci/test.sh index 4f3de6a6f1ea..d950f01e989f 100755 --- a/.ci/test.sh +++ b/.ci/test.sh @@ -29,6 +29,19 @@ if [[ $IN_UBUNTU_BASE_CONTAINER == "true" ]]; then export LC_ALL="en_US.UTF-8" fi +# Setting MACOSX_DEPLOYMENT_TARGET prevents CMake from building against too-new +# macOS features, and helps tools like Python build tools determine the appropriate +# wheel compatibility tags. +# +# ref: +# * https://cmake.org/cmake/help/latest/envvar/MACOSX_DEPLOYMENT_TARGET.html +# * https://github.com/scikit-build/scikit-build-core/blob/acb7d0346e4a05bcb47a4ea3939c705ab71e3145/src/scikit_build_core/builder/macos.py#L36 +if [[ $ARCH == "x86_64" ]]; then + export MACOSX_DEPLOYMENT_TARGET=10.15 +else + export MACOSX_DEPLOYMENT_TARGET=12.0 +fi + if [[ "${TASK}" == "r-package" ]] || [[ "${TASK}" == "r-rchk" ]]; then bash ${BUILD_DIRECTORY}/.ci/test_r_package.sh || exit 1 exit 0 @@ -168,17 +181,6 @@ elif [[ $TASK == "bdist" ]]; then if [[ $OS_NAME == "macos" ]]; then cd $BUILD_DIRECTORY && sh ./build-python.sh bdist_wheel || exit 1 sh $BUILD_DIRECTORY/.ci/check_python_dists.sh $BUILD_DIRECTORY/dist || exit 1 - mv \ - ./dist/*.whl \ - ./dist/tmp.whl || exit 1 - if [[ $ARCH == "x86_64" ]]; then - PLATFORM="macosx_10_15_x86_64.macosx_11_6_x86_64.macosx_12_5_x86_64" - else - PLATFORM="macosx_14_0_arm64" - fi - mv \ - ./dist/tmp.whl \ - dist/lightgbm-$LGB_VER-py3-none-$PLATFORM.whl || exit 1 if [[ $PRODUCES_ARTIFACTS == "true" ]]; then cp dist/lightgbm-$LGB_VER-py3-none-macosx*.whl $BUILD_ARTIFACTSTAGINGDIRECTORY || exit 1 fi diff --git a/.vsts-ci.yml b/.vsts-ci.yml index 9b440cb9fac1..2b1cdaa4058c 100644 --- a/.vsts-ci.yml +++ b/.vsts-ci.yml @@ -254,7 +254,7 @@ jobs: OS_NAME: 'macos' PRODUCES_ARTIFACTS: 'true' pool: - vmImage: 'macOS-11' + vmImage: 'macOS-12' strategy: matrix: regular: