forked from gadgetron/gadgetron
-
Notifications
You must be signed in to change notification settings - Fork 6
/
azure-pipelines.yml
129 lines (121 loc) · 4.35 KB
/
azure-pipelines.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
variables:
AzureConnection: 'BiomedicalImaging-NonProd(87d8acb3-5176-4651-b457-6ab9cefd8e3d)'
AcrConnection: 'gadgetron-acr'
AcrRegistryAddress: 'gadgetron.azurecr.io'
AcrRegistryName: 'gadgetronbuild'
ContainerRegistry: 'ghcr.io/gadgetron/gadgetron'
pool: gadgetron-gpu-nodes
# Trigger when merging to master
trigger:
- master
# Trigger for PRs that merge to master
pr:
- master
jobs:
- job: buildAndPushBaseImages
displayName: "Build base images"
strategy:
matrix:
ubuntu2004:
imageName: gadgetron_ubuntu_2004_base
dockerFile: docker/ubuntu_base.Dockerfile
baseImage: ubuntu:20.04
ubuntu2004CUDA:
imageName: gadgetron_ubuntu_2004_cuda11_cudnn8_base
dockerFile: docker/ubuntu_base.Dockerfile
baseImage: nvidia/cuda:11.0-devel-ubuntu20.04
steps:
- template: ./build-jobs/docker-build-push-acr.yaml
parameters:
acrconnection: $(AcrConnection)
dockerfile: $(dockerFile)
imageName: $(imageName)
containerregistry: $(AcrRegistryName)
baseimage: $(baseImage)
- job: buildAndPush
displayName: "Build and Push"
dependsOn:
- buildAndPushBaseImages
strategy:
matrix:
ubuntu2004:
imageName: gadgetron_ubuntu_2004
dockerFile: Dockerfile
baseimage: $(AcrRegistryAddress)/$(AcrRegistryName)/gadgetron_ubuntu_2004_base:$(build.BuildNumber)
ubuntu2004CUDA:
imageName: gadgetron_ubuntu_2004_cuda11_cudnn8
dockerFile: Dockerfile
baseimage: $(AcrRegistryAddress)/$(AcrRegistryName)/gadgetron_ubuntu_2004_cuda11_cudnn8_base:$(build.BuildNumber)
steps:
- template: ./build-jobs/docker-build-push-acr.yaml
parameters:
acrconnection: $(AcrConnection)
dockerfile: $(dockerFile)
imageName: $(imageName)
containerregistry: $(AcrRegistryName)
baseimage: $(baseImage)
- job: Tests
displayName: "Unit and Integration tests"
dependsOn:
- buildAndPush
strategy:
matrix:
ubuntu2004:
imageName: gadgetron_ubuntu_2004
requirements: python
ubuntu2004CUDA:
imageName: gadgetron_ubuntu_2004_cuda11_cudnn8
requirements: python,cuda
steps:
- task: Docker@2
displayName: Login to ACR
inputs:
command: login
containerRegistry: $(AcrConnection)
- script: |
set -e
fullImageName="$(AcrRegistryAddress)/$(AcrRegistryName)/$(imageName):$(build.BuildNumber)"
docker run --gpus all --rm $fullImageName /opt/code/gadgetron/build/test/test_all
displayName: "Run unit tests"
- script: |
set -e
mkdir -p testdata
fullImageName="$(AcrRegistryAddress)/$(AcrRegistryName)/$(imageName):$(build.BuildNumber)"
docker run -v $(pwd)/testdata:/opt/code/gadgetron/test/integration/data --rm $fullImageName /bin/bash -c "cd /opt/code/gadgetron/test/integration/ && ./get_data.py"
displayName: "Get test data"
- script: |
set -e
fullImageName="$(AcrRegistryAddress)/$(AcrRegistryName)/$(imageName):$(build.BuildNumber)"
docker run --gpus all -v $(pwd)/testdata:/opt/code/gadgetron/test/integration/data --rm $fullImageName /bin/bash -c "cd /opt/code/gadgetron/test/integration/ && ./run_tests.py --echo-log-on-failure --timeout=600 --ignore-requirements=$requirements -F --stats stats.csv cases/* && python3 stats_to_junit.py -i stats.csv -o data/junit.xml"
displayName: "Run integration tests"
- task: PublishTestResults@2
inputs:
testRunner: JUnit
testResultsFiles: 'testdata/junit.xml'
failTaskOnFailedTests: true
buildPlatform: $(imageName)
- job:
displayName: "Tag latest images"
dependsOn:
- Tests
condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'))
strategy:
matrix:
ubuntu2004_base:
imageName: gadgetron_ubuntu_2004_base
ubuntu2004CUDA_base:
imageName: gadgetron_ubuntu_2004_cuda11_cudnn8_base
ubuntu2004:
imageName: gadgetron_ubuntu_2004
ubuntu2004CUDA:
imageName: gadgetron_ubuntu_2004_cuda11_cudnn8
steps:
- template: ./build-jobs/tag-docker-image.yaml
parameters:
acrconnection: $(AcrConnection)
azureconnection: $(AzureConnection)
imagename: $(imageName)
imagetag: $(build.BuildNumber)
newimagetag: 'latest'
acrregistry: $(AcrRegistryAddress)/$(AcrRegistryName)
containerregistry: $(ContainerRegistry)