Jenkinsfile 5.94 KB
Newer Older
Lingfan Yu's avatar
Lingfan Yu committed
1
2
#!/usr/bin/env groovy

Lingfan Yu's avatar
Lingfan Yu committed
3
def init_git_submodule() {
Minjie Wang's avatar
Minjie Wang committed
4
5
  sh "git submodule init"
  sh "git submodule update"
Lingfan Yu's avatar
Lingfan Yu committed
6
7
}

8
9
10
def init_git_submodule_win64() {
  bat "git submodule init"
  bat "git submodule update"
Lingfan Yu's avatar
Lingfan Yu committed
11
12
}

Lingfan Yu's avatar
Lingfan Yu committed
13
def build_dgl() {
14
  sh "bash tests/scripts/build_dgl.sh"
Lingfan Yu's avatar
Lingfan Yu committed
15
16
}

17
18
19
20
21
22
def build_dgl_win64() {
  /* Assuming that Windows slaves are already configured with MSBuild VS2017,
   * CMake and Python/pip/setuptools etc. */
  bat "CALL tests\\scripts\\build_dgl.bat"
}

VoVAllen's avatar
VoVAllen committed
23
24
25
26
27
28
29
30
def cpp_unit_test_linux(){
  sh "bash tests/scripts/task_cpp_unit_test.sh"
}

def cpp_unit_test_windows(){
  bat "CALL tests\\scripts\\task_cpp_unit_test.bat"
}

31
32
33
def unit_test(backend, dev) {
  withEnv(["DGL_LIBRARY_PATH=${env.WORKSPACE}/build", "PYTHONPATH=${env.WORKSPACE}/python", "DGLBACKEND=${backend}"]) {
    sh "bash tests/scripts/task_unit_test.sh ${backend}"
Minjie Wang's avatar
Minjie Wang committed
34
  }
Lingfan Yu's avatar
Lingfan Yu committed
35
36
}

37
38
39
def unit_test_win64(backend, dev) {
  withEnv(["DGL_LIBRARY_PATH=${env.WORKSPACE}\\build", "PYTHONPATH=${env.WORKSPACE}\\python", "DGLBACKEND=${backend}"]) {
    bat "CALL tests\\scripts\\task_unit_test.bat ${backend}"
Minjie Wang's avatar
Minjie Wang committed
40
  }
Da Zheng's avatar
Da Zheng committed
41
42
}

43
44
def example_test(backend, dev) {
  withEnv(["DGL_LIBRARY_PATH=${env.WORKSPACE}/build", "PYTHONPATH=${env.WORKSPACE}/python", "DGLBACKEND=${backend}"]) {
Minjie Wang's avatar
Minjie Wang committed
45
    dir ("tests/scripts") {
46
      sh "bash task_example_test.sh ${dev}"
Minjie Wang's avatar
Minjie Wang committed
47
48
49
50
    }
  }
}

51
52
53
54
55
56
57
58
def example_test_win64(backend, dev) {
  withEnv(["DGL_LIBRARY_PATH=${env.WORKSPACE}\\build", "PYTHONPATH=${env.WORKSPACE}\\python", "DGLBACKEND=${backend}"]) {
    dir ("tests\\scripts") {
      bat "CALL task_example_test ${dev}"
    }
  }
}

Minjie Wang's avatar
Minjie Wang committed
59
def pytorch_tutorials() {
Minjie Wang's avatar
Minjie Wang committed
60
61
  withEnv(["DGL_LIBRARY_PATH=${env.WORKSPACE}/build", "PYTHONPATH=${env.WORKSPACE}/python"]) {
    dir ("tests/scripts") {
62
      sh "bash task_pytorch_tutorial_test.sh"
Lingfan Yu's avatar
Lingfan Yu committed
63
    }
Minjie Wang's avatar
Minjie Wang committed
64
  }
Lingfan Yu's avatar
Lingfan Yu committed
65
66
}

