forked from gadgetron/gadgetron
-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
64 lines (60 loc) · 2.41 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
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'))]
pool: gadgetron-gpu-nodes
# Trigger when merging to master
trigger:
- master
# Trigger for PRs that merge to master
pr:
- master
jobs:
- job: BuildAndTest
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'))