forked from clarkadamp/brewblox-firmware
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathazure-pipelines.yml
269 lines (216 loc) · 8.03 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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
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
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
resources:
repositories:
- repository: self
containers:
- container: firmware-compiler
image: brewblox/firmware-compiler:10.3
- container: simulator-compiler
image: brewblox/simulator-compiler:8
- container: idf
image: espressif/idf:v4.4.1
pool:
vmImage: "Ubuntu-20.04"
trigger:
branches:
include:
- "develop"
- "edge"
- "feature/*"
- "fix/*"
tags:
exclude:
- "*"
pr:
branches:
include:
- "*"
jobs:
#########################################################
# Tests
#########################################################
- job: Tests
steps:
- checkout: self
- script: git submodule update --init --recursive --depth 1
displayName: Checkout submodules
- script: script/test.sh blocks
target: firmware-compiler
displayName: Run block tests
- script: script/test.sh cbox
target: firmware-compiler
displayName: Run cbox tests
- script: script/test.sh control
target: firmware-compiler
displayName: Run control tests
- script: script/test.sh gui
target: firmware-compiler
displayName: Run gui tests
- script: script/collect-test-coverage.sh
target: firmware-compiler
displayName: Collect test coverage
- task: PublishCodeCoverageResults@1
inputs:
summaryFileLocation: build/coverage/coverage.xml
codeCoverageTool: "cobertura"
#########################################################
# Build AMD64
#########################################################
- job: BuildAMD64
steps:
- checkout: self
- script: git submodule update --init --recursive --depth 1
displayName: Checkout submodules
- script: script/build.sh particle-sim
target: simulator-compiler
displayName: Build executable
- publish: build/target/brewblox-gcc
artifact: AMD64
#########################################################
# Build ARM32
#########################################################
- job: BuildARM32
pool:
name: Default
demands:
- Agent.OSArchitecture -equals ARM
# The build agent comes with compiler dependencies pre-installed
# No need to run scripts in container
steps:
- checkout: self
- script: git submodule update --init --recursive --depth 1
displayName: Checkout submodules
- script: script/build.sh particle-sim
displayName: Build executable
- publish: build/target/brewblox-gcc
artifact: ARM32
#########################################################
# Build ARM64
#########################################################
- job: BuildARM64
pool:
name: Default
demands:
- Agent.OSArchitecture -equals ARM64
# The build agent comes with compiler dependencies pre-installed
# No need to run scripts in container
steps:
- checkout: self
- script: git submodule update --init --recursive --depth 1
displayName: Checkout submodules
- script: script/build.sh particle-sim
displayName: Build executable
- publish: build/target/brewblox-gcc
artifact: ARM64
#########################################################
# Build P1
#########################################################
- job: BuildP1
steps:
- checkout: self
- script: git submodule update --init --recursive --depth 1
displayName: Checkout submodules
- script: script/build.sh p1
target: firmware-compiler
displayName: Build p1
- publish: build/target/brewblox-p1
artifact: P1
#########################################################
# Build Photon
#########################################################
- job: BuildPhoton
steps:
- checkout: self
- script: git submodule update --init --recursive --depth 1
displayName: Checkout submodules
- script: script/build.sh photon
target: firmware-compiler
displayName: Build photon
- publish: build/target/brewblox-photon
artifact: Photon
#########################################################
# Build ESP32
#########################################################
- job: BuildESP32
steps:
- checkout: self
- script: git submodule update --init --recursive --depth 1
displayName: Checkout submodules
- task: DownloadSecureFile@1
name: espSigningKey
displayName: "Download ESP binary signing certificate"
inputs:
secureFile: "esp32_secure_boot_signing_key.pem"
condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'))
- bash: |
cp -f PLACEHOLDER_SIGNING_KEY.pem secure_boot_signing_key.pem
displayName: Use placeholder signing key
workingDirectory: app/brewblox-esp/
condition: and(succeeded(), eq(variables['Build.Reason'], 'PullRequest'))
- bash: |
echo "Using secure boot signing key $(espSigningKey.secureFilePath)"
sudo chmod a+r $(espSigningKey.secureFilePath)
cp -f $(espSigningKey.secureFilePath) secure_boot_signing_key.pem
ls -l secure_boot_signing_key.pem
displayName: Use real signing key
workingDirectory: app/brewblox-esp/
condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'))
- script: script/build.sh esp
target: idf
displayName: Build ESP32
- bash: |
mkdir ./ci
cp ./brewblox_esp.bin ./ci/brewblox-esp32.bin
cp ./brewblox_esp.elf ./ci/brewblox-esp32.elf
cp ./bootloader/bootloader.bin ./ci/bootloader-esp32.bin
cp ./partition_table/partition-table.bin ./ci/partition-table-esp32.bin
workingDirectory: app/brewblox-esp/build
displayName: Export build variables
- publish: app/brewblox-esp/build/ci
artifact: ESP32
#########################################################
# Deploy
#########################################################
- job: Deploy
dependsOn:
- Tests
- BuildAMD64
- BuildARM32
- BuildARM64
- BuildP1
- BuildPhoton
- BuildESP32
variables:
# Variables imported from brewblox group:
# FIRMWARE_SAS_TOKEN
- group: brewblox
steps:
- bash: |
BRANCH=$(echo $(Build.SourceBranch) | grep -oP "^refs/heads/\K.*")
TAG=$(echo $BRANCH | tr '/' '-' | tr '[:upper:]' '[:lower:]')
echo "##vso[task.setvariable variable=BRANCH]$BRANCH"
echo "##vso[task.setvariable variable=TAG]$TAG"
displayName: Export build variables
- download: current
- bash: |
set -euo pipefail
mkdir -p ./release
cp "$(Pipeline.Workspace)"/AMD64/brewblox-gcc ./release/brewblox-amd64.sim
cp "$(Pipeline.Workspace)"/ARM32/brewblox-gcc ./release/brewblox-arm32.sim
cp "$(Pipeline.Workspace)"/ARM64/brewblox-gcc ./release/brewblox-arm64.sim
cp "$(Pipeline.Workspace)"/P1/brewblox-p1.bin ./release/brewblox-p1.bin
cp "$(Pipeline.Workspace)"/Photon/brewblox-photon.bin ./release/brewblox-photon.bin
cp "$(Pipeline.Workspace)"/ESP32/brewblox-esp32.bin ./release/brewblox-esp32.bin
cp "$(Pipeline.Workspace)"/ESP32/brewblox-esp32.elf ./release/brewblox-esp32.elf
cp "$(Pipeline.Workspace)"/ESP32/bootloader-esp32.bin ./release/bootloader-esp32.bin
cp "$(Pipeline.Workspace)"/ESP32/partition-table-esp32.bin ./release/partition-table-esp32.bin
displayName: Copy release files
- bash: |
script/release.sh $(TAG)
displayName: Upload release
condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'))
env:
AZURE_STORAGE_SAS_TOKEN: $(FIRMWARE_SAS_TOKEN)
- bash: |
script/release.sh $(System.PullRequest.TargetBranch)
displayName: Upload release (dry run)
condition: and(succeeded(), eq(variables['Build.Reason'], 'PullRequest'))