67
def mxnet_tutorials() {
68
  withEnv(["DGL_LIBRARY_PATH=${env.WORKSPACE}/build", "PYTHONPATH=${env.WORKSPACE}/python", "DGLBACKEND=mxnet"]) {
69
70
71
72
73
    dir("tests/scripts") {
      sh "bash task_mxnet_tutorial_test.sh"
    }
  }
}
Minjie Wang's avatar
Minjie Wang committed
74
pipeline {
Minjie Wang's avatar
Minjie Wang committed
75
76
77
  agent none
  stages {
    stage("Lint Check") {
78
79
80
      agent {
        docker { image "dgllib/dgl-ci-lint" }
      }
Minjie Wang's avatar
Minjie Wang committed
81
82
      steps {
        init_git_submodule()
83
        sh "bash tests/scripts/task_lint.sh"
Minjie Wang's avatar
Minjie Wang committed
84
85
86
87
88
      }
    }
    stage("Build") {
      parallel {
        stage("CPU Build") {
89
90
91
          agent {
            docker { image "dgllib/dgl-ci-cpu" }
          }
Minjie Wang's avatar
Minjie Wang committed
92
          steps {
93
            init_git_submodule()
Minjie Wang's avatar
Minjie Wang committed
94
95
96
97
98
99
100
101
102
103
104
            build_dgl()
          }
        }
        stage("GPU Build") {
          agent {
            docker {
              image "dgllib/dgl-ci-gpu"
              args "--runtime nvidia"
            }
          }
          steps {
105
            init_git_submodule()
Minjie Wang's avatar
Minjie Wang committed
106
107
108
109
            build_dgl()
          }
        }
        stage("MXNet CPU Build (temp)") {
110
111
112
          agent {
            docker { image "dgllib/dgl-ci-mxnet-cpu" }
          }
Minjie Wang's avatar
Minjie Wang committed
113
          steps {
114
            init_git_submodule()
Minjie Wang's avatar
Minjie Wang committed
115
116
117
            build_dgl()
          }
        }
118
119
120
121
122
123
124
125
126
        stage("CPU Build (Win64/PyTorch)") {
          agent {
            label "windows"
          }
          steps {
            init_git_submodule_win64()
            build_dgl_win64()
          }
        }
Minjie Wang's avatar
Minjie Wang committed
127
128
129
130
      }
    }
    stage("Test") {
      parallel {
VoVAllen's avatar
VoVAllen committed
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
        stage("CPP Test"){
          stages{
            stage("CPP Unit Test Linux"){
              agent {
                docker {image "dgllib/dgl-ci-cpu"}
              }
              steps { 
                init_git_submodule()
                cpp_unit_test_linux() 
              }
            }
            stage("CPP Unit Test Windows"){
              agent {
                label "windows"
              }
              steps {
                init_git_submodule_win64()
                cpp_unit_test_windows()
              }
            }
          }
        }
Minjie Wang's avatar
Minjie Wang committed
153
        stage("Pytorch CPU") {
154
155
156
          agent {
            docker { image "dgllib/dgl-ci-cpu" }
          }
Minjie Wang's avatar
Minjie Wang committed
157
158
          stages {
            stage("TH CPU unittest") {
159
              steps { unit_test("pytorch", "CPU") }
Lingfan Yu's avatar
Lingfan Yu committed
160
            }
Minjie Wang's avatar
Minjie Wang committed
161
            stage("TH CPU example test") {
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
              steps { example_test("pytorch", "CPU") }
            }
          }
          post {
            always { junit "*.xml" }
          }
        }
        stage("Pytorch CPU (Windows)") {
          agent { label "windows" }
          stages {
            stage("TH CPU Win64 unittest") {
              steps { unit_test_win64("pytorch", "CPU") }
            }
            stage("TH CPU Win64 example test") {
              steps { example_test_win64("pytorch", "CPU") }
Lingfan Yu's avatar
Lingfan Yu committed
177
            }
Minjie Wang's avatar
Minjie Wang committed
178
179
180
181
          }
          post {
            always { junit "*.xml" }
          }
Lingfan Yu's avatar
Lingfan Yu committed
182
        }
Minjie Wang's avatar
Minjie Wang committed
183
184
185
186
187
        stage("Pytorch GPU") {
          agent {
            docker {
              image "dgllib/dgl-ci-gpu"
              args "--runtime nvidia"
Minjie Wang's avatar
Minjie Wang committed
188
            }
Minjie Wang's avatar
Minjie Wang committed
189
190
191
192
193
194
195
          }
          stages {
            // TODO: have GPU unittest
            //stage("TH GPU unittest") {
            //  steps { pytorch_unit_test("GPU") }
            //}
            stage("TH GPU example test") {
196
              steps { example_test("pytorch", "GPU") }
Minjie Wang's avatar
Minjie Wang committed
197
198
199
200
201
202
            }
          }
          // TODO: have GPU unittest
          //post {
          //  always { junit "*.xml" }
          //}
Minjie Wang's avatar
Minjie Wang committed
203
        }
Minjie Wang's avatar
Minjie Wang committed
204
        stage("MXNet CPU") {
205
206
207
          agent {
            docker { image "dgllib/dgl-ci-mxnet-cpu" }
          }
Minjie Wang's avatar
Minjie Wang committed
208
209
          stages {
            stage("MX Unittest") {
VoVAllen's avatar
VoVAllen committed
210
211
212
              options {
                  timeout(time: 5, unit: 'MINUTES') 
              }
213
              steps { unit_test("mxnet", "CPU") }
Da Zheng's avatar
Da Zheng committed
214
            }
Minjie Wang's avatar
Minjie Wang committed
215
216
217
218
          }
          post {
            always { junit "*.xml" }
          }
Da Zheng's avatar
Da Zheng committed
219
        }
Minjie Wang's avatar
Minjie Wang committed
220
221
222
      }
    }
    stage("Doc") {
223
224
      parallel {
        stage("TH Tutorial") {
225
226
227
          agent {
            docker { image "dgllib/dgl-ci-cpu" }
          }
228
229
230
231
          steps {
            pytorch_tutorials()
          }
        }
Da Zheng's avatar
Da Zheng committed
232
233
234
235
236
237
238
239
        //stage("MX Tutorial") {
        //  agent {
        //    docker { image "dgllib/dgl-ci-mxnet-cpu" }
        //  }
        //  steps {
        //    mxnet_tutorials()
        //  }
        //}
Minjie Wang's avatar
Minjie Wang committed
240
      }
Minjie Wang's avatar
Minjie Wang committed
241
    }
Minjie Wang's avatar
Minjie Wang committed
242
  }
Minjie Wang's avatar
Minjie Wang committed
243
}