-
Notifications
You must be signed in to change notification settings - Fork 12
/
azure-pipelines.yml
119 lines (114 loc) · 5.56 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
trigger:
batch: true
schedules:
- cron: '0 1 * * *'
displayName: Nightly
branches:
include:
- master
variables:
CI: true
pool:
vmImage: ubuntu-latest
stages:
- stage: package_selection
displayName: Package selection
condition: and(succeeded(), not(canceled()))
jobs:
- job: package_selection
${{ if eq(variables['Build.Reason'], 'PullRequest')}}:
displayName: Package selection (PR)
${{ else }}:
displayName: Package selection
condition: and(succeeded(), not(canceled()))
steps:
- task: Bash@3
displayName: Get CI scripts
inputs:
targetType: inline
script: |
wget https://raw.githubusercontent.com/tue-robotics/tue-env/master/ci/packages.sh
wget https://raw.githubusercontent.com/tue-robotics/tue-env/master/ci/azure_commit_range.py
- task: Bash@3
displayName: Determine packages to be build
name: matrix
inputs:
targetType: inline
script: |
COMMIT_RANGE=$(python3 ./azure_commit_range.py)
BRANCH=${SYSTEM_PULLREQUEST_TARGETBRANCH:-${BUILD_SOURCEBRANCH#refs/heads/}}
DEFAULT_BRANCH=$(git remote show origin 2>/dev/null | grep HEAD | awk '{print $3}')
ALL=$(([ "$BUILD_REASON" == "Schedule" ] || (([ "$BUILD_REASON" == "BatchedCI" ] || [ "$BUILD_REASON" == "IndividualCI" ] || [ "$BUILD_REASON" == "Manual" ]) && [ "$BRANCH" == "$DEFAULT_BRANCH" ])) && echo "true")
source ./packages.sh --pullrequest=${SYSTEM_PULLREQUEST_PULLREQUESTNUMBER:-false} --branch=$SYSTEM_PULLREQUEST_TARGETBRANCH --commit-range=$COMMIT_RANGE --all=$ALL tue_robocup challenge_cleanup challenge_dishwasher challenge_find_my_mates challenge_following_and_guiding challenge_hand_me_that challenge_help_me_carry challenge_manipulation challenge_navigation challenge_person_recognition challenge_serving_drinks challenge_set_a_table challenge_set_the_table challenge_speech_recognition challenge_spr challenge_take_out_the_garbage challenge_where_is_this
echo "##vso[task.setVariable variable=json_string;isOutput=true]$PACKAGES_DICT"
- stage: install_build_test
${{ if eq(variables['Build.Reason'], 'PullRequest')}}:
displayName: 'Install, build & test (PR):'
${{ else }}:
displayName: 'Install, build & test:'
dependsOn: package_selection
condition: and(succeeded(), not(canceled()), ne(stageDependencies.package_selection.outputs['package_selection.matrix.json_string'], '{}'))
jobs:
- job: "" # This lets the job name be just the name of the matrix key
condition: and(succeeded(), not(canceled()))
strategy:
matrix: $[ stageDependencies.package_selection.package_selection.outputs['matrix.json_string'] ]
steps:
- checkout: none
- task: Cache@2
displayName: Cache ccache
inputs:
key: $(Agent.OS) | ccache | $(System.TeamProject) | $(PACKAGE) | $(Build.SourceVersion)
restoreKeys: |
$(Agent.OS) | ccache | $(System.TeamProject) | $(PACKAGE)
$(Agent.OS) | ccache | $(System.TeamProject)
$(Agent.OS) | ccache
path: $(HOME)/.ccache
- task: Cache@2
displayName: Cache pip
inputs:
key: $(Agent.OS) | pip | $(System.TeamProject) | $(PACKAGE) | $(Build.SourceVersion)
restoreKeys: |
$(Agent.OS) | pip | $(System.TeamProject) | $(PACKAGE)
$(Agent.OS) | pip | $(System.TeamProject)
$(Agent.OS) | pip
path: $(HOME)/.cache/pip
- task: Bash@3
displayName: Get CI scripts
inputs:
targetType: inline
script: |
wget https://raw.githubusercontent.com/tue-robotics/tue-env/master/ci/install-package.sh
wget https://raw.githubusercontent.com/tue-robotics/tue-env/master/ci/build-package.sh
wget https://raw.githubusercontent.com/tue-robotics/tue-env/master/ci/test-package.sh
wget https://raw.githubusercontent.com/tue-robotics/tue-env/master/ci/set-branch.sh
condition: and(succeeded(), not(canceled()))
- task: Bash@3
displayName: Set Branch
inputs:
targetType: inline
script: |
source ./set-branch.sh --branch=${SYSTEM_PULLREQUEST_TARGETBRANCH:-${BUILD_SOURCEBRANCH#refs/heads/}}
echo "##vso[task.setvariable variable=BRANCH]$BRANCH"
condition: and(succeeded(), not(canceled()))
- task: Bash@3
displayName: Install
inputs:
targetType: inline
script: |
bash install-package.sh --package=${PACKAGE} --branch=${BRANCH} --commit=${BUILD_SOURCEVERSION} --pullrequest=${SYSTEM_PULLREQUEST_PULLREQUESTNUMBER:-false} --image="ghcr.io/tue-robotics/tue-env-ros-noetic"
condition: and(succeeded(), not(canceled()))
- task: Bash@3
displayName: Build
inputs:
targetType: inline
script: |
bash build-package.sh --package=$PACKAGE
condition: and(succeeded(), not(canceled()))
- task: Bash@3
displayName: Test
inputs:
targetType: inline
script: |
bash test-package.sh --package=$PACKAGE
condition: and(succeeded(), not(canceled()))