diff --git a/.ci/setup.sh b/.ci/setup.sh index f389b28e190d..7e9229d14447 100755 --- a/.ci/setup.sh +++ b/.ci/setup.sh @@ -17,8 +17,10 @@ if [[ $OS_NAME == "macos" ]]; then if [[ $TASK == "swig" ]]; then brew install swig fi - brew install graphviz - curl -sL -o conda.sh https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh + curl \ + -sL \ + -o miniforge.sh \ + https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-MacOSX-x86_64.sh else # Linux if [[ $IN_UBUNTU_LATEST_CONTAINER == "true" ]]; then # fixes error "unable to initialize frontend: Dialog" @@ -42,9 +44,6 @@ else # Linux libicu66 \ libssl1.1 \ libunwind8 \ - libxau6 \ - libxext6 \ - libxrender1 \ locales \ netcat \ unzip \ @@ -81,16 +80,11 @@ else # Linux mv $AMDAPPSDK_PATH/lib/x86_64/sdk/* $AMDAPPSDK_PATH/lib/x86_64/ echo libamdocl64.so > $OPENCL_VENDOR_PATH/amdocl64.icd fi - ARCH=$(uname -m) if [[ $TASK == "cuda" ]]; then echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections apt-get update apt-get install --no-install-recommends -y \ curl \ - graphviz \ - libxau6 \ - libxext6 \ - libxrender1 \ lsb-release \ software-properties-common if [[ $COMPILER == "clang" ]]; then @@ -103,29 +97,19 @@ else # Linux apt-get update apt-get install --no-install-recommends -y \ cmake - else - if [[ $ARCH != "x86_64" ]]; then - yum update -y - yum install -y \ - graphviz - else - sudo apt-get update - sudo apt-get install --no-install-recommends -y \ - graphviz - fi fi if [[ $SETUP_CONDA != "false" ]]; then - if [[ $ARCH == "x86_64" ]]; then - curl -sL -o conda.sh https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh - else - curl -sL -o conda.sh https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Linux-${ARCH}.sh - fi + ARCH=$(uname -m) + curl \ + -sL \ + -o miniforge.sh \ + https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Linux-${ARCH}.sh fi fi -if [[ "${TASK}" != "r-package" ]]; then +if [[ "${TASK}" != "r-package" ]] && [[ "${TASK}" != "r-rchk" ]]; then if [[ $SETUP_CONDA != "false" ]]; then - sh conda.sh -b -p $CONDA + sh miniforge.sh -b -p $CONDA fi conda config --set always_yes yes --set changeps1 no conda update -q -y conda diff --git a/.ci/test.sh b/.ci/test.sh index e3d385ab8b71..c94151ac1e51 100755 --- a/.ci/test.sh +++ b/.ci/test.sh @@ -62,16 +62,13 @@ fi if [[ $TASK == "lint" ]]; then conda install -q -y -n $CONDA_ENV \ + cmakelint \ + cpplint \ + isort \ + mypy \ pycodestyle \ pydocstyle \ - r-stringi # stringi needs to be installed separate from r-lintr to avoid issues like 'unable to load shared object stringi.so' - # r-xfun below has to be upgraded because lintr requires > 0.19 for that package - conda install -q -y -n $CONDA_ENV \ - -c conda-forge \ - libxml2 \ - "r-xfun>=0.19" \ - "r-lintr>=2.0" - pip install --user cmakelint cpplint isort mypy + "r-lintr>=2.0" 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 @@ -114,8 +111,22 @@ if [[ $TASK == "swig" ]]; then exit 0 fi -conda install -q -y -n $CONDA_ENV cloudpickle "dask=2021.9.1" "distributed=2021.9.1" joblib matplotlib numpy pandas psutil pytest scikit-learn scipy -pip install graphviz # python-graphviz from Anaconda is not allowed to be installed with Python 3.9 +conda install -q -y -n $CONDA_ENV \ + cloudpickle \ + dask \ + distributed \ + joblib \ + matplotlib \ + numpy \ + pandas \ + psutil \ + pytest \ + scikit-learn \ + scipy || exit -1 + +# python-graphviz has to be installed separately to prevent conda from downgrading to pypy +conda install -q -y -n $CONDA_ENV \ + python-graphviz || exit -1 if [[ $OS_NAME == "macos" ]] && [[ $COMPILER == "clang" ]]; then # fix "OMP: Error #15: Initializing libiomp5.dylib, but found libomp.dylib already initialized." (OpenMP library conflict due to conda's MKL) @@ -229,7 +240,11 @@ import matplotlib\ matplotlib.use\(\"Agg\"\)\ ' plot_example.py # prevent interactive window mode sed -i'.bak' 's/graph.render(view=True)/graph.render(view=False)/' plot_example.py - conda install -q -y -n $CONDA_ENV h5py ipywidgets notebook # requirements for examples + # requirements for examples + conda install -q -y -n $CONDA_ENV \ + h5py \ + ipywidgets \ + notebook for f in *.py **/*.py; do python $f || exit -1; done # run all examples cd $BUILD_DIRECTORY/examples/python-guide/notebooks sed -i'.bak' 's/INTERACTIVE = False/assert False, \\"Interactive mode disabled\\"/' interactive_plot_example.ipynb diff --git a/.github/workflows/cuda.yml b/.github/workflows/cuda.yml index 2100e171ee7b..52511e222db2 100644 --- a/.github/workflows/cuda.yml +++ b/.github/workflows/cuda.yml @@ -81,7 +81,7 @@ jobs: LGB_VER=$(head -n 1 VERSION.txt) EOF cat > docker-script.sh < docker-script.sh <