Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: [ci] fix conda activation issues (fixes #6799) #6800

Closed
wants to merge 2 commits into from
Closed
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
21 changes: 13 additions & 8 deletions .ci/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@ ARCH=$(uname -m)

LGB_VER=$(head -n 1 "${BUILD_DIRECTORY}/VERSION.txt")

activate-conda-env() {
set +u
# shellcheck disable=SC1091
source activate "${1}"
set -u
}

if [[ $OS_NAME == "macos" ]] && [[ $COMPILER == "gcc" ]]; then
export CXX=g++-12
export CC=gcc-12
Expand Down Expand Up @@ -69,8 +76,7 @@ CONDA_PYTHON_REQUIREMENT="python=${PYTHON_VERSION}[build=*cpython]"

if [[ $TASK == "if-else" ]]; then
conda create -q -y -n "${CONDA_ENV}" "${CONDA_PYTHON_REQUIREMENT}" numpy
# shellcheck disable=SC1091
source activate "${CONDA_ENV}"
activate-conda-env "${CONDA_ENV}"
cmake -B build -S . || exit 1
cmake --build build --target lightgbm -j4 || exit 1
cd "$BUILD_DIRECTORY/tests/cpp_tests"
Expand Down Expand Up @@ -112,8 +118,7 @@ if [[ $TASK == "lint" ]]; then
'pyarrow-core>=17.0' \
'scikit-learn>=1.5.2' \
'r-lintr>=3.1.2'
# shellcheck disable=SC1091
source activate "${CONDA_ENV}"
activate-conda-env "${CONDA_ENV}"
echo "Linting Python and bash code"
bash ./.ci/lint-python-bash.sh || exit 1
echo "Linting R code"
Expand All @@ -135,8 +140,7 @@ if [[ $TASK == "check-docs" ]] || [[ $TASK == "check-links" ]]; then
-n "${CONDA_ENV}" \
'doxygen>=1.10.0' \
'rstcheck>=6.2.4' || exit 1
# shellcheck disable=SC1091
source activate "${CONDA_ENV}"
activate-conda-env "${CONDA_ENV}"
# check reStructuredText formatting
find "${BUILD_DIRECTORY}/python-package" -type f -name "*.rst" \
-exec rstcheck --report-level warning {} \+ || exit 1
Expand Down Expand Up @@ -167,15 +171,16 @@ else
CONDA_REQUIREMENT_FILE="${BUILD_DIRECTORY}/.ci/conda-envs/ci-core.txt"
fi

set +u
conda create \
-y \
-n "${CONDA_ENV}" \
--file "${CONDA_REQUIREMENT_FILE}" \
"${CONDA_PYTHON_REQUIREMENT}" \
|| exit 1
set -u

# shellcheck disable=SC1091
source activate $CONDA_ENV
activate-conda-env "${CONDA_ENV}"

cd "${BUILD_DIRECTORY}"

Expand Down
2 changes: 2 additions & 0 deletions docs/build-docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ conda env create \
--name docs-env \
--file env.yml || exit 1

set +u
# shellcheck disable=SC1091
source activate docs-env
set -u
make clean html || exit 1

echo "Done building docs. Open docs/_build/html/index.html in a web browser to view them."
Loading