Skip to content

Commit 050a35f

Browse files
authored
[ci] reduce hard-coding of host architecture (#6395)
1 parent 4466349 commit 050a35f

File tree

3 files changed

+18
-7
lines changed

3 files changed

+18
-7
lines changed

.ci/setup.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
set -e -E -o pipefail
44

5+
ARCH=$(uname -m)
6+
7+
58
if [[ $OS_NAME == "macos" ]]; then
69
if [[ $COMPILER == "clang" ]]; then
710
brew install libomp
@@ -23,7 +26,7 @@ if [[ $OS_NAME == "macos" ]]; then
2326
curl \
2427
-sL \
2528
-o miniforge.sh \
26-
https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-MacOSX-x86_64.sh
29+
https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-MacOSX-${ARCH}.sh
2730
else # Linux
2831
if [[ $IN_UBUNTU_BASE_CONTAINER == "true" ]]; then
2932
# fixes error "unable to initialize frontend: Dialog"
@@ -135,7 +138,6 @@ else # Linux
135138
cmake
136139
fi
137140
if [[ $SETUP_CONDA != "false" ]]; then
138-
ARCH=$(uname -m)
139141
curl \
140142
-sL \
141143
-o miniforge.sh \

.ci/test.sh

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
set -e -E -o pipefail
44

5+
ARCH=$(uname -m)
6+
57
if [[ $OS_NAME == "macos" ]] && [[ $COMPILER == "gcc" ]]; then
68
export CXX=g++-11
79
export CC=gcc-11
@@ -171,14 +173,19 @@ elif [[ $TASK == "bdist" ]]; then
171173
mv \
172174
./dist/*.whl \
173175
./dist/tmp.whl || exit 1
176+
if [[ $ARCH == "x86_64" ]]; then
177+
PLATFORM="macosx_10_15_x86_64.macosx_11_6_x86_64.macosx_12_5_x86_64"
178+
else
179+
echo "ERROR: macos wheels not supported yet on architecture '${ARCH}'"
180+
exit 1
181+
fi
174182
mv \
175183
./dist/tmp.whl \
176-
dist/lightgbm-$LGB_VER-py3-none-macosx_10_15_x86_64.macosx_11_6_x86_64.macosx_12_5_x86_64.whl || exit 1
184+
dist/lightgbm-$LGB_VER-py3-none-$PLATFORM.whl || exit 1
177185
if [[ $PRODUCES_ARTIFACTS == "true" ]]; then
178186
cp dist/lightgbm-$LGB_VER-py3-none-macosx*.whl $BUILD_ARTIFACTSTAGINGDIRECTORY || exit 1
179187
fi
180188
else
181-
ARCH=$(uname -m)
182189
if [[ $ARCH == "x86_64" ]]; then
183190
PLATFORM="manylinux_2_28_x86_64"
184191
else

.ci/test_r_package.sh

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#!/bin/bash
22

3+
ARCH=$(uname -m)
4+
35
# set up R environment
46
CRAN_MIRROR="https://cran.rstudio.com"
57
R_LIB_PATH=~/Rlib
@@ -22,7 +24,7 @@ if [[ "${R_MAJOR_VERSION}" == "3" ]]; then
2224
export R_APT_REPO="bionic-cran35/"
2325
elif [[ "${R_MAJOR_VERSION}" == "4" ]]; then
2426
export R_MAC_VERSION=4.3.1
25-
export R_MAC_PKG_URL=${CRAN_MIRROR}/bin/macosx/big-sur-x86_64/base/R-${R_MAC_VERSION}-x86_64.pkg
27+
export R_MAC_PKG_URL=${CRAN_MIRROR}/bin/macosx/big-sur-${ARCH}/base/R-${R_MAC_VERSION}-${ARCH}.pkg
2628
export R_LINUX_VERSION="4.3.1-1.2204.0"
2729
export R_APT_REPO="jammy-cran40/"
2830
else
@@ -70,11 +72,11 @@ if [[ $OS_NAME == "linux" ]]; then
7072
fi
7173
if [[ $INSTALL_CMAKE_FROM_RELEASES == "true" ]]; then
7274
curl -O -L \
73-
https://github.com/Kitware/CMake/releases/download/v3.25.1/cmake-3.25.1-linux-x86_64.sh \
75+
https://github.com/Kitware/CMake/releases/download/v3.25.1/cmake-3.25.1-linux-${ARCH}.sh \
7476
|| exit 1
7577

7678
sudo mkdir /opt/cmake || exit 1
77-
sudo sh cmake-3.25.1-linux-x86_64.sh --skip-license --prefix=/opt/cmake || exit 1
79+
sudo sh cmake-3.25.1-linux-${ARCH}.sh --skip-license --prefix=/opt/cmake || exit 1
7880
sudo ln -s /opt/cmake/bin/cmake /usr/local/bin/cmake || exit 1
7981
fi
8082
fi

0 commit comments

Comments
 (0)