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

3
4
5
6
7
8
9
10
11
12
13
14
// CI tests are executed within Docker containers as the 'root' user. However,
// communications between Jenkins nodes are done with the 'ubuntu' user(login
// via root is disallowed on AWS EC2 instances). Therefore, we need to change
// the file permission to allow 'ubuntu' user to access the files created by
// the 'root' user. This is achieved by running 'chmod -R 777 .'.

// Summary of Jenkins nodes:
// - linux-benchmark-node: Linux CPU node for authentication and lint check.
//      number of nodes: 1
//      instance type: m5.2xlarge(8 vCPUs, 32 GB memory)
//      number of executors per node: 6
//      number of jobs running on this node per CI run: 3
15
// - dgl-ci-linux-cpu: Linux CPU node for building and testing.
16
17
18
19
//      number of nodes: 4
//      instance type: m6i.24xlarge(96 vCPUs, 384 GB memory)
//      number of executors per node: 6
//      number of jobs running on this node per CI run: 8
20
// - dgl-ci-linux-gpu: Linux GPU node for building and testing.
21
22
23
24
//      number of nodes: 4
//      instance type: g4dn.4xlarge(16 vCPUs, 64 GB memory, 1 GPU)
//      number of executors per node: 1
//      number of jobs running on this node per CI run: 4
25
26
27
// - dgl-ci-windows-cpu: Windows CPU node for building and testing.
//      number of nodes: 4
//      instance type: m6i.8xlarge(32 vCPUs, 128 GB memory)
28
29
30
//      number of executors per node: 2
//      number of jobs running on this node per CI run: 3

peizhou001's avatar
peizhou001 committed
31
dgl_linux_libs = 'build/libdgl.so, build/runUnitTests, python/dgl/_ffi/_cy3/core.cpython-*-x86_64-linux-gnu.so, build/tensoradapter/pytorch/*.so, build/dgl_sparse/*.so, build/graphbolt/*.so'
Minjie Wang's avatar
Minjie Wang committed
32
// Currently DGL on Windows is not working with Cython yet
peizhou001's avatar
peizhou001 committed
33
dgl_win64_libs = "build\\dgl.dll, build\\runUnitTests.exe, build\\tensoradapter\\pytorch\\*.dll, build\\dgl_sparse\\*.dll, build\\graphbolt\\*.dll"
Minjie Wang's avatar
Minjie Wang committed
34
35

def init_git() {
36
  sh "chmod -R 777 ." // Fix permission issue
37
  sh 'rm -rf *'
38
  sh "git config --global --add safe.directory '*'"
Minjie Wang's avatar
Minjie Wang committed
39
  checkout scm
40
  sh 'git submodule update --recursive --init'
Lingfan Yu's avatar
Lingfan Yu committed
41
42
}

Minjie Wang's avatar
Minjie Wang committed
43
44
def init_git_win64() {
  checkout scm
45
  bat 'git submodule update --recursive --init'
Lingfan Yu's avatar
Lingfan Yu committed
46
47
}

Minjie Wang's avatar
Minjie Wang committed
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// pack libraries for later use
def pack_lib(name, libs) {
  echo "Packing ${libs} into ${name}"
  stash includes: libs, name: name
}

// unpack libraries saved before
def unpack_lib(name, libs) {
  unstash name
  echo "Unpacked ${libs} from ${name}"
}

def build_dgl_linux(dev) {
  init_git()
62
  sh "bash tests/scripts/build_dgl.sh ${dev}"
63
  sh 'ls -lh /usr/lib/x86_64-linux-gnu/'
Minjie Wang's avatar
Minjie Wang committed
64
  pack_lib("dgl-${dev}-linux", dgl_linux_libs)
Lingfan Yu's avatar
Lingfan Yu committed
65
66
}

