Skip to content

Commit

Permalink
[ci] [python-package] run macOS x86_64 tests on macOS 12 (Monterey), …
Browse files Browse the repository at this point in the history
…stop manually setting macOS wheel tags (#6487)
  • Loading branch information
jameslamb committed Jun 17, 2024
1 parent d56a7a3 commit 7cb1892
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .ci/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
24 changes: 13 additions & 11 deletions .ci/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .vsts-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ jobs:
OS_NAME: 'macos'
PRODUCES_ARTIFACTS: 'true'
pool:
vmImage: 'macOS-11'
vmImage: 'macOS-12'
strategy:
matrix:
regular:
Expand Down

0 comments on commit 7cb1892

Please sign in to comment.