Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 22 additions & 6 deletions .ci/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,17 @@ if [[ $OS_NAME == "macos" ]]; then
-o miniforge.sh \
https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-MacOSX-x86_64.sh
else # Linux
# Ensure CA certificates are available for HTTPS
sudo apt-get update
sudo apt-get install --no-install-recommends -y ca-certificates
sudo update-ca-certificates

# Always install cmake, build-essential, and compiler (needed for local testing with act)
sudo apt-get install --no-install-recommends -y cmake build-essential
if [[ $COMPILER == "clang" ]]; then
sudo apt-get install --no-install-recommends -y clang libomp-dev
fi

if [[ $IN_UBUNTU_LATEST_CONTAINER == "true" ]]; then
# fixes error "unable to initialize frontend: Dialog"
# https://github.com/moby/moby/issues/27988#issuecomment-462809153
Expand All @@ -41,8 +52,8 @@ else # Linux
iputils-ping \
jq \
libcurl4 \
libicu66 \
libssl1.1 \
libicu74 \
libssl3 \
libunwind8 \
locales \
netcat \
Expand Down Expand Up @@ -97,17 +108,22 @@ else # Linux
fi
if [[ $SETUP_CONDA != "false" ]]; then
ARCH=$(uname -m)
# Note: -k flag used for local testing with act (SSL cert issues in Docker)
# GitHub Actions doesn't need this flag
curl \
-sL \
-fsSLk \
-o miniforge.sh \
https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Linux-${ARCH}.sh
https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Linux-${ARCH}.sh \
|| { echo "Failed to download miniforge"; exit 1; }
fi
fi

if [[ "${TASK}" != "r-package" ]] && [[ "${TASK}" != "r-rchk" ]]; then
if [[ $SETUP_CONDA != "false" ]]; then
sh miniforge.sh -b -p $CONDA
# Add conda to PATH so subsequent commands work
export PATH="$CONDA/bin:$PATH"
conda config --set always_yes yes --set changeps1 no
conda update -q -y conda
fi
conda config --set always_yes yes --set changeps1 no
conda update -q -y conda
fi
31 changes: 19 additions & 12 deletions .ci/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,19 @@ fi
conda create -q -y -n $CONDA_ENV python=$PYTHON_VERSION
source activate $CONDA_ENV

conda install -q -y -n $CONDA_ENV cmake

echo "Python: $(which python)"
echo "CMake: $(which cmake)"
cmake --version


cd $BUILD_DIRECTORY