Minjie Wang's avatar
Minjie Wang committed
67
def build_dgl_win64(dev) {
68
69
  /* Assuming that Windows slaves are already configured with MSBuild VS2017,
   * CMake and Python/pip/setuptools etc. */
Minjie Wang's avatar
Minjie Wang committed
70
  init_git_win64()
71
  bat "CALL tests\\scripts\\build_dgl.bat"
Minjie Wang's avatar
Minjie Wang committed
72
  pack_lib("dgl-${dev}-win64", dgl_win64_libs)
73
74
}

75
def cpp_unit_test_linux(dev) {
Minjie Wang's avatar
Minjie Wang committed
76
  init_git()
77
  unpack_lib("dgl-${dev}-linux", dgl_linux_libs)
78
  sh 'bash tests/scripts/task_cpp_unit_test.sh'
VoVAllen's avatar
VoVAllen committed
79
80
}

Minjie Wang's avatar
Minjie Wang committed
81
82
def cpp_unit_test_win64() {
  init_git_win64()
83
  unpack_lib('dgl-cpu-win64', dgl_win64_libs)
VoVAllen's avatar
VoVAllen committed
84
85
86
  bat "CALL tests\\scripts\\task_cpp_unit_test.bat"
}

Minjie Wang's avatar
Minjie Wang committed
87
def unit_test_linux(backend, dev) {
Minjie Wang's avatar
Minjie Wang committed
88
  init_git()
Minjie Wang's avatar
Minjie Wang committed
89
  unpack_lib("dgl-${dev}-linux", dgl_linux_libs)
90
  timeout(time: 40, unit: 'MINUTES') {
91
    sh "bash tests/scripts/task_unit_test.sh ${backend} ${dev}"
Minjie Wang's avatar
Minjie Wang committed
92
  }
Lingfan Yu's avatar
Lingfan Yu committed
93
94
}

95
96
97
def unit_distributed_linux(backend, dev) {
  init_git()
  unpack_lib("dgl-${dev}-linux", dgl_linux_libs)
98
  timeout(time: 40, unit: 'MINUTES') {
99
100
101
102
    sh "bash tests/scripts/task_distributed_test.sh ${backend} ${dev}"
  }
}

103
104
105
106
107
108
109
110
def unit_test_cugraph(backend, dev) {
  init_git()
  unpack_lib("dgl-${dev}-linux", dgl_linux_libs)
  timeout(time: 15, unit: 'MINUTES') {
    sh "bash tests/scripts/cugraph_unit_test.sh ${backend}"
  }
}

111
def unit_test_win64(backend, dev) {
Minjie Wang's avatar
Minjie Wang committed
112
  init_git_win64()
Minjie Wang's avatar
Minjie Wang committed
113
  unpack_lib("dgl-${dev}-win64", dgl_win64_libs)
114
  timeout(time: 50, unit: 'MINUTES') {
115
    bat "CALL tests\\scripts\\task_unit_test.bat ${backend}"
Minjie Wang's avatar
Minjie Wang committed
116
  }
Da Zheng's avatar
Da Zheng committed
117
118
}

Minjie Wang's avatar
Minjie Wang committed
119
def example_test_linux(backend, dev) {
Minjie Wang's avatar
Minjie Wang committed
120
  init_git()
Minjie Wang's avatar
Minjie Wang committed
121
  unpack_lib("dgl-${dev}-linux", dgl_linux_libs)
Minjie Wang's avatar
Minjie Wang committed
122
123
  timeout(time: 20, unit: 'MINUTES') {
    sh "bash tests/scripts/task_example_test.sh ${dev}"
Minjie Wang's avatar
Minjie Wang committed
124
125
126
  }
}

127
def example_test_win64(backend, dev) {
Minjie Wang's avatar
Minjie Wang committed
128
  init_git_win64()
Minjie Wang's avatar
Minjie Wang committed
129
  unpack_lib("dgl-${dev}-win64", dgl_win64_libs)
Minjie Wang's avatar
Minjie Wang committed
130
131
  timeout(time: 20, unit: 'MINUTES') {
    bat "CALL tests\\scripts\\task_example_test.bat ${dev}"
132
133
134
  }
}

