Skip to content

Commit

Permalink
fixed conda (#2016)
Browse files Browse the repository at this point in the history
  • Loading branch information
StrikerRUS authored and guolinke committed Feb 18, 2019
1 parent 5256cda commit b447a7b
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 32 deletions.
6 changes: 3 additions & 3 deletions .appveyor.yml
Expand Up @@ -29,8 +29,8 @@ install:
- set PATH=%MINICONDA%;%MINICONDA%\Scripts;%PATH%
- ps: $env:LGB_VER = (Get-Content VERSION.txt).trim()
- conda config --set always_yes yes --set changeps1 no
- conda update -q conda
- conda create -q -n test-env python=%PYTHON_VERSION% matplotlib nose numpy pandas psutil pytest python-graphviz scikit-learn scipy
- conda update -q -y conda
- conda create -q -y -n test-env python=%PYTHON_VERSION% matplotlib nose numpy pandas psutil pytest python-graphviz scikit-learn scipy
- activate test-env

build_script:
Expand All @@ -53,5 +53,5 @@ test_script:
if (!$?) { $host.SetShouldExit(-1) }
} # run all examples
- cd %APPVEYOR_BUILD_FOLDER%\examples\python-guide\notebooks
- conda install -y -n test-env ipywidgets notebook
- conda install -q -y -n test-env ipywidgets notebook
- jupyter nbconvert --ExecutePreprocessor.timeout=180 --to notebook --execute --inplace *.ipynb # run all notebooks
12 changes: 5 additions & 7 deletions .ci/setup.sh
Expand Up @@ -20,9 +20,7 @@ if [[ $OS_NAME == "macos" ]]; then
if [[ $TASK == "mpi" ]]; then
brew install open-mpi
fi
if [[ $TRAVIS == "true" ]]; then
wget -O conda.sh https://repo.continuum.io/miniconda/Miniconda${PYTHON_VERSION:0:1}-latest-MacOSX-x86_64.sh
fi
wget -q -O conda.sh https://repo.continuum.io/miniconda/Miniconda${PYTHON_VERSION:0:1}-latest-MacOSX-x86_64.sh
else # Linux
if [[ $AZURE == "true" ]] && [[ $COMPILER == "clang" ]]; then
sudo apt-get update
Expand All @@ -49,13 +47,13 @@ else # Linux
mv $AMDAPPSDK_PATH/lib/x86_64/sdk/* $AMDAPPSDK_PATH/lib/x86_64/
echo libamdocl64.so > $OPENCL_VENDOR_PATH/amdocl64.icd
fi
if [[ $TRAVIS == "true" ]]; then
wget -O conda.sh https://repo.continuum.io/miniconda/Miniconda${PYTHON_VERSION:0:1}-latest-Linux-x86_64.sh
if [[ $TRAVIS == "true" ]] || [[ $TASK == "gpu" ]]; then
wget -q -O conda.sh https://repo.continuum.io/miniconda/Miniconda${PYTHON_VERSION:0:1}-latest-Linux-x86_64.sh
fi
fi

if [[ $TRAVIS == "true" ]]; then
sh conda.sh -b -p $HOME_DIRECTORY/miniconda
if [[ $TRAVIS == "true" ]] || [[ $OS_NAME == "macos" ]] || [[ $TASK == "gpu" ]]; then
sh conda.sh -b -p $CONDA
fi
conda config --set always_yes yes --set changeps1 no
conda update -q conda
10 changes: 5 additions & 5 deletions .ci/test.sh
Expand Up @@ -15,9 +15,9 @@ cd $BUILD_DIRECTORY

if [[ $TRAVIS == "true" ]] && [[ $TASK == "check-docs" ]]; then
if [[ $PYTHON_VERSION == "2.7" ]]; then
conda -y -n $CONDA_ENV mock
conda -q -y -n $CONDA_ENV mock
fi
conda install -y -n $CONDA_ENV sphinx "sphinx_rtd_theme>=0.3"
conda install -q -y -n $CONDA_ENV sphinx "sphinx_rtd_theme>=0.3"
pip install --user rstcheck
# check reStructuredText formatting
cd $BUILD_DIRECTORY/python-package
Expand All @@ -43,14 +43,14 @@ if [[ $TRAVIS == "true" ]] && [[ $TASK == "check-docs" ]]; then
fi

if [[ $TASK == "pylint" ]]; then
conda install -y -n $CONDA_ENV pycodestyle pydocstyle
conda install -q -y -n $CONDA_ENV pycodestyle pydocstyle
pycodestyle --ignore=E501,W503 --exclude=./compute,./.nuget . || exit -1
pydocstyle --convention=numpy --add-ignore=D105 --match-dir="^(?!^compute|test|example).*" --match="(?!^test_|setup).*\.py" . || exit -1
exit 0
fi

if [[ $TASK == "if-else" ]]; then
conda install -y -n $CONDA_ENV numpy
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_test && ../../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
Expand Down Expand Up @@ -139,6 +139,6 @@ matplotlib.use\(\"Agg\"\)\
sed -i'.bak' 's/graph.render(view=True)/graph.render(view=False)/' plot_example.py
for f in *.py; do python $f || exit -1; done # run all examples
cd $BUILD_DIRECTORY/examples/python-guide/notebooks
conda install -y -n $CONDA_ENV ipywidgets notebook
conda install -q -y -n $CONDA_ENV ipywidgets notebook
jupyter nbconvert --ExecutePreprocessor.timeout=180 --to notebook --execute --inplace *.ipynb || exit -1 # run all notebooks
fi
2 changes: 1 addition & 1 deletion .ci/test_windows.ps1
Expand Up @@ -38,6 +38,6 @@ if ($env:TASK -eq "regular") {
python $file ; Check-Output $?
} # run all examples
cd $env:BUILD_SOURCESDIRECTORY/examples/python-guide/notebooks
conda install -y -n $env:CONDA_ENV ipywidgets notebook
conda install -q -y -n $env:CONDA_ENV ipywidgets notebook
jupyter nbconvert --ExecutePreprocessor.timeout=180 --to notebook --execute --inplace *.ipynb ; Check-Output $? # run all notebooks
}
3 changes: 2 additions & 1 deletion .travis.yml
Expand Up @@ -46,7 +46,8 @@ before_install:
export OS_NAME="linux";
export COMPILER="clang";
fi
- export PATH="$HOME/miniconda/bin:$PATH"
- export CONDA="$HOME/miniconda"
- export PATH="$CONDA/bin:$PATH"
- export CONDA_ENV="test-env"
- export LGB_VER=$(head -n 1 VERSION.txt)
- export AMDAPPSDK_PATH=$HOME/AMDAPPSDK
Expand Down
28 changes: 13 additions & 15 deletions .vsts-ci.yml
Expand Up @@ -33,12 +33,12 @@ jobs:
PYTHON_VERSION: 2.7
steps:
- script: |
echo "##vso[task.setvariable variable=PATH]$CONDA/bin:$PATH"
echo "##vso[task.setvariable variable=HOME_DIRECTORY]$AGENT_HOMEDIRECTORY"
echo "##vso[task.setvariable variable=BUILD_DIRECTORY]$BUILD_SOURCESDIRECTORY"
echo "##vso[task.setvariable variable=OS_NAME]linux"
echo "##vso[task.setvariable variable=AZURE]true"
echo "##vso[task.setvariable variable=LGB_VER]$(head -n 1 VERSION.txt)"
echo "##vso[task.prependpath]$CONDA/bin"
displayName: 'Set variables'
- bash: $(Build.SourcesDirectory)/.ci/setup.sh
displayName: Setup
Expand All @@ -65,9 +65,6 @@ jobs:
METHOD: source
PYTHON_VERSION: 3.6
steps:
- task: CondaEnvironment@1
inputs:
updateConda: false
- script: |
echo "##vso[task.setvariable variable=HOME_DIRECTORY]$AGENT_HOMEDIRECTORY"
echo "##vso[task.setvariable variable=BUILD_DIRECTORY]$BUILD_SOURCESDIRECTORY"
Expand All @@ -79,6 +76,9 @@ jobs:
LD_LIBRARY_PATH=$AMDAPPSDK_PATH/lib/x86_64:$LD_LIBRARY_PATH
echo "##vso[task.setvariable variable=LD_LIBRARY_PATH]$LD_LIBRARY_PATH"
echo "##vso[task.setvariable variable=OPENCL_VENDOR_PATH]$AMDAPPSDK_PATH/etc/OpenCL/vendors"
CONDA=$AGENT_HOMEDIRECTORY/miniconda
echo "##vso[task.setvariable variable=CONDA]$CONDA"
echo "##vso[task.prependpath]$CONDA/bin"
displayName: 'Set variables'
- bash: $(Build.SourcesDirectory)/.ci/setup.sh
displayName: Setup
Expand All @@ -103,15 +103,15 @@ jobs:
bdist:
TASK: bdist
steps:
- task: CondaEnvironment@1
inputs:
updateConda: false
- script: |
echo "##vso[task.setvariable variable=HOME_DIRECTORY]$AGENT_HOMEDIRECTORY"
echo "##vso[task.setvariable variable=BUILD_DIRECTORY]$BUILD_SOURCESDIRECTORY"
echo "##vso[task.setvariable variable=OS_NAME]macos"
echo "##vso[task.setvariable variable=AZURE]true"
echo "##vso[task.setvariable variable=LGB_VER]$(head -n 1 VERSION.txt)"
CONDA=$AGENT_HOMEDIRECTORY/miniconda
echo "##vso[task.setvariable variable=CONDA]$CONDA"
echo "##vso[task.prependpath]$CONDA/bin"
displayName: 'Set variables'
- bash: $(Build.SourcesDirectory)/.ci/setup.sh
displayName: Setup
Expand Down Expand Up @@ -141,14 +141,12 @@ jobs:
TASK: bdist
PYTHON_VERSION: 3.6
steps:
- task: CondaEnvironment@1
inputs:
createCustomEnvironment: true
updateConda: true
environmentName: $(CONDA_ENV)
packageSpecs: 'python=$(PYTHON_VERSION) matplotlib nose numpy pandas psutil pytest python-graphviz scikit-learn scipy'
createOptions: '-q'
- powershell: $(Build.SourcesDirectory)/.ci/test_windows.ps1
- powershell: Write-Host "##vso[task.prependpath]$env:CONDA\Scripts"
displayName: Enable conda
- script: |
conda update -q -y conda
conda create -q -y -n %CONDA_ENV% python=%PYTHON_VERSION% matplotlib nose numpy pandas psutil pytest python-graphviz scikit-learn scipy
cmd /c "activate %CONDA_ENV% & powershell -ExecutionPolicy Bypass -File %BUILD_SOURCESDIRECTORY%/.ci/test_windows.ps1"
displayName: Test
- task: PublishBuildArtifacts@1
condition: and(succeeded(), not(startsWith(variables['Build.SourceBranch'], 'refs/pull/')))
Expand Down

0 comments on commit b447a7b

Please sign in to comment.