.vsts-ci.yml 5.16 KB
Newer Older
1
2
3
variables:
  PYTHON_VERSION: 3.6
  CONDA_ENV: test-env
Guolin Ke's avatar
Guolin Ke committed
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
phases:
###########################################
- phase: Linux
###########################################
  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)
37
      packageSpecs: 'python=$(PYTHON_VERSION)'
Guolin Ke's avatar
Guolin Ke committed
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
      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
Guolin Ke's avatar
Guolin Ke committed
59
    condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/'))
Guolin Ke's avatar
Guolin Ke committed
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
    inputs:
      pathtoPublish: '$(Build.ArtifactStagingDirectory)' 
      artifactName: PackageAssets
      artifactType: container
###########################################
- phase: MacOS
###########################################
  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: |
82
83
      brew install libomp
      brew reinstall cmake
Guolin Ke's avatar
Guolin Ke committed
84
85
86
87
88
89
90
91
92
      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
Guolin Ke's avatar
Guolin Ke committed
93
    condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/'))
Guolin Ke's avatar
Guolin Ke committed
94
95
96
97
98
99
100
101
102
    inputs:
      pathtoPublish: '$(Build.ArtifactStagingDirectory)' 
      artifactName: PackageAssets
      artifactType: container
###########################################
- phase: Windows
###########################################
  queue:
    name: 'Hosted VS2017'
103
    parallel: 3
Guolin Ke's avatar
Guolin Ke committed
104
105
106
    matrix:
      regular:
        TASK: regular
107
        PYTHON_VERSION: 3.5
Guolin Ke's avatar
Guolin Ke committed
108
109
110
111
112
      sdist:
        TASK: sdist
        PYTHON_VERSION: 2.7
      bdist:
        TASK: bdist
113
        PYTHON_VERSION: 3.6
Guolin Ke's avatar
Guolin Ke committed
114
115
116
  steps:
  - task: CondaEnvironment@0
    inputs:
117
      updateConda: true
Guolin Ke's avatar
Guolin Ke committed
118
      environmentName: $(CONDA_ENV)
119
      packageSpecs: 'python=$(PYTHON_VERSION) numpy nose scipy scikit-learn pandas matplotlib python-graphviz pytest'
Guolin Ke's avatar
Guolin Ke committed
120
      createOptions: '-q'
121
122
  - powershell: $(Build.SourcesDirectory)/.vsts-ci/test_windows.ps1
    displayName: Test
Guolin Ke's avatar
Guolin Ke committed
123
  - task: PublishBuildArtifacts@1
Guolin Ke's avatar
Guolin Ke committed
124
    condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/'))
Guolin Ke's avatar
Guolin Ke committed
125
    inputs:
126
      pathtoPublish: '$(Build.ArtifactStagingDirectory)'
Guolin Ke's avatar
Guolin Ke committed
127
128
      artifactName: PackageAssets
      artifactType: container
Guolin Ke's avatar
Guolin Ke committed
129

130
###########################################
Guolin Ke's avatar
Guolin Ke committed
131
- phase: Package
132
###########################################
Guolin Ke's avatar
Guolin Ke committed
133
134
135
136
  dependsOn:
  - Linux
  - MacOS
  - Windows
Guolin Ke's avatar
Guolin Ke committed
137
  condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/'))
Guolin Ke's avatar
Guolin Ke committed
138
139
140
141
142
143
144
145
146
147
148
  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
149
150
      $client.DownloadFile("https://dist.nuget.org/win-x86-commandline/latest/nuget.exe", "$(Build.SourcesDirectory)/.nuget/nuget.exe")
    displayName: 'Download NuGet application'
Guolin Ke's avatar
Guolin Ke committed
151
  - script: |
152
      cd %BUILD_SOURCESDIRECTORY%/.nuget
Guolin Ke's avatar
Guolin Ke committed
153
154
155
      python create_nuget.py %BUILD_SOURCESDIRECTORY%/binaries/PackageAssets
      nuget.exe pack LightGBM.nuspec
      xcopy *.nupkg %BUILD_ARTIFACTSTAGINGDIRECTORY%
156
    displayName: 'Build NuGet package'
Guolin Ke's avatar
Guolin Ke committed
157
158
  - task: PublishBuildArtifacts@1
    inputs:
159
      pathtoPublish: '$(Build.ArtifactStagingDirectory)'
Guolin Ke's avatar
Guolin Ke committed
160
161
      artifactName: Nuget
      artifactType: container