Minjie Wang's avatar
Minjie Wang committed
135
def tutorial_test_linux(backend) {
Minjie Wang's avatar
Minjie Wang committed
136
  init_git()
137
  unpack_lib('dgl-cpu-linux', dgl_linux_libs)
Minjie Wang's avatar
Minjie Wang committed
138
139
  timeout(time: 20, unit: 'MINUTES') {
    sh "bash tests/scripts/task_${backend}_tutorial_test.sh"
Minjie Wang's avatar
Minjie Wang committed
140
  }
Lingfan Yu's avatar
Lingfan Yu committed
141
142
}

Mufei Li's avatar
Mufei Li committed
143
144
145
def go_test_linux() {
  init_git()
  unpack_lib('dgl-cpu-linux', dgl_linux_libs)
Minjie Wang's avatar
Minjie Wang committed
146
  timeout(time: 20, unit: 'MINUTES') {
Mufei Li's avatar
Mufei Li committed
147
148
149
150
    sh "bash tests/scripts/task_go_test.sh"
  }
}

151
def is_authorized(name) {
152
153
154
155
156
157
158
159
  def devs = [
    // System:
    'dgl-bot', 'noreply',
    // Core:
    'Rhett-Ying', 'BarclayII', 'jermainewang', 'mufeili', 'isratnisa',
    'rudongyu', 'classicsong', 'HuXiangkun', 'hetong007', 'kylasa',
    'frozenbugs', 'peizhou001', 'zheng-da', 'czkkkkkk', 'thvasilo',
    // Intern:
160
    'keli-wen', 'caojy1998', 'RamonZhou', 'xiangyuzhi', 'Skeleton003',
161
162
163
    // Friends:
    'nv-dlasalle', 'yaox12', 'chang-l', 'Kh4L', 'VibhuJawa', 'kkranen',
    'bgawrych', 'itaraban', 'daniil-sizov', 'anko-intel', 'Kacper-Pietkun',
164
    'hankaj', 'agrabows', 'DominikaJedynak', 'RafLit', 'mfbalin',
165
166
167
    // Emeritus:
    'VoVAllen',
  ]
168
169
170
171
172
173
  return (name in devs)
}

def is_admin(name) {
  def admins = ['dgl-bot', 'Rhett-Ying', 'BarclayII', 'jermainewang']
  return (name in admins)
174
}
VoVAllen's avatar
VoVAllen committed
175

176
177
def regression_test_done = false

