forked from microsoft/LightGBM
-
Notifications
You must be signed in to change notification settings - Fork 1
/
.vsts-ci.yml
198 lines (197 loc) · 6.44 KB
/
.vsts-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
phases:
###########################################
- phase: Linux
###########################################
variables:
PYTHON_VERSION: 3.6
CONDA_ENV: test-env
queue:
name: 'Hosted Linux Preview'
parallel: 9
matrix:
regular:
TASK: regular
mpi:
TASK: mpi
PYTHON_VERSION: 2.7
pylint:
TASK: pylint
inference:
TASK: if-else
sdist:
TASK: sdist
PYTHON_VERSION: 3.4
bdist:
TASK: bdist
PYTHON_VERSION: 3.5
gpu_1:
TASK: gpu
METHOD: source
gpu_2:
TASK: gpu
METHOD: pip
steps:
- task: CondaEnvironment@0
inputs:
environmentName: $(CONDA_ENV)
packageSpecs: 'python=$(PYTHON_VERSION)' # Optional
createOptions: '-q'
- script: |
sudo apt-get update
export LGB_VER=$(head -n 1 VERSION.txt)
export AMDAPPSDK=$HOME/AMDAPPSDK
export LD_LIBRARY_PATH="$AMDAPPSDK/lib/x86_64:$LD_LIBRARY_PATH"
export OPENCL_VENDOR_PATH=$AMDAPPSDK/etc/OpenCL/vendors
if [[ $TASK == "mpi" ]]; then
sudo apt-get install -y libopenmpi-dev openmpi-bin
fi
if [[ $TASK == "gpu" ]]; then
sudo apt-get install --no-install-recommends -y ocl-icd-opencl-dev libboost-dev libboost-system-dev libboost-filesystem-dev
wget -q https://github.com/Microsoft/LightGBM/releases/download/v2.0.12/AMD-APP-SDKInstaller-v3.0.130.136-GA-linux64.tar.bz2
tar -xjf AMD-APP-SDK*.tar.bz2
mkdir -p $OPENCL_VENDOR_PATH
sh AMD-APP-SDK*.sh --tar -xf -C $AMDAPPSDK
mv $AMDAPPSDK/lib/x86_64/sdk/* $AMDAPPSDK/lib/x86_64/
echo libamdocl64.so > $OPENCL_VENDOR_PATH/amdocl64.icd
fi
bash .vsts-ci/test.sh
- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: '$(Build.ArtifactStagingDirectory)'
artifactName: PackageAssets
artifactType: container
###########################################
- phase: MacOS
###########################################
variables:
PYTHON_VERSION: 3.6
CONDA_ENV: test-env
queue:
name: 'Hosted macOS Preview'
parallel: 3
matrix:
regular:
TASK: regular
PYTHON_VERSION: 2.7
sdist:
TASK: sdist
PYTHON_VERSION: 3.4
bdist:
TASK: bdist
PYTHON_VERSION: 3.5
steps:
- script: |
test -n $CC && unset CC
test -n $CXX && unset CXX
rm '/usr/local/include/c++'
brew install gcc@8
export CXX=g++-8
export CC=gcc-8
wget -O conda.sh https://repo.continuum.io/miniconda/Miniconda${PYTHON_VERSION:0:1}-latest-MacOSX-x86_64.sh
bash conda.sh -b -p $HOME/miniconda
export PATH=$HOME/miniconda/bin:$PATH
conda config --set always_yes yes --set changeps1 no
conda create -q -n $CONDA_ENV python=$PYTHON_VERSION
source activate $CONDA_ENV
export LGB_VER=$(head -n 1 VERSION.txt)
bash .vsts-ci/test.sh
- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: '$(Build.ArtifactStagingDirectory)'
artifactName: PackageAssets
artifactType: container
###########################################
- phase: Windows
###########################################
variables:
PYTHON_VERSION: 3.6
CONDA_ENV: test-env
queue:
name: 'Hosted VS2017'
parallel: 4
matrix:
regular:
TASK: regular
sdist:
TASK: sdist
PYTHON_VERSION: 2.7
bdist:
TASK: bdist
PYTHON_VERSION: 3.5
# mingw:
# TASK: mingw
steps:
- task: CondaEnvironment@0
inputs:
environmentName: $(CONDA_ENV)
packageSpecs: 'python=$(PYTHON_VERSION)' # Optional
createOptions: '-q'
- powershell: |
conda install -q -y -n $env:CONDA_ENV numpy nose scipy scikit-learn pandas matplotlib python-graphviz pytest
if ("$env:TASK" -eq "regular") {
mkdir build; cd build
cmake -DCMAKE_GENERATOR_PLATFORM=x64 .. ; cmake --build . --target ALL_BUILD --config Release
cd ../python-package; python setup.py install -p
cd ..
pytest tests/c_api_test/test_.py
cp Release/lib_lightgbm.dll $env:BUILD_ARTIFACTSTAGINGDIRECTORY
}
elseif ("$env:TASK" -eq "sdist"){
cd python-package; python setup.py sdist --formats gztar
cd dist; pip install @(Get-ChildItem *.gz) -v
cd ../..
}
# elseif ("$env:TASK" -eq "mingw"){
# cd python-package; python setup.py sdist --formats gztar
# cd dist; pip install @(Get-ChildItem *.gz) --install-option=--mingw -v
# cd ../..
# }
else {
cd python-package
python setup.py bdist_wheel --plat-name=win-amd64 --universal
cd dist; pip install @(Get-ChildItem *.whl)
cp @(Get-ChildItem *.whl) $env:BUILD_ARTIFACTSTAGINGDIRECTORY
cd ../..
}
pytest tests/python_package_test
cd examples/python-guide
@("import matplotlib", "matplotlib.use('Agg')") + (Get-Content "plot_example.py") | Set-Content "plot_example.py"
(Get-Content "plot_example.py").replace('graph.render(view=True)', 'graph.render(view=False)') | Set-Content "plot_example.py"
foreach ($file in @(Get-ChildItem *.py)) {
python $file
if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
} # run all examples
- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: '$(Build.ArtifactStagingDirectory)'
artifactName: PackageAssets
artifactType: container
################################################################################
- phase: Package
################################################################################
dependsOn:
- Linux
- MacOS
- Windows
queue:
name: 'Hosted VS2017'
steps:
# Download all agent packages from all previous phases
- task: DownloadBuildArtifacts@0
displayName: Download package assets
inputs:
artifactName: PackageAssets
downloadPath: $(Build.SourcesDirectory)/binaries
- powershell: |
$client = new-object System.Net.WebClient
$client.DownloadFile("https://dist.nuget.org/win-x86-commandline/latest/nuget.exe",".nuget/nuget.exe")
- script: |
cd .nuget
python create_nuget.py %BUILD_SOURCESDIRECTORY%/binaries/PackageAssets
nuget.exe pack LightGBM.nuspec
xcopy *.nupkg %BUILD_ARTIFACTSTAGINGDIRECTORY%
- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: '$(Build.ArtifactStagingDirectory)'
artifactName: Nuget
artifactType: container