Skip to content

Commit

Permalink
[ci] reduce hard-coding of host architecture (#6395)
Browse files Browse the repository at this point in the history
  • Loading branch information
jameslamb authored Apr 20, 2024
1 parent 4466349 commit 050a35f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
6 changes: 4 additions & 2 deletions .ci/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

set -e -E -o pipefail

ARCH=$(uname -m)


if [[ $OS_NAME == "macos" ]]; then
if [[ $COMPILER == "clang" ]]; then
brew install libomp
Expand All @@ -23,7 +26,7 @@ if [[ $OS_NAME == "macos" ]]; then
curl \
-sL \
-o miniforge.sh \
https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-MacOSX-x86_64.sh
https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-MacOSX-${ARCH}.sh
else # Linux
if [[ $IN_UBUNTU_BASE_CONTAINER == "true" ]]; then
# fixes error "unable to initialize frontend: Dialog"
Expand Down Expand Up @@ -135,7 +138,6 @@ else # Linux
cmake
fi
if [[ $SETUP_CONDA != "false" ]]; then
ARCH=$(uname -m)
curl \
-sL \
-o miniforge.sh \
Expand Down
11 changes: 9 additions & 2 deletions .ci/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

set -e -E -o pipefail

ARCH=$(uname -m)

if [[ $OS_NAME == "macos" ]] && [[ $COMPILER == "gcc" ]]; then
export CXX=g++-11
export CC=gcc-11
Expand Down Expand Up @@ -171,14 +173,19 @@ elif [[ $TASK == "bdist" ]]; then
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
echo "ERROR: macos wheels not supported yet on architecture '${ARCH}'"
exit 1
fi
mv \
./dist/tmp.whl \
dist/lightgbm-$LGB_VER-py3-none-macosx_10_15_x86_64.macosx_11_6_x86_64.macosx_12_5_x86_64.whl || exit 1
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
else
ARCH=$(uname -m)
if [[ $ARCH == "x86_64" ]]; then
PLATFORM="manylinux_2_28_x86_64"
else
Expand Down
8 changes: 5 additions & 3 deletions .ci/test_r_package.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/bash

ARCH=$(uname -m)

# set up R environment
CRAN_MIRROR="https://cran.rstudio.com"
R_LIB_PATH=~/Rlib
Expand All @@ -22,7 +24,7 @@ if [[ "${R_MAJOR_VERSION}" == "3" ]]; then
export R_APT_REPO="bionic-cran35/"
elif [[ "${R_MAJOR_VERSION}" == "4" ]]; then
export R_MAC_VERSION=4.3.1
export R_MAC_PKG_URL=${CRAN_MIRROR}/bin/macosx/big-sur-x86_64/base/R-${R_MAC_VERSION}-x86_64.pkg
export R_MAC_PKG_URL=${CRAN_MIRROR}/bin/macosx/big-sur-${ARCH}/base/R-${R_MAC_VERSION}-${ARCH}.pkg
export R_LINUX_VERSION="4.3.1-1.2204.0"
export R_APT_REPO="jammy-cran40/"
else
Expand Down Expand Up @@ -70,11 +72,11 @@ if [[ $OS_NAME == "linux" ]]; then
fi
if [[ $INSTALL_CMAKE_FROM_RELEASES == "true" ]]; then
curl -O -L \
https://github.com/Kitware/CMake/releases/download/v3.25.1/cmake-3.25.1-linux-x86_64.sh \
https://github.com/Kitware/CMake/releases/download/v3.25.1/cmake-3.25.1-linux-${ARCH}.sh \
|| exit 1

sudo mkdir /opt/cmake || exit 1
sudo sh cmake-3.25.1-linux-x86_64.sh --skip-license --prefix=/opt/cmake || exit 1
sudo sh cmake-3.25.1-linux-${ARCH}.sh --skip-license --prefix=/opt/cmake || exit 1
sudo ln -s /opt/cmake/bin/cmake /usr/local/bin/cmake || exit 1
fi
fi
Expand Down

0 comments on commit 050a35f

Please sign in to comment.