forked from nanoframework/nf-interpreter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines-nightly.yml
535 lines (462 loc) · 16.6 KB
/
azure-pipelines-nightly.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
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
trigger: none
pr:
autoCancel: true
# add nf-tools repo to resources (for Azure Pipelines templates)
resources:
repositories:
- repository: templates
type: github
name: nanoframework/nf-tools
endpoint: nanoframework
- repository: esp32_idf
type: github
name: espressif/esp-idf
endpoint: nanoframework
ref: refs/tags/v4.4.1
# scheduled build
schedules:
- cron: "58 23 * * *"
branches:
include: [ main ]
always: true
displayName: Nightly build at 23:58
jobs:
##############################
- job: Check_Build_Options
pool:
vmImage: 'windows-2019'
variables:
DOTNET_NOLOGO: true
steps:
- checkout: self
fetchDepth: 1
- template: azure-pipelines-templates/get-commit-details.yml@templates
# check build options
- powershell: |
if($env:Build_Reason -eq "Schedule")
{
# scheduled daily build: get commit date
$commitDate = git show -s --format=%cd --date=short
$commitDate = [DateTime]$commitDate
if($commitDate -eq [System.DateTime]::UtcNow.Date)
{
# last commit is from today, build images
echo "##vso[task.setvariable variable=CHECK_CHANGES;isOutput=true]true"
"**Commits from today. Go and check what changed.**" | Write-Host
}
else
{
# last commit is older than today, skip build
"***************************************************" | Write-Host
"* Last commit is older than today, skipping build *" | Write-Host
"***************************************************" | Write-Host
echo "##vso[task.setvariable variable=CHECK_CHANGES;isOutput=true]false"
}
}
else
{
# build for other reasons: build depending on target tag
echo "##vso[task.setvariable variable=CHECK_CHANGES;isOutput=true]true"
"**build for other reasons**" | Write-Host
}
name: BuildOptions
displayName: Get build options
# check what changed
- powershell: |
git config --global user.email "nfbot"
git config --global user.name "[email protected]"
$auth = "basic $([System.Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes(":$(GitHubToken)"))))"
$buildingPr = $env:System_PullRequest_PullRequestId -ne $null
if($env:StartReleaseCandidate -like "true")
{
# this is a release prep so NO build
}
else
{
if($buildingPr)
{
# get files changed in PR, if this is a PR
$commit = Invoke-RestMethod -Uri "https://api.github.com/repos/nanoframework/nf-interpreter/pulls/$env:System_PullRequest_PullRequestNumber/files" -Header @{"Authorization"="$auth"} -ContentType "application/json" -Method GET
# filter removed files
$files = $commit.where{$_.status -ne 'removed'}
# get file names only
$files = $files | % {$_.filename}
}
else
{
# scheduled build, grab repo history for the last day
$commitHistory = git log --name-status --since=1.day --format=
# filter removed files
$files = $commitHistory.where{$_[0] -ne 'D'}
# get file names only
$files = $files | % {$_.SubString(2)}
}
Write-host "Files changed:"
$files | % { Write-host $_ }
Write-host ""
# set default values
echo "##vso[task.setvariable variable=BUILD_CHIBIOS;isOutput=true]false"
echo "##vso[task.setvariable variable=BUILD_ESP32;isOutput=true]false"
echo "##vso[task.setvariable variable=BUILD_TI;isOutput=true]false"
echo "##vso[task.setvariable variable=BUILD_ALL;isOutput=true]false"
if(
(($files.where{$_.Contains('/')}).Count -eq 0) -Or
(($files.where{$_.StartsWith('azure-pipelines-templates')}).Count -gt 0) -Or
(($files.where{$_.StartsWith('CMake')}).Count -gt 0) -Or
(($files.where{$_.StartsWith('src')}).Count -gt 0)
)
{
# files at:
# - repo root
# - azure-pipelines-templates
# - CMake
# - src
if($buildingPr)
{
# ChibiOS targets are the only ones needing to be build on a global change
echo "##vso[task.setvariable variable=BUILD_CHIBIOS;isOutput=true]true"
}
else
{
echo "##vso[task.setvariable variable=BUILD_ALL;isOutput=true]true"
}
Write-host "Building ALL targets"
}
if($buildingPr)
{
if(
($files.where{$_.Contains('targets/ChibiOS/_common')}).Count -gt 0 -Or
($files.where{$_.Contains('targets/ChibiOS/_FatFS')}).Count -gt 0 -Or
($files.where{$_.Contains('targets/ChibiOS/_include')}).Count -gt 0 -Or
($files.where{$_.Contains('targets/ChibiOS/_Lwip')}).Count -gt 0 -Or
($files.where{$_.Contains('targets/ChibiOS/_nanoBooter')}).Count -gt 0 -Or
($files.where{$_.Contains('targets/ChibiOS/_nanoCLR')}).Count -gt 0 -Or
($files.where{$_.Contains('targets/ChibiOS/_FatFS')}).Count -gt 0 -Or
($files.where{$_.Contains('targets/ChibiOS/_nf-overlay')}).Count -gt 0 -Or
($files.where{$_.Contains('targets/ChibiOS/_spiffs')}).Count -gt 0 -Or
($files.where{$_.Contains('targets/ChibiOS/ORGPAL_PALTHREE')}).Count -gt 0 -Or
($files.where{$_.Contains('targets/ChibiOS/ST_NUCLEO64_F091RC')}).Count -gt 0
)
{
# files at ChibiOS global folders or targets being built with this pipeline
echo "##vso[task.setvariable variable=BUILD_CHIBIOS;isOutput=true]true"
Write-host "Building ChibiOS targets"
}
}
else
{
if( ($files.where{$_.Contains('targets/ChibiOS')}).Count -gt 0)
{
# files at ChibiOS folder
echo "##vso[task.setvariable variable=BUILD_CHIBIOS;isOutput=true]true"
Write-host "Building ChibiOS targets"
}
}
if(
!$buildingPr -And
($files.where{$_.Contains('targets/ESP32')}).Count -gt 0)
{
# files at ESP32 folder
echo "##vso[task.setvariable variable=BUILD_ESP32;isOutput=true]true"
Write-host "Building ESP32 targets"
}
if(
!$buildingPr -And
($files.where{$_.Contains('targets/TI_SimpleLink')}).Count -gt 0)
{
# files at TI_SimpleLink folder
echo "##vso[task.setvariable variable=BUILD_TI;isOutput=true]true"
Write-host "Building TI SimpleLink targets"
}
}
name: TargetsToBuild
displayName: Get targets to build
condition: eq(variables['BuildOptions.CHECK_CHANGES'], 'True')
##############################
- job: Check_Code_Style
dependsOn:
- Check_Build_Options
pool:
vmImage: 'windows-2019'
steps:
- checkout: self
fetchDepth: 1
- template: azure-pipelines-templates/download-install-llvm.yml
- template: azure-pipelines-templates/check-code-style.yml
################
# STM32
- job: Build_STM32_targets
condition: >-
and(
succeeded('Check_Code_Style'),
or(
eq(dependencies.Check_Build_Options.outputs['TargetsToBuild.BUILD_ALL'], true),
eq(dependencies.Check_Build_Options.outputs['TargetsToBuild.BUILD_CHIBIOS'], true),
contains(dependencies.Check_Build_Options.outputs['GetCommitDetails.COMMIT_MESSAGE'], '***BUILD_ALL***'),
eq(variables['BUILD_ALL'], 'true'),
eq(variables['BUILD_CHIBIOS'], 'true')
)
)
dependsOn:
- Check_Build_Options
- Check_Code_Style
pool:
vmImage: 'windows-2019'
strategy:
matrix:
ORGPAL_PALTHREE:
TargetBoard: ORGPAL_PALTHREE
TargetSeries: 'stm32f7xx'
BuildOptions:
GccArm_Version:
NeedsDFU: true
NeedsSRECORD: false
ST_NUCLEO64_F091RC:
TargetBoard: ST_NUCLEO64_F091RC
TargetSeries: 'stm32f0xx'
BuildOptions:
GccArm_Version:
NeedsDFU: false
NeedsSRECORD: true
variables:
DOTNET_NOLOGO: true
# creates a counter and assigns it to the revision variable
REVISION: $[counter('STM32_1_8_0_versioncounter', 0)]
HelperPackageVersion: $[counter('HelperPackageVersioncounter', 0)]
TargetPlatform: 'stm32'
steps:
- template: azure-pipelines-templates/build-preparations.yml
- template: azure-pipelines-templates/nb-gitversioning.yml
- template: azure-pipelines-templates/download-install-arm-gcc-toolchain.yml
- template: azure-pipelines-templates/download-install-ninja.yml
- template: azure-pipelines-templates/download-srecord.yml
- template: azure-pipelines-templates/download-hexdfu.yml
- template: azure-pipelines-templates/build-chibios-stm32.yml
- template: azure-pipelines-templates/pack-publish-artifacts.yml
- template: azure-pipelines-templates/publish-cloudsmith.yml
- template: azure-pipelines-templates/pack-publish-managed-helpers.yml
#################
# ESP32 targets
- job: Build_ESP32_targets
condition: >-
and(
succeeded('Check_Code_Style'),
or(
eq(dependencies.Check_Build_Options.outputs['TargetsToBuild.BUILD_ALL'], true),
eq(dependencies.Check_Build_Options.outputs['TargetsToBuild.BUILD_ESP32'], true),
contains(dependencies.Check_Build_Options.outputs['GetCommitDetails.COMMIT_MESSAGE'], '***BUILD_ALL***'),
eq(variables['BUILD_ALL'], 'true'),
eq(variables['BUILD_ESP32'], 'true')
)
)
dependsOn:
- Check_Build_Options
- Check_Code_Style
pool:
vmImage: 'windows-2019'
strategy:
matrix:
ESP32_REV0:
TargetBoard: ESP32
TargetSeries: 'esp32'
BuildOptions:
SDK_config: sdkconfig.default_nopsram.esp32
IDF_Target: esp32
TargetName: ESP32
PackageName: ESP32_REV0
ESP32_PSRAM_REV3:
TargetBoard: ESP32
TargetSeries: 'esp32'
BuildOptions:
IDF_Target: esp32
TargetName: ESP32
PackageName: ESP32_PSRAM_REV3
ESP32_PSRAM_XTAL26_REV0:
TargetBoard: ESP32
TargetSeries: 'esp32'
BuildOptions:
IDF_Target: esp32
TargetName: ESP32
PackageName: ESP32_PSRAM_XTAL26_REV0
ESP32_REV3:
TargetBoard: ESP32
TargetSeries: 'esp32'
BuildOptions:
IDF_Target: esp32
TargetName: ESP32
PackageName: ESP32_REV3
ESP32_PICO:
TargetBoard: ESP32
TargetSeries: 'esp32'
BuildOptions:
IDF_Target: esp32
TargetName: ESP32_PICO
PackageName: ESP32_PICO
KALUGA_1:
TargetBoard: ESP32_S2
TargetSeries: 'esp32_s2'
BuildOptions:
IDF_Target: esp32s2
TargetName: KALUGA_1
PackageName: KALUGA_1
ESP32_BLE_REV3:
TargetBoard: ESP32
TargetSeries: 'esp32'
BuildOptions:
IDF_Target: esp32
TargetName: ESP32
PackageName: ESP32_BLE_REV3
ESP32_OLIMEX:
TargetBoard: ESP32
TargetSeries: 'esp32'
BuildOptions:
IDF_Target: esp32
TargetName: ESP32_OLIMEX
PackageName: ESP32_OLIMEX
M5StickC:
TargetBoard: ESP32
TargetPlatform: 'esp32'
TargetSeries: 'esp32'
BuildOptions:
IDF_Target: esp32
TargetName: M5StickC
PackageName: M5StickC
M5StickCPlus:
TargetBoard: ESP32
TargetPlatform: 'esp32'
TargetSeries: 'esp32'
BuildOptions:
IDF_Target: esp32
TargetName: M5StickCPlus
PackageName: M5StickCPlus
M5Core:
TargetBoard: ESP32
TargetPlatform: 'esp32'
TargetSeries: 'esp32'
BuildOptions:
IDF_Target: esp32
TargetName: M5Core
PackageName: M5Core
M5Core2:
TargetBoard: ESP32
TargetPlatform: 'esp32'
TargetSeries: 'esp32'
BuildOptions:
IDF_Target: esp32
TargetName: M5Core2
PackageName: M5Core2
variables:
DOTNET_NOLOGO: true
# creates a counter and assigns it to the revision variable
REVISION: $[counter('ESP32_1_8_0_versioncounter', 0)]
IDF_PATH: 'D:/a/1/s/esp-idf'
PIP_CACHE_DIR: $(Pipeline.Workspace)/.pip
TargetPlatform: 'esp32'
steps:
- checkout: self
- checkout: esp32_idf
fetchDepth: 1
- template: azure-pipelines-templates/build-preparations.yml
- template: azure-pipelines-templates/nb-gitversioning.yml
parameters:
repoDirectory: '$(Build.SourcesDirectory)\nf-interpreter'
- template: azure-pipelines-templates/download-install-esp32-build-components.yml
- template: azure-pipelines-templates/download-install-ninja.yml
parameters:
repoDirectory: '$(Build.SourcesDirectory)\nf-interpreter'
- template: azure-pipelines-templates/build-esp32.yml
- task: CopyFiles@1
condition: succeeded()
displayName: Copying bootloader
inputs:
sourceFolder: '$(Build.SourcesDirectory)\nf-interpreter\build\bootloader'
Contents: |
bootloader.bin
TargetFolder: '$(Build.ArtifactStagingDirectory)\$(TargetPublishName)'
flattenFolders: true
- template: azure-pipelines-templates/pack-publish-artifacts.yml
parameters:
buildDirectory: '$(Build.SourcesDirectory)\nf-interpreter\build'
- template: azure-pipelines-templates/publish-cloudsmith.yml
#################
# TI SimpleLink
- job: Build_TI_SimpleLink_targets
condition: >-
and(
succeeded('Check_Code_Style'),
or(
eq(dependencies.Check_Build_Options.outputs['TargetsToBuild.BUILD_ALL'], true),
eq(dependencies.Check_Build_Options.outputs['TargetsToBuild.BUILD_TI'], true),
contains(dependencies.Check_Build_Options.outputs['GetCommitDetails.COMMIT_MESSAGE'], '***BUILD_ALL***'),
eq(variables['BUILD_ALL'], 'true'),
eq(variables['BUILD_TI'], 'true')
)
)
dependsOn:
- Check_Build_Options
- Check_Code_Style
pool:
vmImage: 'windows-2019'
strategy:
matrix:
TI_CC1352R1_LAUNCHXL_868:
TargetBoard: TI_CC1352R1_LAUNCHXL
PackageName: TI_CC1352R1_LAUNCHXL_868
TargetSeries: 'cc13xx_26xx'
BuildOptions: >-
-DTARGET_SERIES=CC13X2
-DRTOS=TI_SimpleLink
-DRADIO_FREQUENCY=868
-DSUPPORT_ANY_BASE_CONVERSION=OFF
-DNF_FEATURE_DEBUGGER=ON
-DNF_FEATURE_RTC=ON
-DNF_FEATURE_WATCHDOG=OFF
-DAPI_System.Device.Gpio=ON
-DAPI_System.Device.Spi=OFF
-DAPI_System.Device.I2c=OFF
-DAPI_System.Device.Pwm=OFF
-DAPI_System.IO.Ports=OFF
-DAPI_System.Device.Adc=ON
-DAPI_nanoFramework.TI.EasyLink=ON
-DAPI_nanoFramework.Hardware.TI=ON
-DAPI_nanoFramework.System.Text=ON
GccArm_Version:
variables:
DOTNET_NOLOGO: true
# creates a counter and assigns it to the revision variable
REVISION: $[counter('TI_1_8_0_versioncounter', 0)]
HelperPackageVersion: $[counter('HelperPackageVersioncounter', 0)]
TargetPlatform: 'ti_simplelink'
steps:
- template: azure-pipelines-templates/build-preparations.yml
- template: azure-pipelines-templates/nb-gitversioning.yml
- template: azure-pipelines-templates/download-install-arm-gcc-toolchain.yml
- template: azure-pipelines-templates/download-install-ninja.yml
- template: azure-pipelines-templates/build-ti-simplelink.yml
- template: azure-pipelines-templates/pack-publish-artifacts.yml
- template: azure-pipelines-templates/publish-cloudsmith.yml
- template: azure-pipelines-templates/pack-publish-ti-sl-managed-helpers.yml
#################################
# report build failure to Discord
- job: Report_Build_Failure
dependsOn:
- Build_STM32_targets
- Build_ESP32_targets
- Build_TI_SimpleLink_targets
condition: >-
or(
failed('Build_STM32_targets'),
failed('Build_ESP32_targets'),
failed('Build_TI_SimpleLink_targets')
)
pool:
vmImage: 'windows-2019'
steps:
- checkout: self
fetchDepth: 1
# step from template @ nf-tools repo
- template: azure-pipelines-templates/discord-webhook.yml@templates
parameters:
status: 'failure'
webhookUrl: '$(DiscordWebhook)'
message: ''