Minjie Wang's avatar
Minjie Wang committed
178
pipeline {
Jinjing Zhou's avatar
Jinjing Zhou committed
179
  agent any
180
  triggers {
Rhett Ying's avatar
Rhett Ying committed
181
        issueCommentTrigger('@dgl-bot.*')
182
  }
Minjie Wang's avatar
Minjie Wang committed
183
  stages {
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
    // Below 2 stages are to authenticate the change/comment author.
    // Only core developers are allowed to trigger CI.
    // Such authentication protects CI from malicious code which may bring CI instances down.
    stage('Authentication') {
      agent {
        docker {
            label 'linux-benchmark-node'
            image 'dgllib/dgl-ci-lint'
            alwaysPull true
        }
      }
      when { not { triggeredBy 'IssueCommentCause' } }
      steps {
        script {
          def author = env.CHANGE_AUTHOR
          def prOpenTriggerCause = currentBuild.getBuildCauses('jenkins.branch.BranchEventCause')
          def first_run = prOpenTriggerCause && env.BUILD_ID == '1'
          if (author && !is_authorized(author)) {
Rhett Ying's avatar
Rhett Ying committed
202
            pullRequest.comment("Not authorized to trigger CI. Please ask core developer to help trigger via issuing comment: \n - `@dgl-bot`")
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
            error("Authentication failed.")
          }
          if (first_run) {
            pullRequest.comment('To trigger regression tests: \n - `@dgl-bot run [instance-type] [which tests] [compare-with-branch]`; \n For example: `@dgl-bot run g4dn.4xlarge all dmlc/master` or `@dgl-bot run c5.9xlarge kernel,api dmlc/master`')
          }
        }
      }
    }
    stage('AuthenticationComment') {
      agent {
        docker {
            label 'linux-benchmark-node'
            image 'dgllib/dgl-ci-lint'
            alwaysPull true
        }
      }
      when { triggeredBy 'IssueCommentCause' }
      steps {
        script {
          def author = env.GITHUB_COMMENT_AUTHOR
          if (!is_authorized(author)) {
            pullRequest.comment("Not authorized to trigger CI via issuing comment.")
            error("Authentication failed.")
          }
        }
      }
    }
    stage('Regression Test') {
231
      agent {
Jinjing Zhou's avatar
Jinjing Zhou committed
232
233
234
235
        docker {
            label 'linux-benchmark-node'
            image 'dgllib/dgl-ci-lint'
            alwaysPull true
Jinjing Zhou's avatar
Jinjing Zhou committed
236
        }
VoVAllen's avatar
VoVAllen committed
237
      }
238
      when { triggeredBy 'IssueCommentCause' }
Minjie Wang's avatar
Minjie Wang committed
239
      steps {
Jinjing Zhou's avatar
Jinjing Zhou committed
240
241
          checkout scm
          script {
242
              def comment = env.GITHUB_COMMENT
Rhett Ying's avatar
Rhett Ying committed
243
244
245
246
247
248
249
250
251
              def command_lists = comment.split(' ')
              if (command_lists.size() == 1) {
                // CI command, not for regression
                return
              }
              if (command_lists.size() != 5) {
                pullRequest.comment('Cannot run the regression test due to unknown command')
                error('Unknown command')
              }
252
              def author = env.GITHUB_COMMENT_AUTHOR
253
254
              echo("${env.GIT_URL}")
              echo("${env}")
255
              if (!is_admin(author)) {
256
                error('Not authorized to launch regression tests')
257
258
              }
              dir('benchmark_scripts_repo') {
Jinjing Zhou's avatar
Jinjing Zhou committed
259
260
                checkout([$class: 'GitSCM', branches: [[name: '*/master']],
                        userRemoteConfigs: [[credentialsId: 'github', url: 'https://github.com/dglai/DGL_scripts.git']]])
261
262
263
              }
              sh('cp benchmark_scripts_repo/benchmark/* benchmarks/scripts/')
              def instance_type = command_lists[2].replace('.', '')
Jinjing Zhou's avatar
Jinjing Zhou committed
264
              pullRequest.comment("Start the Regression test. View at ${RUN_DISPLAY_URL}")
265
              def prNumber = env.BRANCH_NAME.replace('PR-', '')
266
267
              dir('benchmarks/scripts') {
                sh('python3 -m pip install boto3')
268
                sh("PYTHONUNBUFFERED=1 GIT_PR_ID=${prNumber} GIT_URL=${env.GIT_URL} GIT_BRANCH=${env.CHANGE_BRANCH} python3 run_reg_test.py --data-folder ${env.GIT_COMMIT}_${instance_type} --run-cmd '${comment}'")
269
270
271
              }
              pullRequest.comment("Finished the Regression test. Result table is at https://dgl-asv-data.s3-us-west-2.amazonaws.com/${env.GIT_COMMIT}_${instance_type}/results/result.csv. Jenkins job link is ${RUN_DISPLAY_URL}. ")
              currentBuild.result = 'SUCCESS'
272
              regression_test_done = true
Jinjing Zhou's avatar
Jinjing Zhou committed
273
          }
274
      }
Minjie Wang's avatar
Minjie Wang committed
275
    }
Jinjing Zhou's avatar
Jinjing Zhou committed
276
    stage('CI') {
277
      when { expression { !regression_test_done } }
Jinjing Zhou's avatar
Jinjing Zhou committed
278
      stages {
279
280
281
        stage('Abort Previous CI') {
          steps {
            script {
282
283
284
285
286
287
288
289
              if (env.BRANCH_NAME != "master") {
                // Jenkins will abort an older build if a newer build already
                // passed a higher milestone.
                // https://www.jenkins.io/doc/pipeline/steps/pipeline-milestone-step/
                def buildNumber = env.BUILD_NUMBER as int
                for (int i = 1; i <= buildNumber; i++) {
                  milestone(i)
                }
290
291
292
293
294
              }
            }
          }
        }

295
296
        stage('Lint Check') {
          agent {
Jinjing Zhou's avatar
Jinjing Zhou committed
297
            docker {
298
              label "linux-benchmark-node"
Mufei Li's avatar
Mufei Li committed
299
              image "dgllib/dgl-ci-lint"
Jinjing Zhou's avatar
Jinjing Zhou committed
300
              alwaysPull true
VoVAllen's avatar
VoVAllen committed
301
302
            }
          }
Minjie Wang's avatar
Minjie Wang committed
303
          steps {
304
305
            init_git()
            sh 'bash tests/scripts/task_lint.sh'
VoVAllen's avatar
VoVAllen committed
306
          }
307
308
309
310
311
          post {
            always {
              cleanWs disableDeferredWipeout: true, deleteDirs: true
            }
          }
VoVAllen's avatar
VoVAllen committed
312
        }
Mufei Li's avatar
Mufei Li committed
313

314
315
316
317
        stage('Build') {
          parallel {
            stage('CPU Build') {
              agent {
Jinjing Zhou's avatar
Jinjing Zhou committed
318
                docker {
319
                  label "dgl-ci-linux-cpu"
320
                  image "dgllib/dgl-ci-cpu:v230711"
Jinjing Zhou's avatar
Jinjing Zhou committed
321
322
                  args "-u root"
                  alwaysPull true
323
                }
Jinjing Zhou's avatar
Jinjing Zhou committed
324
325
              }
              steps {
326
                build_dgl_linux('cpu')
Jinjing Zhou's avatar
Jinjing Zhou committed
327
              }
328
329
              post {
                always {
330
                  sh "chmod -R 777 ." // Fix permission issue
331
332
                  cleanWs disableDeferredWipeout: true, deleteDirs: true
                }
Minjie Wang's avatar
Minjie Wang committed
333
              }
Lingfan Yu's avatar
Lingfan Yu committed
334
            }
335
336
            stage('GPU Build') {
              agent {
Jinjing Zhou's avatar
Jinjing Zhou committed
337
                docker {
338
                  label "dgl-ci-linux-cpu"
339
                  image "dgllib/dgl-ci-gpu:cu116_v230711"
Jinjing Zhou's avatar
Jinjing Zhou committed
340
341
                  args "-u root"
                  alwaysPull true
342
                }
Minjie Wang's avatar
Minjie Wang committed
343
344
              }
              steps {
345
346
                // sh "nvidia-smi"
                build_dgl_linux('gpu')
Minjie Wang's avatar
Minjie Wang committed
347
              }
348
349
              post {
                always {
350
                  sh "chmod -R 777 ." // Fix permission issue
351
352
                  cleanWs disableDeferredWipeout: true, deleteDirs: true
                }
Minjie Wang's avatar
Minjie Wang committed
353
              }
354
            }
355
356
357
            stage('PyTorch Cugraph GPU Build') {
              agent {
                docker {
358
                  label "dgl-ci-linux-cpu"
359
                  image "rapidsai/cugraph_stable_torch-cuda:11.8-base-ubuntu20.04-py3.10-pytorch2.0.0-rapids23.04"
360
                  args "-u root"
361
                  alwaysPull true
362
363
364
365
366
367
368
                }
              }
              steps {
                build_dgl_linux('cugraph')
              }
              post {
                always {
369
                  sh "chmod -R 777 ." // Fix permission issue
370
371
372
373
                  cleanWs disableDeferredWipeout: true, deleteDirs: true
                }
              }
            }
374
            stage('CPU Build (Win64)') {
375
              agent { label 'dgl-ci-windows-cpu' }
Minjie Wang's avatar
Minjie Wang committed
376
              steps {
377
378
379
380
381
382
                build_dgl_win64('cpu')
              }
              post {
                always {
                  cleanWs disableDeferredWipeout: true, deleteDirs: true
                }
Minjie Wang's avatar
Minjie Wang committed
383
              }
Lingfan Yu's avatar
Lingfan Yu committed
384
            }
385
          // Currently we don't have Windows GPU build machines
386
          }
Lingfan Yu's avatar
Lingfan Yu committed
387
        }
388
389
390
391
        stage('Test') {
          parallel {
            stage('C++ CPU') {
              agent {
Jinjing Zhou's avatar
Jinjing Zhou committed
392
                docker {
393
                  label "dgl-ci-linux-cpu"
394
                  image "dgllib/dgl-ci-cpu:v230711"
395
                  args "-u root"
Jinjing Zhou's avatar
Jinjing Zhou committed
396
                  alwaysPull true
397
398
                }
              }
Minjie Wang's avatar
Minjie Wang committed
399
              steps {
400
401
402
403
                cpp_unit_test_linux('cpu')
              }
              post {
                always {
404
                  sh "chmod -R 777 ." // Fix permission issue
405
406
407
408
409
410
                  cleanWs disableDeferredWipeout: true, deleteDirs: true
                }
              }
            }
            stage('C++ GPU') {
              agent {
Jinjing Zhou's avatar
Jinjing Zhou committed
411
                docker {
412
                  label "dgl-ci-linux-gpu"
413
                  image "dgllib/dgl-ci-gpu:cu116_v230711"
414
                  args "-u root --runtime nvidia"
Jinjing Zhou's avatar
Jinjing Zhou committed
415
                  alwaysPull true
416
417
418
419
                }
              }
              steps {
                cpp_unit_test_linux('gpu')
420
421
422
              }
              post {
                always {
423
                  sh "chmod -R 777 ." // Fix permission issue
424
425
                  cleanWs disableDeferredWipeout: true, deleteDirs: true
                }
Minjie Wang's avatar
Minjie Wang committed
426
427
              }
            }
428
            stage('C++ CPU (Win64)') {
429
              agent { label 'dgl-ci-windows-cpu' }
Minjie Wang's avatar
Minjie Wang committed
430
              steps {
431
432
433
434
435
436
                cpp_unit_test_win64()
              }
              post {
                always {
                  cleanWs disableDeferredWipeout: true, deleteDirs: true
                }
Minjie Wang's avatar
Minjie Wang committed
437
              }
Minjie Wang's avatar
Minjie Wang committed
438
            }
439
440
            stage('Tensorflow CPU') {
              agent {
Jinjing Zhou's avatar
Jinjing Zhou committed
441
                docker {
442
                  label "dgl-ci-linux-cpu"
443
                  image "dgllib/dgl-ci-cpu:v230810"
444
                  args "-u root"
Jinjing Zhou's avatar
Jinjing Zhou committed
445
                  alwaysPull true
446
447
448
                }
              }
              stages {
449
                stage('Tensorflow CPU Unit test') {
450
451
452
453
454
455
456
                  steps {
                    unit_test_linux('tensorflow', 'cpu')
                  }
                }
              }
              post {
                always {
457
                  sh "chmod -R 777 ." // Fix permission issue
458
459
460
                  cleanWs disableDeferredWipeout: true, deleteDirs: true
                }
              }
461
            }
462
463
            stage('Tensorflow GPU') {
              agent {
Jinjing Zhou's avatar
Jinjing Zhou committed
464
                docker {
465
                  label "dgl-ci-linux-gpu"
466
                  image "dgllib/dgl-ci-gpu:cu116_v230711"
467
                  args "-u root --runtime nvidia"
Jinjing Zhou's avatar
Jinjing Zhou committed
468
                  alwaysPull true
469
470
471
                }
              }
              stages {
472
                stage('Tensorflow GPU Unit test') {
473
474
475
                  steps {
                    unit_test_linux('tensorflow', 'gpu')
                  }
476
477
                  // Tensorflow does not support cuda 11.6 yet.
                  when { expression { false } }
478
479
480
481
                }
              }
              post {
                always {
482
                  sh "chmod -R 777 ." // Fix permission issue
483
484
485
                  cleanWs disableDeferredWipeout: true, deleteDirs: true
                }
              }
VoVAllen's avatar
VoVAllen committed
486
            }
487
488
            stage('Torch CPU') {
              agent {
Jinjing Zhou's avatar
Jinjing Zhou committed
489
                docker {
490
                  label "dgl-ci-linux-cpu"
491
                  image "dgllib/dgl-ci-cpu:v230711"
492
                  args "-u root --shm-size=4gb"
Jinjing Zhou's avatar
Jinjing Zhou committed
493
                  alwaysPull true
494
495
496
                }
              }
              stages {
497
                stage('Torch CPU Unit test') {
498
499
500
501
                  steps {
                    unit_test_linux('pytorch', 'cpu')
                  }
                }
502
                stage('Torch CPU Example test') {
503
504
505
506
                  steps {
                    example_test_linux('pytorch', 'cpu')
                  }
                }
507
                stage('Torch CPU Tutorial test') {
508
509
510
511
512
513
514
                  steps {
                    tutorial_test_linux('pytorch')
                  }
                }
              }
              post {
                always {
515
                  sh "chmod -R 777 ." // Fix permission issue
516
517
                  cleanWs disableDeferredWipeout: true, deleteDirs: true
                }
VoVAllen's avatar
VoVAllen committed
518
              }
Da Zheng's avatar
Da Zheng committed
519
            }
520
            stage('Torch CPU (Win64)') {
521
              agent { label 'dgl-ci-windows-cpu' }
522
              stages {
523
                stage('Torch CPU (Win64) Unit test') {
524
525
526
527
                  steps {
                    unit_test_win64('pytorch', 'cpu')
                  }
                }
528
                stage('Torch CPU (Win64) Example test') {
529
530
531
532
533
534
535
536
537
538
                  steps {
                    example_test_win64('pytorch', 'cpu')
                  }
                }
              }
              post {
                always {
                  cleanWs disableDeferredWipeout: true, deleteDirs: true
                }
              }
539
            }
540
541
            stage('Torch GPU') {
              agent {
Jinjing Zhou's avatar
Jinjing Zhou committed
542
                docker {
543
                  label "dgl-ci-linux-gpu"
544
                  image "dgllib/dgl-ci-gpu:cu116_v230711"
545
                  args "-u root --runtime nvidia --shm-size=8gb"
Jinjing Zhou's avatar
Jinjing Zhou committed
546
                  alwaysPull true
547
548
549
                }
              }
              stages {
550
                stage('Torch GPU Unit test') {
551
552
553
554
555
                  steps {
                    sh 'nvidia-smi'
                    unit_test_linux('pytorch', 'gpu')
                  }
                }
556
                stage('Torch GPU Example test') {
557
558
559
560
561
562
563
                  steps {
                    example_test_linux('pytorch', 'gpu')
                  }
                }
              }
              post {
                always {
564
                  sh "chmod -R 777 ." // Fix permission issue
565
566
567
                  cleanWs disableDeferredWipeout: true, deleteDirs: true
                }
              }
568
            }
569
570
571
            stage('Distributed') {
              agent {
                docker {
572
                  label "dgl-ci-linux-cpu"
573
                  image "dgllib/dgl-ci-cpu:v230711"
574
                  args "-u root --shm-size=4gb"
575
576
577
578
579
580
581
582
                  alwaysPull true
                }
              }
              stages {
                stage('Distributed Torch CPU Unit test') {
                  steps {
                    unit_distributed_linux('pytorch', 'cpu')
                  }
583
                  when { expression { false } }
584
585
586
587
                }
              }
              post {
                always {
588
                  sh "chmod -R 777 ." // Fix permission issue
589
590
591
592
                  cleanWs disableDeferredWipeout: true, deleteDirs: true
                }
              }
            }
593
594
595
            stage('PyTorch Cugraph GPU') {
              agent {
                docker {
596
                  label "dgl-ci-linux-gpu"
597
                  image "rapidsai/cugraph_stable_torch-cuda:11.8-base-ubuntu20.04-py3.10-pytorch2.0.0-rapids23.04"
598
                  args "-u root --runtime nvidia --shm-size=8gb"
599
                  alwaysPull true
600
601
602
603
604
605
606
607
608
609
610
611
                }
              }
              stages {
                stage('PyTorch Cugraph GPU Unit test') {
                  steps {
                    sh 'nvidia-smi'
                    unit_test_cugraph('pytorch', 'cugraph')
                  }
                }
              }
              post {
                always {
612
                  sh "chmod -R 777 ." // Fix permission issue
613
614
615
616
                  cleanWs disableDeferredWipeout: true, deleteDirs: true
                }
              }
            }
Minjie Wang's avatar
Minjie Wang committed
617
618
619
            stage('DGL-Go') {
              agent {
                docker {
620
                  label "dgl-ci-linux-cpu"
621
                  image "dgllib/dgl-ci-cpu:v230711"
622
                  args "-u root"
Minjie Wang's avatar
Minjie Wang committed
623
624
625
626
627
628
629
630
631
632
633
634
                  alwaysPull true
                }
              }
              stages {
                stage('DGL-Go CPU test') {
                  steps {
                    go_test_linux()
                  }
                }
              }
              post {
                always {
635
                  sh "chmod -R 777 ." // Fix permission issue
Minjie Wang's avatar
Minjie Wang committed
636
637
638
639
                  cleanWs disableDeferredWipeout: true, deleteDirs: true
                }
              }
            }
640
641
          }
        }
Minjie Wang's avatar
Minjie Wang committed
642
      }
Minjie Wang's avatar
Minjie Wang committed
643
    }
Minjie Wang's avatar
Minjie Wang committed
644
  }
645
646
  post {
    always {
647
      script {
648
        node("dglci-post-linux") {
649
650
651
          docker.image('dgllib/dgl-ci-awscli:v220418').inside("--pull always --entrypoint=''") {
            sh("rm -rf ci_tmp")
            dir('ci_tmp') {
652
              sh("curl -k -o cireport.log ${BUILD_URL}consoleText")
Rhett Ying's avatar
Rhett Ying committed
653
654
              sh("curl -o report.py https://raw.githubusercontent.com/dmlc/dgl/master/tests/scripts/ci_report/report.py")
              sh("curl -o status.py https://raw.githubusercontent.com/dmlc/dgl/master/tests/scripts/ci_report/status.py")
655
              sh("curl -k -L ${BUILD_URL}wfapi")
656
657
658
659
660
              sh("cat status.py")
              sh("pytest --html=report.html --self-contained-html report.py || true")
              sh("aws s3 sync ./ s3://dgl-ci-result/${JOB_NAME}/${BUILD_NUMBER}/${BUILD_ID}/logs/  --exclude '*' --include '*.log' --acl public-read --content-type text/plain")
              sh("aws s3 sync ./ s3://dgl-ci-result/${JOB_NAME}/${BUILD_NUMBER}/${BUILD_ID}/logs/  --exclude '*.log' --acl public-read")

661
              def comment = sh(returnStdout: true, script: "python3 status.py --result ${currentBuild.currentResult}").trim()
662
              echo(comment)
663
664
665
              if ((env.BRANCH_NAME).startsWith('PR-')) {
                pullRequest.comment(comment)
              }
666
667
668
            }
          }
        }
669
        node('dgl-ci-windows-cpu') {
670
671
            bat(script: "rmvirtualenv ${BUILD_TAG}", returnStatus: true)
        }
672
673
674
      }
    }
  }
Minjie Wang's avatar
Minjie Wang committed
675
}