Unverified Commit e8395e92 authored by Guolin Ke's avatar Guolin Ke Committed by GitHub
Browse files

[Azure Pipeline] switch to Hosted Ubuntu 1604 (#1740)

* use new keywords

* fix conda install

* try to fix conda

* conda
parent 496a07d1
...@@ -63,3 +63,5 @@ if [[ $TRAVIS == "true" ]]; then ...@@ -63,3 +63,5 @@ if [[ $TRAVIS == "true" ]]; then
conda config --set always_yes yes --set changeps1 no conda config --set always_yes yes --set changeps1 no
conda update -q conda conda update -q conda
fi fi
...@@ -8,10 +8,8 @@ elif [[ $OS_NAME == "linux" ]] && [[ $COMPILER == "clang" ]]; then ...@@ -8,10 +8,8 @@ elif [[ $OS_NAME == "linux" ]] && [[ $COMPILER == "clang" ]]; then
export CC=clang export CC=clang
fi fi
if [[ $TRAVIS == "true" ]]; then conda create -q -y -n $CONDA_ENV python=$PYTHON_VERSION
conda create -q -y -n $CONDA_ENV python=$PYTHON_VERSION source activate $CONDA_ENV
source activate $CONDA_ENV
fi
cd $BUILD_DIRECTORY cd $BUILD_DIRECTORY
...@@ -21,7 +19,7 @@ if [[ $TRAVIS == "true" ]] && [[ $TASK == "check-docs" ]]; then ...@@ -21,7 +19,7 @@ if [[ $TRAVIS == "true" ]] && [[ $TASK == "check-docs" ]]; then
fi fi
# sphinx >=1.8 is incompatible with rstcheck # sphinx >=1.8 is incompatible with rstcheck
conda install -y -n $CONDA_ENV "sphinx<1.8" "sphinx_rtd_theme>=0.3" # html5validator conda install -y -n $CONDA_ENV "sphinx<1.8" "sphinx_rtd_theme>=0.3" # html5validator
pip install rstcheck pip install --user rstcheck
# check reStructuredText formatting # check reStructuredText formatting
cd $BUILD_DIRECTORY/python-package cd $BUILD_DIRECTORY/python-package
rstcheck --report warning `find . -type f -name "*.rst"` || exit -1 rstcheck --report warning `find . -type f -name "*.rst"` || exit -1
...@@ -64,12 +62,12 @@ fi ...@@ -64,12 +62,12 @@ fi
conda install -q -y -n $CONDA_ENV numpy nose scipy scikit-learn pandas matplotlib python-graphviz pytest conda install -q -y -n $CONDA_ENV numpy nose scipy scikit-learn pandas matplotlib python-graphviz pytest
if [[ $OS_NAME == "macos" ]] && [[ $COMPILER == "clang" ]]; then if [[ $OS_NAME == "macos" ]] && [[ $COMPILER == "clang" ]]; then
ln -sf `ls -d "$(brew --cellar libomp)"/*/lib`/* $CONDA_PREFIX/lib || exit -1 # fix "OMP: Error #15: Initializing libiomp5.dylib, but found libomp.dylib already initialized." (OpenMP library conflict due to conda's MKL) sudo ln -sf `ls -d "$(brew --cellar libomp)"/*/lib`/* $CONDA_PREFIX/lib || exit -1 # fix "OMP: Error #15: Initializing libiomp5.dylib, but found libomp.dylib already initialized." (OpenMP library conflict due to conda's MKL)
fi fi
if [[ $TASK == "sdist" ]]; then if [[ $TASK == "sdist" ]]; then
cd $BUILD_DIRECTORY/python-package && python setup.py sdist || exit -1 cd $BUILD_DIRECTORY/python-package && python setup.py sdist || exit -1
pip install $BUILD_DIRECTORY/python-package/dist/lightgbm-$LGB_VER.tar.gz -v || exit -1 pip install --user $BUILD_DIRECTORY/python-package/dist/lightgbm-$LGB_VER.tar.gz -v || exit -1
if [[ $AZURE == "true" ]]; then if [[ $AZURE == "true" ]]; then
cp $BUILD_DIRECTORY/python-package/dist/lightgbm-$LGB_VER.tar.gz $BUILD_ARTIFACTSTAGINGDIRECTORY cp $BUILD_DIRECTORY/python-package/dist/lightgbm-$LGB_VER.tar.gz $BUILD_ARTIFACTSTAGINGDIRECTORY
fi fi
...@@ -89,7 +87,7 @@ elif [[ $TASK == "bdist" ]]; then ...@@ -89,7 +87,7 @@ elif [[ $TASK == "bdist" ]]; then
cp dist/lightgbm-$LGB_VER-py2.py3-none-manylinux1_x86_64.whl $BUILD_ARTIFACTSTAGINGDIRECTORY cp dist/lightgbm-$LGB_VER-py2.py3-none-manylinux1_x86_64.whl $BUILD_ARTIFACTSTAGINGDIRECTORY
fi fi
fi fi
pip install $BUILD_DIRECTORY/python-package/dist/*.whl || exit -1 pip install --user $BUILD_DIRECTORY/python-package/dist/*.whl || exit -1
pytest $BUILD_DIRECTORY/tests || exit -1 pytest $BUILD_DIRECTORY/tests || exit -1
exit 0 exit 0
fi fi
...@@ -103,9 +101,9 @@ if [[ $TASK == "gpu" ]]; then ...@@ -103,9 +101,9 @@ if [[ $TASK == "gpu" ]]; then
if [[ $METHOD == "pip" ]]; then if [[ $METHOD == "pip" ]]; then
cd $BUILD_DIRECTORY/python-package && python setup.py sdist || exit -1 cd $BUILD_DIRECTORY/python-package && python setup.py sdist || exit -1
if [[ $AZURE == "true" ]]; then if [[ $AZURE == "true" ]]; then
pip install $BUILD_DIRECTORY/python-package/dist/lightgbm-$LGB_VER.tar.gz -v --install-option=--gpu --install-option="--opencl-include-dir=$AMDAPPSDK_PATH/include/" || exit -1 pip install --user $BUILD_DIRECTORY/python-package/dist/lightgbm-$LGB_VER.tar.gz -v --install-option=--gpu --install-option="--opencl-include-dir=$AMDAPPSDK_PATH/include/" || exit -1
else else
pip install $BUILD_DIRECTORY/python-package/dist/lightgbm-$LGB_VER.tar.gz -v --install-option=--gpu --install-option="--boost-root=$CONDA_PREFIX" --install-option="--opencl-include-dir=$AMDAPPSDK_PATH/include/" || exit -1 pip install --user $BUILD_DIRECTORY/python-package/dist/lightgbm-$LGB_VER.tar.gz -v --install-option=--gpu --install-option="--boost-root=$CONDA_PREFIX" --install-option="--opencl-include-dir=$AMDAPPSDK_PATH/include/" || exit -1
fi fi
pytest $BUILD_DIRECTORY/tests/python_package_test || exit -1 pytest $BUILD_DIRECTORY/tests/python_package_test || exit -1
exit 0 exit 0
...@@ -117,7 +115,7 @@ mkdir $BUILD_DIRECTORY/build && cd $BUILD_DIRECTORY/build ...@@ -117,7 +115,7 @@ mkdir $BUILD_DIRECTORY/build && cd $BUILD_DIRECTORY/build
if [[ $TASK == "mpi" ]]; then if [[ $TASK == "mpi" ]]; then
if [[ $METHOD == "pip" ]]; then if [[ $METHOD == "pip" ]]; then
cd $BUILD_DIRECTORY/python-package && python setup.py sdist || exit -1 cd $BUILD_DIRECTORY/python-package && python setup.py sdist || exit -1
pip install $BUILD_DIRECTORY/python-package/dist/lightgbm-$LGB_VER.tar.gz -v --install-option=--mpi || exit -1 pip install --user $BUILD_DIRECTORY/python-package/dist/lightgbm-$LGB_VER.tar.gz -v --install-option=--mpi || exit -1
pytest $BUILD_DIRECTORY/tests/python_package_test || exit -1 pytest $BUILD_DIRECTORY/tests/python_package_test || exit -1
exit 0 exit 0
fi fi
...@@ -134,7 +132,7 @@ fi ...@@ -134,7 +132,7 @@ fi
make _lightgbm || exit -1 make _lightgbm || exit -1
cd $BUILD_DIRECTORY/python-package && python setup.py install --precompile || exit -1 cd $BUILD_DIRECTORY/python-package && python setup.py install --precompile --user || exit -1
pytest $BUILD_DIRECTORY/tests || exit -1 pytest $BUILD_DIRECTORY/tests || exit -1
if [[ $TASK == "regular" ]]; then if [[ $TASK == "regular" ]]; then
......
variables: variables:
PYTHON_VERSION: 3.7 PYTHON_VERSION: 3.7
CONDA_ENV: test-env CONDA_ENV: test-env
phases: jobs:
########################################### ###########################################
- phase: Linux - job: Linux
########################################### ###########################################
variables: variables:
COMPILER: gcc COMPILER: gcc
queue: pool:
name: 'Hosted Linux Preview' vmImage: 'ubuntu-16.04'
parallel: 6 strategy:
maxParallel: 6
matrix: matrix:
regular: regular:
TASK: regular TASK: regular
...@@ -30,12 +31,9 @@ phases: ...@@ -30,12 +31,9 @@ phases:
METHOD: source METHOD: source
PYTHON_VERSION: 3.6 PYTHON_VERSION: 3.6
steps: steps:
- task: CondaEnvironment@0 - task: CondaEnvironment@1
inputs: inputs:
updateConda: true updateConda: true
environmentName: $(CONDA_ENV)
packageSpecs: 'python=$(PYTHON_VERSION)'
createOptions: '-q'
- script: | - script: |
echo "##vso[task.setvariable variable=HOME_DIRECTORY]$AGENT_HOMEDIRECTORY" echo "##vso[task.setvariable variable=HOME_DIRECTORY]$AGENT_HOMEDIRECTORY"
echo "##vso[task.setvariable variable=BUILD_DIRECTORY]$BUILD_SOURCESDIRECTORY" echo "##vso[task.setvariable variable=BUILD_DIRECTORY]$BUILD_SOURCESDIRECTORY"
...@@ -59,13 +57,14 @@ phases: ...@@ -59,13 +57,14 @@ phases:
artifactName: PackageAssets artifactName: PackageAssets
artifactType: container artifactType: container
########################################### ###########################################
- phase: MacOS - job: MacOS
########################################### ###########################################
variables: variables:
COMPILER: clang COMPILER: clang
queue: pool:
name: 'Hosted macOS' vmImage: 'macOS-10.13'
parallel: 3 strategy:
maxParallel: 3
matrix: matrix:
regular: regular:
TASK: regular TASK: regular
...@@ -76,15 +75,9 @@ phases: ...@@ -76,15 +75,9 @@ phases:
bdist: bdist:
TASK: bdist TASK: bdist
steps: steps:
- script: | - task: CondaEnvironment@1
sudo chmod -R 777 /usr/local/miniconda/envs
displayName: 'Fix for conda error on macOS'
- task: CondaEnvironment@0
inputs: inputs:
updateConda: true updateConda: true
environmentName: $(CONDA_ENV)
packageSpecs: 'python=$(PYTHON_VERSION)'
createOptions: '-q'
- script: | - script: |
echo "##vso[task.setvariable variable=HOME_DIRECTORY]$AGENT_HOMEDIRECTORY" echo "##vso[task.setvariable variable=HOME_DIRECTORY]$AGENT_HOMEDIRECTORY"
echo "##vso[task.setvariable variable=BUILD_DIRECTORY]$BUILD_SOURCESDIRECTORY" echo "##vso[task.setvariable variable=BUILD_DIRECTORY]$BUILD_SOURCESDIRECTORY"
...@@ -103,11 +96,12 @@ phases: ...@@ -103,11 +96,12 @@ phases:
artifactName: PackageAssets artifactName: PackageAssets
artifactType: container artifactType: container
########################################### ###########################################
- phase: Windows - job: Windows
########################################### ###########################################
queue: pool:
name: 'Hosted VS2017' vmImage: 'vs2017-win2016'
parallel: 3 strategy:
maxParallel: 3
matrix: matrix:
regular: regular:
TASK: regular TASK: regular
...@@ -119,8 +113,9 @@ phases: ...@@ -119,8 +113,9 @@ phases:
TASK: bdist TASK: bdist
PYTHON_VERSION: 3.6 PYTHON_VERSION: 3.6
steps: steps:
- task: CondaEnvironment@0 - task: CondaEnvironment@1
inputs: inputs:
createCustomEnvironment: true
updateConda: true updateConda: true
environmentName: $(CONDA_ENV) environmentName: $(CONDA_ENV)
packageSpecs: 'python=$(PYTHON_VERSION) numpy nose scipy scikit-learn pandas matplotlib python-graphviz pytest' packageSpecs: 'python=$(PYTHON_VERSION) numpy nose scipy scikit-learn pandas matplotlib python-graphviz pytest'
...@@ -135,15 +130,15 @@ phases: ...@@ -135,15 +130,15 @@ phases:
artifactType: container artifactType: container
########################################### ###########################################
- phase: Package - job: Package
########################################### ###########################################
dependsOn: dependsOn:
- Linux - Linux
- MacOS - MacOS
- Windows - Windows
condition: and(succeeded(), not(startsWith(variables['Build.SourceBranch'], 'refs/pull/'))) condition: and(succeeded(), not(startsWith(variables['Build.SourceBranch'], 'refs/pull/')))
queue: pool:
name: 'Hosted VS2017' vmImage: 'vs2017-win2016'
steps: steps:
# Download all agent packages from all previous phases # Download all agent packages from all previous phases
- task: DownloadBuildArtifacts@0 - task: DownloadBuildArtifacts@0
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment