Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
tianlh
LightGBM-DCU
Commits
ad68f137
Unverified
Commit
ad68f137
authored
Jan 26, 2023
by
James Lamb
Committed by
GitHub
Jan 26, 2023
Browse files
[ci] speed up conda setup for some jobs (#5668)
parent
5b59a9de
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
58 additions
and
56 deletions
+58
-56
.ci/test.sh
.ci/test.sh
+58
-56
No files found.
.ci/test.sh
View file @
ad68f137
...
@@ -34,7 +34,63 @@ if [[ "$TASK" == "cpp-tests" ]]; then
...
@@ -34,7 +34,63 @@ if [[ "$TASK" == "cpp-tests" ]]; then
exit
0
exit
0
fi
fi
conda create
-q
-y
-n
$CONDA_ENV
"python=
$PYTHON_VERSION
[build=*cpython]"
CONDA_PYTHON_REQUIREMENT
=
"python=
$PYTHON_VERSION
[build=*cpython]"
if
[[
$TASK
==
"if-else"
]]
;
then
conda create
-q
-y
-n
$CONDA_ENV
${
CONDA_PYTHON_REQUIREMENT
}
numpy
source
activate
$CONDA_ENV
mkdir
$BUILD_DIRECTORY
/build
&&
cd
$BUILD_DIRECTORY
/build
&&
cmake ..
&&
make lightgbm
-j4
||
exit
-1
cd
$BUILD_DIRECTORY
/tests/cpp_tests
&&
../../lightgbm
config
=
train.conf
convert_model_language
=
cpp
convert_model
=
../../src/boosting/gbdt_prediction.cpp
&&
../../lightgbm
config
=
predict.conf
output_result
=
origin.pred
||
exit
-1
cd
$BUILD_DIRECTORY
/build
&&
make lightgbm
-j4
||
exit
-1
cd
$BUILD_DIRECTORY
/tests/cpp_tests
&&
../../lightgbm
config
=
predict.conf
output_result
=
ifelse.pred
&&
python test.py
||
exit
-1
exit
0
fi
if
[[
$TASK
==
"swig"
]]
;
then
mkdir
$BUILD_DIRECTORY
/build
&&
cd
$BUILD_DIRECTORY
/build
if
[[
$OS_NAME
==
"macos"
]]
;
then
cmake
-DUSE_SWIG
=
ON
-DAPPLE_OUTPUT_DYLIB
=
ON ..
else
cmake
-DUSE_SWIG
=
ON ..
fi
make
-j4
||
exit
-1
if
[[
$OS_NAME
==
"linux"
]]
&&
[[
$COMPILER
==
"gcc"
]]
;
then
objdump
-T
$BUILD_DIRECTORY
/lib_lightgbm.so
>
$BUILD_DIRECTORY
/objdump.log
||
exit
-1
objdump
-T
$BUILD_DIRECTORY
/lib_lightgbm_swig.so
>>
$BUILD_DIRECTORY
/objdump.log
||
exit
-1
python
$BUILD_DIRECTORY
/helpers/check_dynamic_dependencies.py
$BUILD_DIRECTORY
/objdump.log
||
exit
-1
fi
if
[[
$PRODUCES_ARTIFACTS
==
"true"
]]
;
then
cp
$BUILD_DIRECTORY
/build/lightgbmlib.jar
$BUILD_ARTIFACTSTAGINGDIRECTORY
/lightgbmlib_
$OS_NAME
.jar
fi
exit
0
fi
if
[[
$TASK
==
"lint"
]]
;
then
conda create
-q
-y
-n
$CONDA_ENV
\
${
CONDA_PYTHON_REQUIREMENT
}
\
cmakelint
\
cpplint
\
isort
\
mypy
\
pycodestyle
\
pydocstyle
\
"r-lintr>=3.0"
source
activate
$CONDA_ENV
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
isort
.
--check-only
||
exit
-1
mypy
--ignore-missing-imports
python-package/
||
true
echo
"Linting R code"
Rscript
${
BUILD_DIRECTORY
}
/.ci/lint_r_code.R
${
BUILD_DIRECTORY
}
||
exit
-1
echo
"Linting C++ code"
cpplint
--filter
=
-build
/c++11,-build/include_subdir,-build/header_guard,-whitespace/line_length
--recursive
./src ./include ./R-package ./swig ./tests
||
exit
-1
cmake_files
=
$(
find
.
-name
CMakeLists.txt
-o
-path
"*/cmake/*.cmake"
)
cmakelint
--linelength
=
120
--filter
=
-convention
/filename,-package/stdargs,-readability/wonkycase
${
cmake_files
}
||
exit
-1
exit
0
fi
conda create
-q
-y
-n
$CONDA_ENV
"
${
CONDA_PYTHON_REQUIREMENT
}
"
source
activate
$CONDA_ENV
source
activate
$CONDA_ENV
cd
$BUILD_DIRECTORY
cd
$BUILD_DIRECTORY
...
@@ -72,60 +128,6 @@ if [[ $TASK == "check-docs" ]] || [[ $TASK == "check-links" ]]; then
...
@@ -72,60 +128,6 @@ if [[ $TASK == "check-docs" ]] || [[ $TASK == "check-links" ]]; then
exit
0
exit
0
fi
fi
if
[[
$TASK
==
"lint"
]]
;
then
conda
install
-q
-y
-n
$CONDA_ENV
\
cmakelint
\
cpplint
\
flake8
\
isort
\
mypy
\
pydocstyle
\
"r-lintr>=3.0"
echo
"Linting Python code"
flake8
\
--ignore
=
E501,W503
\
--exclude
=
./.nuget,./external_libs,./python-package/build
\
.
||
exit
-1
pydocstyle
--convention
=
numpy
--add-ignore
=
D105
--match-dir
=
"^(?!^external_libs|test|example).*"
--match
=
"(?!^test_|setup).*
\.
py"
.
||
exit
-1
isort
.
--check-only
||
exit
-1
mypy
--ignore-missing-imports
python-package/
||
true
echo
"Linting R code"
Rscript
${
BUILD_DIRECTORY
}
/.ci/lint_r_code.R
${
BUILD_DIRECTORY
}
||
exit
-1
echo
"Linting C++ code"
cpplint
--filter
=
-build
/c++11,-build/include_subdir,-build/header_guard,-whitespace/line_length
--recursive
./src ./include ./R-package ./swig ./tests
||
exit
-1
cmake_files
=
$(
find
.
-name
CMakeLists.txt
-o
-path
"*/cmake/*.cmake"
)
cmakelint
--linelength
=
120
--filter
=
-convention
/filename,-package/stdargs,-readability/wonkycase
${
cmake_files
}
||
exit
-1
exit
0
fi
if
[[
$TASK
==
"if-else"
]]
;
then
conda
install
-q
-y
-n
$CONDA_ENV
numpy
mkdir
$BUILD_DIRECTORY
/build
&&
cd
$BUILD_DIRECTORY
/build
&&
cmake ..
&&
make lightgbm
-j4
||
exit
-1
cd
$BUILD_DIRECTORY
/tests/cpp_tests
&&
../../lightgbm
config
=
train.conf
convert_model_language
=
cpp
convert_model
=
../../src/boosting/gbdt_prediction.cpp
&&
../../lightgbm
config
=
predict.conf
output_result
=
origin.pred
||
exit
-1
cd
$BUILD_DIRECTORY
/build
&&
make lightgbm
-j4
||
exit
-1
cd
$BUILD_DIRECTORY
/tests/cpp_tests
&&
../../lightgbm
config
=
predict.conf
output_result
=
ifelse.pred
&&
python test.py
||
exit
-1
exit
0
fi
if
[[
$TASK
==
"swig"
]]
;
then
mkdir
$BUILD_DIRECTORY
/build
&&
cd
$BUILD_DIRECTORY
/build
if
[[
$OS_NAME
==
"macos"
]]
;
then
cmake
-DUSE_SWIG
=
ON
-DAPPLE_OUTPUT_DYLIB
=
ON ..
else
cmake
-DUSE_SWIG
=
ON ..
fi
make
-j4
||
exit
-1
if
[[
$OS_NAME
==
"linux"
]]
&&
[[
$COMPILER
==
"gcc"
]]
;
then
objdump
-T
$BUILD_DIRECTORY
/lib_lightgbm.so
>
$BUILD_DIRECTORY
/objdump.log
||
exit
-1
objdump
-T
$BUILD_DIRECTORY
/lib_lightgbm_swig.so
>>
$BUILD_DIRECTORY
/objdump.log
||
exit
-1
python
$BUILD_DIRECTORY
/helpers/check_dynamic_dependencies.py
$BUILD_DIRECTORY
/objdump.log
||
exit
-1
fi
if
[[
$PRODUCES_ARTIFACTS
==
"true"
]]
;
then
cp
$BUILD_DIRECTORY
/build/lightgbmlib.jar
$BUILD_ARTIFACTSTAGINGDIRECTORY
/lightgbmlib_
$OS_NAME
.jar
fi
exit
0
fi
# re-including python=version[build=*cpython] to ensure that conda doesn't fall back to pypy
# re-including python=version[build=*cpython] to ensure that conda doesn't fall back to pypy
conda
install
-q
-y
-n
$CONDA_ENV
\
conda
install
-q
-y
-n
$CONDA_ENV
\
cloudpickle
\
cloudpickle
\
...
@@ -137,7 +139,7 @@ conda install -q -y -n $CONDA_ENV \
...
@@ -137,7 +139,7 @@ conda install -q -y -n $CONDA_ENV \
pandas
\
pandas
\
psutil
\
psutil
\
pytest
\
pytest
\
"python=
$PYTHON_VERSION
[build=*cpython]"
\
${
CONDA_PYTHON_REQUIREMENT
}
\
python-graphviz
\
python-graphviz
\
scikit-learn
\
scikit-learn
\
scipy
||
exit
-1
scipy
||
exit
-1
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment