forked from gadgetron/gadgetron
-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
135 lines (131 loc) · 4.4 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
130
131
132
133
134
135
variables:
AzureConnection: 'BiomedicalImaging-NonProd(87d8acb3-5176-4651-b457-6ab9cefd8e3d)'
imageBaseName: 'ghcr.io/gadgetron/gadgetron/gadgetron_ubuntu'
DOCKER_BUILDKIT: 1
isPR: $[eq(variables['Build.Reason'], 'PullRequest')]
isCI: $[or(eq(variables['Build.Reason'], 'IndividualCI'), eq(variables['Build.Reason'], 'BatchedCI'))]
# Trigger when merging to master
trigger:
- master
# Trigger for PRs that merge to master
pr:
- master
jobs:
- job: BuildAndTest
pool:
name: gadgetron-gpu-nodes
vmImage:
timeoutInMinutes: 120
displayName: "Build, Unit and Integration tests"
strategy:
matrix:
cuda:
flavor: cuda
requirements: python,cuda
nocuda:
flavor: nocuda
requirements: python
steps:
- task: AzureKeyVault@1
inputs:
azureSubscription: $(AzureConnection)
keyVaultName: gadgetron-build-secrets
- script: |
set -e
# First build a dev image and run unit tests
stage_name="gadgetron_$(flavor)build"
docker build --target ${stage_name} -t ${stage_name} .
test_command=". /opt/conda/etc/profile.d/conda.sh \
&& conda activate gadgetron \
&& /opt/code/gadgetron/build/test/test_all \
&& /opt/code/gadgetron/build/apps/gadgetron/test/server_tests"
docker run --gpus=all ${stage_name} /bin/bash -c "$test_command"
displayName: "Run unit tests"
- script: |
set -e
./build-images.sh --type dev --type rt --flavor $(flavor) --base-name $(imageBaseName) --tag $(build.BuildNumber)
cd test/integration && python3 get_data.py && cd ../../
fullImageName="$(imageBaseName)_rt_$(flavor):$(build.BuildNumber)"
./docker/integration-test-image.sh --image ${fullImageName} --ignore-requirements $(requirements) --gpus all --cases cases/*
displayName: "Run integration tests"
- task: PublishTestResults@2
inputs:
testRunner: JUnit
testResultsFiles: 'junit.xml'
failTaskOnFailedTests: true
buildPlatform: "$(imageBaseName)_rt_$(flavor)"
- script: |
set -e
echo "$(ghcr-pat)" | docker login ghcr.io -u $(ghcr-user) --password-stdin
./build-images.sh --type dev --type rt --flavor $(flavor) --base-name $(imageBaseName) --tag $(build.BuildNumber) --push
./build-images.sh --type dev --type rt --flavor $(flavor) --base-name $(imageBaseName) --tag latest --push
displayName: 'Push images'
condition: and(succeeded(), eq(variables.isCI, 'true'))
- job: Package
pool:
name: gadgetron-gpu-nodes
vmImage:
timeoutInMinutes: 120
displayName: "Create Conda Package"
steps:
- bash: echo "##vso[task.prependpath]/anaconda/bin"
displayName: Add conda to PATH
- script: |
eval "$(conda shell.bash hook)"
conda env create -f environment.yml
conda activate gadgetron
set -euo pipefail
cd conda && ./package.sh
- task: CopyFiles@2
displayName: 'Copy Package'
inputs:
contents: 'conda/build_pkg/**'
targetFolder: '$(Build.ArtifactStagingDirectory)'
- publish: '$(Build.ArtifactStagingDirectory)'
displayName: 'Publish package'
artifact: drop
- job: Publish
pool:
name: gadgetron-gpu-nodes
vmImage:
timeoutInMinutes: 120
displayName: "Publish Conda Package"
condition: and(succeeded(), eq(variables.isCI, 'true'))
dependsOn:
- BuildAndTest
- Package
steps:
- task: AzureKeyVault@1
inputs:
azureSubscription: $(AzureConnection)
KeyVaultName: 'gadgetron-build-secrets'
SecretsFilter: 'gadgetron-token, gadgetron-user'
RunAsPreJob: true
- bash: echo "##vso[task.prependpath]/anaconda/bin"
displayName: Add conda to PATH
- download: current
artifact: drop
- script: |
eval "$(conda shell.bash hook)"
conda create --name conda-push anaconda-client=1.8.0 -y
conda activate conda-push
set -euo pipefail
cd conda && ./publish_package.sh -u $(gadgetron-user) -t $(gadgetron-token) -p `find $(Pipeline.Workspace)/drop/ -name gadgetron*.tar.bz2`
- job: buildAndTestMacOS
pool:
name: Azure Pipelines
vmImage: macOS-latest
timeoutInMinutes: 10
displayName: "Testing for macOS"
steps:
- task: AzureKeyVault@2
inputs:
azureSubscription: $(AzureConnection)
keyVaultName: gadgetron-build-secrets
- script: |
set -e
uname -a
which curl
which wget
which conda
displayName: "Check for basic utilities"