if [[ $TASK == "check-docs" ]] || [[ $TASK == "check-links" ]]; then
cd $BUILD_DIRECTORY/docs
conda install -q -y -n $CONDA_ENV -c conda-forge doxygen rstcheck
pip install --user -r requirements.txt
pip install -r requirements.txt
# check reStructuredText formatting
cd $BUILD_DIRECTORY/python-package
rstcheck --report warning `find . -type f -name "*.rst"` || exit -1
Expand All @@ -39,7 +46,7 @@ if [[ $TASK == "check-docs" ]] || [[ $TASK == "check-links" ]]; then
make html || exit -1
if [[ $TASK == "check-links" ]]; then
# check docs for broken links
pip install --user linkchecker
pip install linkchecker
linkchecker --config=.linkcheckerrc ./_build/html/*.html || exit -1
exit 0
fi
Expand All @@ -63,7 +70,7 @@ if [[ $TASK == "lint" ]]; then
libxml2 \
"r-xfun>=0.19" \
"r-lintr>=2.0"
pip install --user cpplint isort mypy
pip install cpplint isort mypy
echo "Linting Python code"
pycodestyle --ignore=E501,W503 --exclude=./.nuget,./external_libs . || exit -1
pydocstyle --convention=numpy --add-ignore=D105 --match-dir="^(?!^external_libs|test|example).*" --match="(?!^test_|setup).*\.py" . || exit -1
Expand Down Expand Up @@ -114,7 +121,7 @@ fi

if [[ $TASK == "sdist" ]]; then
cd $BUILD_DIRECTORY/python-package && python setup.py sdist || exit -1
pip install --user $BUILD_DIRECTORY/python-package/dist/fairgbm-$LGB_VER.tar.gz -v || exit -1
pip install $BUILD_DIRECTORY/python-package/dist/fairgbm-$LGB_VER.tar.gz -v || exit -1
if [[ $PRODUCES_ARTIFACTS == "true" ]]; then
cp $BUILD_DIRECTORY/python-package/dist/fairgbm-$LGB_VER.tar.gz $BUILD_ARTIFACTSTAGINGDIRECTORY
fi
Expand All @@ -139,7 +146,7 @@ elif [[ $TASK == "bdist" ]]; then
cp dist/fairgbm-$LGB_VER-py3-none-$PLATFORM.whl $BUILD_ARTIFACTSTAGINGDIRECTORY
fi
fi
pip install --user $BUILD_DIRECTORY/python-package/dist/*.whl || exit -1
pip install $BUILD_DIRECTORY/python-package/dist/*.whl || exit -1
pytest $BUILD_DIRECTORY/tests || exit -1
exit 0
fi
Expand All @@ -151,12 +158,12 @@ if [[ $TASK == "gpu" ]]; then
grep -q 'std::string device_type = "gpu"' $BUILD_DIRECTORY/include/LightGBM/config.h || exit -1 # make sure that changes were really done
if [[ $METHOD == "pip" ]]; then
cd $BUILD_DIRECTORY/python-package && python setup.py sdist || exit -1
pip install --user $BUILD_DIRECTORY/python-package/dist/fairgbm-$LGB_VER.tar.gz -v --install-option=--gpu --install-option="--opencl-include-dir=$AMDAPPSDK_PATH/include/" || exit -1
pip install $BUILD_DIRECTORY/python-package/dist/fairgbm-$LGB_VER.tar.gz -v --install-option=--gpu --install-option="--opencl-include-dir=$AMDAPPSDK_PATH/include/" || exit -1
pytest $BUILD_DIRECTORY/tests/python_package_test || exit -1
exit 0
elif [[ $METHOD == "wheel" ]]; then
cd $BUILD_DIRECTORY/python-package && python setup.py bdist_wheel --gpu --opencl-include-dir="$AMDAPPSDK_PATH/include/" || exit -1
pip install --user $BUILD_DIRECTORY/python-package/dist/fairgbm-$LGB_VER*.whl -v || exit -1
pip install $BUILD_DIRECTORY/python-package/dist/fairgbm-$LGB_VER*.whl -v || exit -1
pytest $BUILD_DIRECTORY/tests || exit -1
exit 0
elif [[ $METHOD == "source" ]]; then
Expand All @@ -167,12 +174,12 @@ elif [[ $TASK == "cuda" ]]; then
grep -q 'std::string device_type = "cuda"' $BUILD_DIRECTORY/include/LightGBM/config.h || exit -1 # make sure that changes were really done
if [[ $METHOD == "pip" ]]; then
cd $BUILD_DIRECTORY/python-package && python setup.py sdist || exit -1
pip install --user $BUILD_DIRECTORY/python-package/dist/fairgbm-$LGB_VER.tar.gz -v --install-option=--cuda || exit -1
pip install $BUILD_DIRECTORY/python-package/dist/fairgbm-$LGB_VER.tar.gz -v --install-option=--cuda || exit -1
pytest $BUILD_DIRECTORY/tests/python_package_test || exit -1
exit 0
elif [[ $METHOD == "wheel" ]]; then
cd $BUILD_DIRECTORY/python-package && python setup.py bdist_wheel --cuda || exit -1
pip install --user $BUILD_DIRECTORY/python-package/dist/fairgbm-$LGB_VER*.whl -v || exit -1
pip install $BUILD_DIRECTORY/python-package/dist/fairgbm-$LGB_VER*.whl -v || exit -1
pytest $BUILD_DIRECTORY/tests || exit -1
exit 0
elif [[ $METHOD == "source" ]]; then
Expand All @@ -181,12 +188,12 @@ elif [[ $TASK == "cuda" ]]; then
elif [[ $TASK == "mpi" ]]; then
if [[ $METHOD == "pip" ]]; then
cd $BUILD_DIRECTORY/python-package && python setup.py sdist || exit -1
pip install --user $BUILD_DIRECTORY/python-package/dist/fairgbm-$LGB_VER.tar.gz -v || exit -1
pip install $BUILD_DIRECTORY/python-package/dist/fairgbm-$LGB_VER.tar.gz -v || exit -1
pytest $BUILD_DIRECTORY/tests/python_package_test || exit -1
exit 0
elif [[ $METHOD == "wheel" ]]; then
cd $BUILD_DIRECTORY/python-package && python setup.py bdist_wheel --mpi || exit -1
pip install --user $BUILD_DIRECTORY/python-package/dist/fairgbm-$LGB_VER*.whl -v || exit -1
pip install $BUILD_DIRECTORY/python-package/dist/fairgbm-$LGB_VER*.whl -v || exit -1
pytest $BUILD_DIRECTORY/tests || exit -1
exit 0
elif [[ $METHOD == "source" ]]; then
Expand All @@ -198,7 +205,7 @@ fi

make _lightgbm -j4 || exit -1

cd $BUILD_DIRECTORY/python-package && python setup.py install --precompile --user || exit -1
cd $BUILD_DIRECTORY/python-package && python setup.py install --precompile || exit -1
pytest $BUILD_DIRECTORY/tests || exit -1

if [[ $TASK == "regular" ]]; then
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/python_package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@ jobs:
- os: ubuntu-latest
task: mpi
method: pip
python_version: 3.7
python_version: 3.8
- os: ubuntu-latest
task: mpi
method: wheel
python_version: 3.7
python_version: 3.8
steps:
- name: Checkout repository
uses: actions/checkout@v2.3.4
uses: actions/checkout@v4
with:
fetch-depth: 5
submodules: true
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ elseif(USE_GPU OR APPLE)
elseif(USE_CUDA)
cmake_minimum_required(VERSION 3.16)
else()
cmake_minimum_required(VERSION 3.0)
cmake_minimum_required(VERSION 3.5)
endif()

PROJECT(lightgbm LANGUAGES C CXX)
Expand Down
Loading