forked from nanoframework/nf-interpreter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
731 lines (615 loc) · 36.1 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
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
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
trigger:
branches:
include: ["main", "main", "develop*", "release-*", "refs/tags/*" ]
paths:
exclude: [ "doc", "*.md", ".gitignore", "README.md" ]
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
jobs:
##############################
- job: Check_Build_Options
pool:
vmImage: 'windows-2019'
variables:
DOTNET_NOLOGO: true
steps:
- checkout: self
fetchDepth: 1
# get commit message
- powershell: |
if($env:StartReleaseCandidate -like "true")
{
# this is a release prep so NO build
echo "##vso[task.setvariable variable=SKIP_BUILD;isOutput=true]true"
Write-Host "Release preparation, skipping build."
}
else
{
# get commit details, if this is a PR
if($env:System_PullRequest_PullRequestId -ne $null)
{
$commit = Invoke-RestMethod -Uri "https://api.github.com/repos/nanoframework/nf-interpreter/commits/$(Build.SourceVersion)" -ContentType "application/json" -Method GET
if( ($commit.commit.author.name -eq "nfbot") -and ($commit.commit.message -like "*[version update]*") )
{
echo "##vso[task.setvariable variable=SKIP_BUILD;isOutput=true]true"
}
else
{
echo "##vso[task.setvariable variable=SKIP_BUILD;isOutput=true]false"
}
}
else
{
echo "##vso[task.setvariable variable=SKIP_BUILD;isOutput=true]false"
}
}
name: BuildOptions
displayName: Get build options
# check what changed
- powershell: |
git config --global user.email "nfbot"
git config --global user.name "nanoframework@outlook.com"
$auth = "basic $([System.Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes(":$(GitHubToken)"))))"
if($env:StartReleaseCandidate -like "true")
{
# this is a release prep so NO build
}
else
{
if($env:System_PullRequest_PullRequestId -ne $null)
{
# 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'}
}
else
{
# get files changed in the commit, if this is NOT a PR
$commit = Invoke-RestMethod -Uri "https://api.github.com/repos/nanoframework/nf-interpreter/commits/$(Build.SourceVersion)" -Header @{"Authorization"="$auth"} -ContentType "application/json" -Method GET
# filter removed files
$files = $commit.files.where{$_.status -ne 'removed'}
}
# get file names only
$files = $files | % {$_.filename}
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_FREERTOS;isOutput=true]false"
echo "##vso[task.setvariable variable=BUILD_FREERTOS_ESP32;isOutput=true]false"
echo "##vso[task.setvariable variable=BUILD_TI;isOutput=true]false"
echo "##vso[task.setvariable variable=BUILD_WIN32;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
echo "##vso[task.setvariable variable=BUILD_ALL;isOutput=true]true"
Write-host "Building ALL targets"
}
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( ($files.where{$_.Contains('targets/FreeRTOS')}).Count -gt 0)
{
# files at FreeRTOS folder
echo "##vso[task.setvariable variable=BUILD_FREERTOS;isOutput=true]true"
Write-host "Building FreeRTOS targets"
}
if( ($files.where{$_.Contains('targets/FreeRTOS_ESP32')}).Count -gt 0)
{
# files at FreeRTOS_ESP32 folder
echo "##vso[task.setvariable variable=BUILD_FREERTOS_ESP32;isOutput=true]true"
Write-host "Building ESP32 targets"
}
if( ($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"
}
if( ($files.where{$_.Contains('targets/win32')}).Count -gt 0)
{
# files at win32 folder
echo "##vso[task.setvariable variable=BUILD_WIN32;isOutput=true]true"
Write-host "Building WIN32 target"
}
}
name: TargetsToBuild
displayName: Get targets to build
- task: DotNetCoreCLI@2
condition: eq( variables['StartReleaseCandidate'], true )
displayName: Install NBGV tool
inputs:
command: custom
custom: tool
arguments: install -g nbgv
- powershell: |
# compute authorization header in format "AUTHORIZATION: basic 'encoded token'"
# 'encoded token' is the Base64 of the string "nfbot:personal-token"
$auth = "basic $([System.Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes("nfbot:$(GitHubToken)"))))"
cd "$env:Agent_TempDirectory" > $null
git init "$env:Agent_TempDirectory\repo"
cd repo > $null
git remote add origin "$env:Build_Repository_Uri"
git config --global gc.auto 0
git config --global user.name nfbot
git config --global user.email nanoframework@outlook.com
git config --global core.autocrlf true
git -c http.extraheader="AUTHORIZATION: $auth" fetch --progress origin
git checkout develop
# prepare release and capture output
$release = nbgv prepare-release
# push all changes to github
git -c http.extraheader="AUTHORIZATION: $auth" push --all origin
# get release branch name
$branch = $release.Split(' ')[0]
# start PR for release
$prRequestBody = @{title="Release $branch";body="";head="$branch";base="main"} | ConvertTo-Json
$githubApiEndpoint = "https://api.github.com/repos/$env:Build_Repository_Name/pulls"
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
$headers = @{}
$headers.Add("Authorization","$auth")
$headers.Add("Accept","application/vnd.github.symmetra-preview+json")
try
{
$result = Invoke-RestMethod -Method Post -UserAgent [Microsoft.PowerShell.Commands.PSUserAgent]::InternetExplorer -Uri $githubApiEndpoint -Header $headers -ContentType "application/json" -Body $prRequestBody
'Started PR for new release...' | Write-Host -NoNewline
'OK' | Write-Host -ForegroundColor Green
}
catch
{
$result = $_.Exception.Response.GetResponseStream()
$reader = New-Object System.IO.StreamReader($result)
$reader.BaseStream.Position = 0
$reader.DiscardBufferedData()
$responseBody = $reader.ReadToEnd();
"Error starting PR: $responseBody" | Write-Host -ForegroundColor Red
}
condition: eq( variables['StartReleaseCandidate'], true )
displayName: NBGV prepare release
##############################
- job: Check_Code_Style
condition: ne( dependencies.Check_Build_Options.outputs['BuildOptions.SKIP_BUILD'], true )
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'), ne( dependencies.Check_Build_Options.outputs['BuildOptions.SKIP_BUILD'], true ), or(eq(dependencies.Check_Build_Options.outputs['TargetsToBuild.BUILD_ALL'], true), eq(dependencies.Check_Build_Options.outputs['TargetsToBuild.BUILD_CHIBIOS'], true)) )
dependsOn:
- Check_Build_Options
- Check_Code_Style
pool:
vmImage: 'windows-2019'
strategy:
matrix:
NETDUINO3_WIFI:
TargetBoard: NETDUINO3_WIFI
BuildOptions: -DTARGET_SERIES=STM32F4xx -DRTOS=CHIBIOS -DSUPPORT_ANY_BASE_CONVERSION=ON -DNF_FEATURE_DEBUGGER=ON -DNF_FEATURE_RTC=ON -DNF_FEATURE_HAS_SDCARD=ON -DAPI_System.Math=ON -DAPI_Hardware.Stm32=ON -DAPI_Windows.Devices.Gpio=ON -DAPI_System.Device.Gpio=ON -DAPI_Windows.Devices.Spi=ON -DAPI_System.Device.Spi=ON -DAPI_Windows.Devices.I2c=ON -DAPI_System.Device.I2c=ON -DAPI_Windows.Devices.Pwm=ON -DAPI_Windows.Devices.SerialCommunication=ON -DAPI_System.IO.Ports=ON -DAPI_Windows.Devices.Adc=ON -DAPI_System.Device.Dac=OFF -DAPI_nanoFramework.Devices.OneWire=ON -DAPI_nanoFramework.ResourceManager=ON -DAPI_nanoFramework.System.Collections=ON -DAPI_nanoFramework.System.Text=ON
GccArm_Version:
NeedsDFU: true
NeedsSRECORD: false
ORGPAL_PALTHREE:
TargetBoard: ORGPAL_PALTHREE
BuildOptions: -DTARGET_SERIES=STM32F7xx -DRTOS=CHIBIOS -DCHIBIOS_CONTRIB_REQUIRED=ON -DSTM32_CUBE_PACKAGE_REQUIRED=ON -DSUPPORT_ANY_BASE_CONVERSION=ON -DNF_FEATURE_DEBUGGER=ON -DNF_FEATURE_RTC=ON -DNF_FEATURE_HAS_USB_MSD=ON -DNF_FEATURE_HAS_SDCARD=ON -DNF_FEATURE_USE_SPIFFS=ON -DAPI_System.Math=ON -DAPI_Hardware.Stm32=ON -DNF_FEATURE_HAS_CONFIG_BLOCK=ON -DAPI_Windows.Devices.Gpio=ON -DAPI_System.Device.Gpio=ON -DAPI_Windows.Devices.Spi=ON -DAPI_System.Device.Spi=ON -DAPI_Windows.Devices.I2c=ON -DAPI_System.Device.I2c=ON -DAPI_Windows.Devices.Pwm=ON -DAPI_Windows.Devices.SerialCommunication=ON -DAPI_System.IO.Ports=ON -DAPI_Windows.Devices.Adc=ON -DAPI_System.Device.Dac=ON -DAPI_System.Net=ON -DNF_SECURITY_MBEDTLS=ON -DAPI_nanoFramework.ResourceManager=ON -DAPI_nanoFramework.System.Collections=ON -DAPI_nanoFramework.System.Text=ON
GccArm_Version:
NeedsDFU: true
NeedsSRECORD: false
ST_STM32F429I_DISCOVERY:
TargetBoard: ST_STM32F429I_DISCOVERY
BuildOptions: -DTARGET_SERIES=STM32F4xx -DRTOS=CHIBIOS -DSUPPORT_ANY_BASE_CONVERSION=ON -DNF_FEATURE_DEBUGGER=ON -DNF_FEATURE_RTC=ON -DAPI_System.Math=ON -DAPI_Hardware.Stm32=ON -DAPI_Windows.Devices.Gpio=ON -DAPI_System.Device.Gpio=ON -DAPI_Windows.Devices.Spi=ON -DAPI_System.Device.Spi=ON -DAPI_Windows.Devices.I2c=ON -DAPI_System.Device.I2c=ON -DAPI_Windows.Devices.Pwm=ON -DAPI_Windows.Devices.SerialCommunication=ON -DAPI_System.IO.Ports=ON -DAPI_Windows.Devices.Adc=ON -DAPI_nanoFramework.Devices.OneWire=ON -DAPI_nanoFramework.Devices.Can=ON -DAPI_nanoFramework.ResourceManager=ON -DAPI_nanoFramework.System.Collections=ON -DAPI_nanoFramework.System.Text=ON
GccArm_Version:
NeedsDFU: false
NeedsSRECORD: false
ST_NUCLEO64_F091RC:
TargetBoard: ST_NUCLEO64_F091RC
BuildOptions: -DTARGET_SERIES=STM32F0xx -DRTOS=CHIBIOS -DNF_FEATURE_DEBUGGER=ON -DNF_FEATURE_RTC=ON -DUSE_RNG=OFF -DNF_PLATFORM_NO_CLR_TRACE=ON -DNF_CLR_NO_IL_INLINE=ON -DAPI_Hardware.Stm32=ON -DAPI_Windows.Devices.Gpio=ON -DAPI_System.Device.Gpio=ON -DAPI_Windows.Devices.Spi=ON -DAPI_System.Device.Spi=ON -DAPI_Windows.Devices.I2c=ON -DAPI_System.Device.I2c=ON -DAPI_Windows.Devices.Pwm=ON -DAPI_Windows.Devices.SerialCommunication=ON -DAPI_System.IO.Ports=ON -DAPI_nanoFramework.System.Text=ON
GccArm_Version:
NeedsDFU: false
NeedsSRECORD: true
ST_STM32F769I_DISCOVERY:
TargetBoard: ST_STM32F769I_DISCOVERY
BuildOptions: -DTARGET_SERIES=STM32F7xx -DRTOS=CHIBIOS -DSUPPORT_ANY_BASE_CONVERSION=ON -DNF_FEATURE_DEBUGGER=ON -DNF_FEATURE_RTC=ON -DNF_FEATURE_HAS_SDCARD=ON -DAPI_System.Math=ON -DAPI_Hardware.Stm32=ON -DNF_FEATURE_HAS_CONFIG_BLOCK=ON -DAPI_Windows.Devices.Gpio=ON -DAPI_System.Device.Gpio=ON -DAPI_Windows.Devices.Spi=ON -DAPI_System.Device.Spi=ON -DAPI_Windows.Devices.I2c=ON -DAPI_System.Device.I2c=ON -DAPI_Windows.Devices.Pwm=ON -DAPI_Windows.Devices.SerialCommunication=ON -DAPI_System.IO.Ports=ON -DAPI_Windows.Devices.Adc=ON -DAPI_System.Device.Dac=ON -DAPI_System.Net=ON -DNF_SECURITY_MBEDTLS=ON -DAPI_nanoFramework.Devices.OneWire=ON -DAPI_nanoFramework.Devices.Can=ON -DAPI_System.IO.FileSystem=ON -DAPI_nanoFramework.ResourceManager=ON -DAPI_nanoFramework.System.Collections=ON -DAPI_nanoFramework.System.Text=ON -DAPI_nanoFramework.Graphics=ON -DGRAPHICS_MEMORY=Graphics_Memory.cpp -DGRAPHICS_DISPLAY=Otm8009a_DSI_Video_Mode.cpp -DGRAPHICS_DISPLAY_INTERFACE=DSI_To_Display_Video_Mode.cpp -DTOUCHPANEL_DEVICE=ft6x06_I2C.cpp -DTOUCHPANEL_INTERFACE=I2C_To_TouchPanel.cpp
GccArm_Version:
NeedsDFU: false
NeedsSRECORD: true
variables:
DOTNET_NOLOGO: true
# creates a counter and assigns it to the revision variable
REVISION: $[counter('STM32_versioncounter', 0)]
GNU_GCC_TOOLCHAIN_PATH: $(Agent.TempDirectory)\GNU_Tools_ARM_Embedded
HelperPackageVersion: $[counter('HelperPackageVersioncounter', 0)]
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'), ne( dependencies.Check_Build_Options.outputs['BuildOptions.SKIP_BUILD'], true ), or(eq(dependencies.Check_Build_Options.outputs['TargetsToBuild.BUILD_ALL'], true), eq(dependencies.Check_Build_Options.outputs['TargetsToBuild.BUILD_FREERTOS_ESP32'], true)) )
dependsOn:
- Check_Build_Options
- Check_Code_Style
pool:
vmImage: 'windows-2019'
# there is only a single ESP32 target, but this is already config as a matrix to make it easy to add new ones
strategy:
matrix:
ESP32_WROOM_32:
TargetBoard: ESP32_WROOM_32
BuildOptions: -DTARGET_SERIES=ESP32 -DRTOS=FREERTOS_ESP32 -DNF_FEATURE_DEBUGGER=ON -DNF_FEATURE_RTC=ON -DNF_FEATURE_HAS_CONFIG_BLOCK=ON -DNF_FEATURE_HAS_SDCARD=ON -DAPI_System.Math=ON -DAPI_Windows.Devices.Gpio=ON -DAPI_System.Device.Gpio=ON -DAPI_Windows.Devices.Spi=ON -DAPI_System.Device.Spi=ON -DAPI_Windows.Devices.I2c=ON -DAPI_System.Device.I2c=ON -DAPI_Windows.Devices.Pwm=ON -DAPI_Windows.Devices.SerialCommunication=ON -DAPI_System.IO.Ports=ON -DAPI_Windows.Devices.Adc=ON -DAPI_System.Net=ON -DAPI_Windows.Devices.Wifi=ON -DNF_SECURITY_MBEDTLS=ON -DAPI_Hardware.Esp32=ON -DSUPPORT_ANY_BASE_CONVERSION=ON -DAPI_nanoFramework.Devices.OneWire=ON -DAPI_nanoFramework.ResourceManager=ON -DAPI_nanoFramework.System.Collections=ON -DAPI_nanoFramework.System.Text=ON -DAPI_nanoFramework.Hardware.Esp32.Rmt=ON -DAPI_System.Device.Dac=ON
ESP_WROVER_KIT:
TargetBoard: ESP32_WROOM_32
BuildOptions: -DTARGET_SERIES=ESP32 -DRTOS=FREERTOS_ESP32 -DNF_FEATURE_DEBUGGER=ON -DNF_FEATURE_RTC=ON -DNF_FEATURE_HAS_CONFIG_BLOCK=ON -DNF_FEATURE_HAS_SDCARD=ON -DAPI_System.Math=ON -DAPI_Windows.Devices.Gpio=ON -DAPI_System.Device.Gpio=ON -DAPI_Windows.Devices.Spi=ON -DAPI_System.Device.Spi=ON -DAPI_Windows.Devices.I2c=ON -DAPI_System.Device.I2c=ON -DAPI_Windows.Devices.Pwm=ON -DAPI_Windows.Devices.SerialCommunication=ON -DAPI_System.IO.Ports=ON -DAPI_Windows.Devices.Adc=ON -DAPI_System.Net=ON -DAPI_Windows.Devices.Wifi=ON -DNF_SECURITY_MBEDTLS=ON -DAPI_Hardware.Esp32=ON -DSUPPORT_ANY_BASE_CONVERSION=ON -DAPI_nanoFramework.Devices.OneWire=ON -DAPI_nanoFramework.ResourceManager=ON -DAPI_nanoFramework.System.Collections=ON -DAPI_nanoFramework.System.Text=ON -DAPI_nanoFramework.Hardware.Esp32.Rmt=ON -DAPI_nanoFramework.Graphics=ON -DGRAPHICS_DISPLAY="ILI9341_240x320_SPI.cpp" -DTOUCHPANEL_DEVICE="XPT2046.cpp" -DGRAPHICS_DISPLAY_INTERFACE="Spi_To_Display.cpp" -DTOUCHPANEL_INTERFACE="Spi_To_TouchPanel.cpp" -DAPI_System.Device.Dac=ON
PackageName: ESP_WROVER_KIT
ESP32_PICO:
TargetBoard: ESP32_WROOM_32
BuildOptions: -DTARGET_SERIES=ESP32 -DRTOS=FREERTOS_ESP32 -DNF_FEATURE_DEBUGGER=ON -DTARGET_SERIAL_BAUDRATE=115200 -DNF_FEATURE_RTC=ON -DNF_FEATURE_HAS_CONFIG_BLOCK=ON -DNF_FEATURE_HAS_SDCARD=ON -DAPI_System.Math=ON -DAPI_Windows.Devices.Gpio=ON -DAPI_System.Device.Gpio=ON -DAPI_Windows.Devices.Spi=ON -DAPI_System.Device.Spi=ON -DAPI_Windows.Devices.I2c=ON -DAPI_System.Device.I2c=ON -DAPI_Windows.Devices.Pwm=ON -DAPI_Windows.Devices.SerialCommunication=ON -DAPI_System.IO.Ports=ON -DAPI_Windows.Devices.Adc=ON -DAPI_System.Net=ON -DAPI_Windows.Devices.Wifi=ON -DNF_SECURITY_MBEDTLS=ON -DAPI_Hardware.Esp32=ON -DSUPPORT_ANY_BASE_CONVERSION=ON -DAPI_nanoFramework.ResourceManager=ON -DAPI_nanoFramework.System.Collections=ON -DAPI_nanoFramework.System.Text=ON -DAPI_nanoFramework.Hardware.Esp32.Rmt=ON -DAPI_System.Device.Dac=ON
PackageName: ESP32_PICO
ESP32_LILYGO:
TargetBoard: ESP32_WROOM_32
BuildOptions: -DTARGET_SERIES=ESP32 -DRTOS=FREERTOS_ESP32 -DNF_FEATURE_DEBUGGER=ON -DNF_FEATURE_RTC=ON -DNF_FEATURE_HAS_CONFIG_BLOCK=ON -DNF_FEATURE_HAS_SDCARD=ON -DAPI_System.Math=ON -DAPI_Windows.Devices.Gpio=ON -DAPI_System.Device.Gpio=ON -DAPI_Windows.Devices.Spi=ON -DAPI_System.Device.Spi=ON -DAPI_Windows.Devices.I2c=ON -DAPI_System.Device.I2c=ON -DAPI_Windows.Devices.Pwm=ON -DAPI_Windows.Devices.SerialCommunication=ON -DAPI_System.IO.Ports=ON -DAPI_Windows.Devices.Adc=ON -DAPI_System.Net=ON -DAPI_Windows.Devices.Wifi=ON -DNF_SECURITY_MBEDTLS=ON -DAPI_Hardware.Esp32=ON -DSUPPORT_ANY_BASE_CONVERSION=ON -DAPI_nanoFramework.ResourceManager=ON -DAPI_nanoFramework.System.Collections=ON -DAPI_nanoFramework.System.Text=ON -DAPI_nanoFramework.Hardware.Esp32.Rmt=ON -DAPI_System.Device.Dac=ON -DESP32_ETHERNET_SUPPORT=ON -DESP32_CONFIG_PIN_PHY_POWER=5 -DESP32_CONFIG_PHY_CLOCK_MODE=ETH_CLOCK_GPIO17_OUT
PackageName: ESP32_LILYGO
variables:
DOTNET_NOLOGO: true
# creates a counter and assigns it to the revision variable
REVISION: $[counter('ESP32_versioncounter', 0)]
ESP32_TOOLCHAIN_PATH: $(Agent.TempDirectory)\ESP32_Tools\xtensa-esp32-elf
steps:
- template: azure-pipelines-templates/build-preparations.yml
- template: azure-pipelines-templates/nb-gitversioning.yml
- template: azure-pipelines-templates/download-install-esp32-build-components.yml
- template: azure-pipelines-templates/download-install-ninja.yml
- template: azure-pipelines-templates/build-esp32.yml
- task: CopyFiles@1
condition: succeeded()
displayName: Copying bootloader from ESP32 libs
inputs:
sourceFolder: $(ESP32_LIBS_PATH)
Contents: |
bootloader.bin
TargetFolder: '$(Build.ArtifactStagingDirectory)\$(TargetPublishName)'
flattenFolders: true
- template: azure-pipelines-templates/pack-publish-artifacts.yml
- template: azure-pipelines-templates/publish-cloudsmith.yml
#################
# NXP
- job: Build_NXP_targets
condition: and( succeeded('Check_Code_Style'), ne( dependencies.Check_Build_Options.outputs['BuildOptions.SKIP_BUILD'], true ), or(eq(dependencies.Check_Build_Options.outputs['TargetsToBuild.BUILD_ALL'], true), eq(dependencies.Check_Build_Options.outputs['TargetsToBuild.BUILD_FREERTOS'], true)) )
dependsOn:
- Check_Build_Options
- Check_Code_Style
pool:
vmImage: 'windows-2019'
strategy:
matrix:
NXP_MIMXRT1060_EVK:
TargetBoard: NXP_MIMXRT1060_EVK
BuildOptions: -DTARGET_SERIES=IMXRT10xx -DRTOS=FREERTOS -DSUPPORT_ANY_BASE_CONVERSION=ON -DNF_FEATURE_DEBUGGER=ON -DNF_FEATURE_RTC=ON -DNF_FEATURE_HAS_SDCARD=ON -DAPI_System.Math=ON -DNF_FEATURE_HAS_CONFIG_BLOCK=ON -DAPI_Windows.Devices.Gpio=ON -DAPI_System.Device.Gpio=ON -DAPI_System.Net=ON -DAPI_Windows.Devices.SerialCommunication=ON -DAPI_System.IO.Ports=ON -DAPI_Windows.Devices.I2c=ON -DAPI_System.Device.I2c=ON -DAPI_nanoFramework.ResourceManager=ON -DAPI_nanoFramework.System.Collections=ON -DAPI_nanoFramework.System.Text=ON
GccArm_Version:
NeedsSRECORD: true
variables:
DOTNET_NOLOGO: true
# creates a counter and assigns it to the revision variable
REVISION: $[counter('NXP_versioncounter', 0)]
GNU_GCC_TOOLCHAIN_PATH: $(Agent.TempDirectory)\GNU_Tools_ARM_Embedded
GIT_LFS_SKIP_SMUDGE: 1
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/build-freertos-nxp.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
#################
# TI SimpleLink
- job: Build_TI_SimpleLink_targets
condition: and( succeeded('Check_Code_Style'), ne( dependencies.Check_Build_Options.outputs['BuildOptions.SKIP_BUILD'], true ), or(eq(dependencies.Check_Build_Options.outputs['TargetsToBuild.BUILD_ALL'], true), eq(dependencies.Check_Build_Options.outputs['TargetsToBuild.BUILD_TI'], true)) )
dependsOn:
- Check_Build_Options
- Check_Code_Style
pool:
vmImage: 'windows-2019'
strategy:
matrix:
# disabled: waiting to update SDK to latest version with Sys Config
# TI_CC3220SF_LAUNCHXL:
# TargetBoard: TI_CC3220SF_LAUNCHXL
# BuildOptions: -DTARGET_SERIES=CC32xx -DRTOS=TI_SIMPLELINK -DSUPPORT_ANY_BASE_CONVERSION=OFF -DNF_FEATURE_DEBUGGER=ON -DNF_FEATURE_RTC=ON -DNF_FEATURE_WATCHDOG=OFF -DNF_FEATURE_HAS_CONFIG_BLOCK=ON -DAPI_Windows.Devices.Gpio=ON -DAPI_System.Device.Gpio=ON -DAPI_Windows.Devices.Spi=ON -DAPI_System.Device.Spi=ON -DAPI_Windows.Devices.I2c=ON -DAPI_System.Device.I2c=ON -DAPI_Windows.Devices.Pwm=ON -DAPI_Windows.Devices.SerialCommunication=OFF -DAPI_Windows.Devices.Adc=ON -DAPI_System.Net=ON -DAPI_nanoFramework.System.Collections=ON -DAPI_nanoFramework.System.Text=ON
# GccArm_Version:
TI_CC1352R1_LAUNCHXL_868:
TargetBoard: TI_CC1352R1_LAUNCHXL
PackageName: TI_CC1352R1_LAUNCHXL_868
BuildOptions: -DTARGET_SERIES=CC13x2_26x2 -DRTOS=TI_SIMPLELINK -DRADIO_FREQUENCY=868 -DSUPPORT_ANY_BASE_CONVERSION=OFF -DNF_FEATURE_DEBUGGER=ON -DNF_FEATURE_RTC=ON -DNF_FEATURE_WATCHDOG=OFF -DAPI_Windows.Devices.Gpio=ON -DAPI_System.Device.Gpio=ON -DAPI_Windows.Devices.Spi=OFF -DAPI_Windows.Devices.I2c=OFF -DAPI_Windows.Devices.Pwm=OFF -DAPI_Windows.Devices.SerialCommunication=OFF -DAPI_System.IO.Ports=OFF -DAPI_Windows.Devices.Adc=ON -DAPI_nanoFramework.TI.EasyLink=ON -DAPI_nanoFramework.Hardware.TI=ON
GccArm_Version:
TI_CC1352R1_LAUNCHXL_915:
TargetBoard: TI_CC1352R1_LAUNCHXL
PackageName: TI_CC1352R1_LAUNCHXL_915
BuildOptions: -DTARGET_SERIES=CC13x2_26x2 -DRTOS=TI_SIMPLELINK -DRADIO_FREQUENCY=915 -DSUPPORT_ANY_BASE_CONVERSION=OFF -DNF_FEATURE_DEBUGGER=ON -DNF_FEATURE_RTC=ON -DNF_FEATURE_WATCHDOG=OFF -DAPI_Windows.Devices.Gpio=ON -DAPI_System.Device.Gpio=ON -DAPI_Windows.Devices.Spi=OFF -DAPI_Windows.Devices.I2c=OFF -DAPI_Windows.Devices.Pwm=OFF -DAPI_Windows.Devices.SerialCommunication=OFF -DAPI_System.IO.Ports=OFF -DAPI_Windows.Devices.Adc=ON -DAPI_nanoFramework.TI.EasyLink=ON -DAPI_nanoFramework.Hardware.TI=ON
GccArm_Version:
variables:
DOTNET_NOLOGO: true
# creates a counter and assigns it to the revision variable
REVISION: $[counter('TI_versioncounter', 0)]
GNU_GCC_TOOLCHAIN_PATH: $(Agent.TempDirectory)\GNU_Tools_ARM_Embedded
HelperPackageVersion: $[counter('HelperPackageVersioncounter', 0)]
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
#################
# WIN32
- job: Build_WIN32_nanoCLR
condition: and( succeeded('Check_Code_Style'), ne( dependencies.Check_Build_Options.outputs['BuildOptions.SKIP_BUILD'], true ), or(eq(dependencies.Check_Build_Options.outputs['TargetsToBuild.BUILD_ALL'], true), eq(dependencies.Check_Build_Options.outputs['TargetsToBuild.BUILD_WIN32'], true)) )
dependsOn:
- Check_Build_Options
- Check_Code_Style
pool:
vmImage: 'windows-2019'
variables:
DOTNET_NOLOGO: true
TargetPublishName: WIN32_nanoCLR
# creates a counter and assigns it to the revision variable
REVISION: $[counter('WIN32_versioncounter', 0)]
steps:
- template: azure-pipelines-templates/nb-gitversioning.yml
- template: azure-pipelines-templates/install-nuget.yml@templates
- task: VSBuild@1
inputs:
solution: 'targets\win32\nanoCLR.sln'
platform: 'x86'
msbuildArgs: '/p:PublicRelease=true'
configuration: 'Release'
- task: DotNetCoreCLI@2
displayName: Install SignTool tool
condition: and( succeeded(), eq(variables['System.PullRequest.PullRequestId'], '') )
inputs:
command: custom
custom: tool
arguments: install --tool-path . SignClient
- pwsh: |
.\SignClient "Sign" `
--baseDirectory "$(Build.Repository.LocalPath)\build\bin\Release" `
--input "**/nanoFramework.nanoCLR.exe" `
--config "$(Build.Repository.LocalPath)\config\SignClient.json" `
--filelist "$(Build.Repository.LocalPath)\config\filelist.txt" `
--user "$(SignClientUser)" `
--secret '$(SignClientSecret)' `
--name "nanoFramework.nanoCLR.Win32" `
--description "nanoFramework.nanoCLR.Win32" `
--descriptionUrl "https://github.com/$env:Build_Repository_Name"
displayName: Sign nanoCLR WIN32 EXE
continueOnError: true
condition: and( succeeded(), eq(variables['System.PullRequest.PullRequestId'], '') )
- task: NuGetCommand@2
condition: succeeded()
displayName: Pack nanoCLR WIN32
inputs:
command: 'custom'
arguments: 'pack targets\win32\nanoFramework.nanoCLR.Win32.nuspec -Version $(NBGV_NuGetPackageVersion)'
- task: CopyFiles@1
condition: succeeded()
displayName: Collecting managed helpers deployable artifacts
inputs:
sourceFolder: $(Build.SourcesDirectory)
Contents: |
**\nanoFramework.nanoCLR.Win32*.nupkg
TargetFolder: '$(Build.ArtifactStagingDirectory)'
flattenFolders: true
- task: CopyFiles@1
condition: succeeded()
displayName: Collecting EXE to deployable artifacts
inputs:
sourceFolder: $(Build.SourcesDirectory)
Contents: |
**\nanoFramework.nanoCLR.exe
TargetFolder: '$(Build.ArtifactStagingDirectory)\$(TargetPublishName)'
flattenFolders: true
- pwsh: |
.\SignClient "Sign" `
--baseDirectory "$(Build.ArtifactStagingDirectory)" `
--input "**/*.nupkg" `
--config "$(Build.Repository.LocalPath)\config\SignClient.json" `
--filelist "$(Build.Repository.LocalPath)\config\filelist.txt" `
--user "$(SignClientUser)" `
--secret '$(SignClientSecret)' `
--name "nanoFramework.nanoCLR.Win32 NuGet" `
--description "nanoFramework.nanoCLR.Win32 NuGet" `
--descriptionUrl "https://github.com/$env:Build_Repository_Name"
displayName: Sign packages
continueOnError: true
condition: and( succeeded(), eq(variables['System.PullRequest.PullRequestId'], '') )
# publish artifacts (only possible if this is not a PR originated on a fork)
- task: PublishBuildArtifacts@1
condition: succeeded()
displayName: Publish deployables artifacts
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: deployables
ArtifactType: Container
# push NuGet packages to Azure Artifacts feed (always happens except on PR builds)
- task: NuGetCommand@2
condition: and( succeeded(), eq(variables['System.PullRequest.PullRequestId'], '') )
continueOnError: true
displayName: Push NuGet packages to Azure Artifacts
inputs:
command: push
nuGetFeedType: external
packagesToPush: '$(Build.ArtifactStagingDirectory)/*.nupkg'
publishFeedCredentials: 'AzureArtifacts-nf-interpreter'
allowPackageConflicts: true
# push NuGet class lib package to NuGet (always happens except on PR builds)
- task: NuGetCommand@2
condition: and( succeeded(), eq(variables['System.PullRequest.PullRequestId'], '') )
continueOnError: true
displayName: Push NuGet packages to NuGet
inputs:
command: push
nuGetFeedType: external
allowPackageConflicts: true
packagesToPush: '$(Build.ArtifactStagingDirectory)/*.nupkg'
publishFeedCredentials: 'NuGet-nf-interpreter'
- template: azure-pipelines-templates/publish-win32-nanoclr.yml
#######################
# generate change log
- job: Generate_change_log
dependsOn:
- Build_STM32_targets
- Build_ESP32_targets
- Build_NXP_targets
- Build_TI_SimpleLink_targets
# skip build if this is a PR, submitted by nfbot and the commit message contains [version update]
condition: and( succeeded('Build_STM32_targets'), succeeded('Build_ESP32_targets'), succeeded('Build_NXP_targets'), succeeded('Build_TI_SimpleLink_targets'), not( eq(variables['Build.Reason'], 'PullRequest') ), or( eq(variables['Build.SourceBranchName'], 'main'), startsWith(variables['Build.SourceBranch'], 'refs/tags/v') ), ne( variables['StartReleaseCandidate'], true ) )
pool:
vmImage: 'windows-2019'
steps:
- task: DotNetCoreCLI@2
condition: succeeded()
displayName: Install NBGV tool
inputs:
command: custom
custom: tool
arguments: install --tool-path . nbgv
- script: nbgv cloud -a -c
condition: succeeded()
displayName: Set build number
- task: UseRubyVersion@0
condition: succeeded()
inputs:
versionSpec: '= 2.7'
addToPath: true
# generate change log including future version
- powershell: |
gem install github_changelog_generator --quiet --no-document
# need to call it passing both cache options with full path otherwise it won't work
github_changelog_generator --token $(GitHubToken) --cache-log $env:AGENT_TEMPDIRECTORY\github-changelog-logger.log --cache-file $env:AGENT_TEMPDIRECTORY\github-changelog-http-cache --pr-wo-labels --future-release "v$env:NBGV_AssemblyVersion"
condition: and( succeeded(), ne(variables['Build.Reason'], 'PullRequest'), or( eq(variables['Build.SourceBranchName'], 'main'), startsWith(variables['Build.SourceBranch'], 'refs/tags/v') ) )
displayName: Generate change log
# generate change log without future version
- powershell: |
gem install github_changelog_generator --quiet --no-document
# need to call it passing both cache options with full path otherwise it won't work
github_changelog_generator --token $(GitHubToken) --cache-log $env:AGENT_TEMPDIRECTORY\github-changelog-logger.log --cache-file $env:AGENT_TEMPDIRECTORY\github-changelog-http-cache --pr-wo-labels
condition: and( succeeded(), ne(variables['Build.Reason'], 'PullRequest'), not( or( eq(variables['Build.SourceBranchName'], 'main'), startsWith(variables['Build.SourceBranch'], 'refs/tags/v') ) ) )
displayName: Generate change log
# push new changelog to GitHub repo
- powershell: |
git config --global gc.auto 0
git config --global user.name nfbot
git config --global user.email nanoframework@outlook.com
git config --global core.autocrlf true
git add CHANGELOG.md
git commit -m "Update CHANGELOG" -m"***NO_CI***"
# compute authorization header in format "AUTHORIZATION: basic 'encoded token'"
# 'encoded token' is the Base64 of the string "nfbot:personal-token"
$auth = "basic $([System.Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes("nfbot:$(GitHubToken)"))))"
git -c http.extraheader="AUTHORIZATION: $auth" push origin "HEAD:$(Build.SourceBranchName)"
condition: and( succeeded(), ne(variables['Build.Reason'], 'PullRequest') )
displayName: Push changelog to GitHub
#######################
# create or update GitHub release ON tags from main branch or tags
- job: Publish_Release
dependsOn:
- Build_STM32_targets
- Build_ESP32_targets
- Build_NXP_targets
- Build_TI_SimpleLink_targets
- Build_WIN32_nanoCLR
- Generate_change_log
# skip build if this is a PR, submitted by nfbot and the commit message contains [version update]
condition: and( succeeded('Build_STM32_targets'), succeeded('Build_ESP32_targets'), succeeded('Build_NXP_targets'), succeeded('Build_TI_SimpleLink_targets'), succeeded('Generate_change_log'), not( eq(variables['Build.Reason'], 'PullRequest') ), or( endsWith(variables['Build.SourceBranchName'], 'main'), startsWith(variables['Build.SourceBranch'], 'refs/tags/v') ), ne( variables['StartReleaseCandidate'], true ) )
pool:
vmImage: 'windows-2019'
steps:
- task: DotNetCoreCLI@2
inputs:
command: custom
custom: tool
arguments: install --tool-path . nbgv
displayName: Install NBGV tool
- script: nbgv cloud -a -c
displayName: Set build number
- task: GitHubReleasePublish@1
condition: endsWith(variables['Build.SourceBranch'], 'main')
displayName: Create/Update GitHub stable release
inputs:
githubEndpoint: 'nanoframework'
githubOwner: 'nanoframework'
githubRepositoryName: nf-interpreter
githubTag: v$(NBGV_AssemblyVersion)
githubReleaseTitle: 'nf Interpreter v$(NBGV_AssemblyVersion)'
githubReleaseNotes: 'Check the [changelog]($(Build.Repository.Uri)/blob/$(Build.SourceBranchName)/CHANGELOG.md).<br><br>Download images from our Cloudsmith repo. See the available images [here](https://github.com/nanoframework/nf-interpreter/tree/main#firmware-for-reference-boards).'
githubTargetCommitsh: $(Build.SourceVersion)
githubReleaseDraft: false
githubReleasePrerelease: false
githubReuseDraftOnly: false
githubReuseRelease: true
githubEditRelease: true
githubDeleteEmptyTag: true
githubReleaseAsset: '$(Build.ArtifactStagingDirectory)/**/*.zip'
##################################
# report build failure to Discord
- job: Report_Build_Failure
dependsOn:
- Build_STM32_targets
- Build_ESP32_targets
- Build_NXP_targets
- Build_TI_SimpleLink_targets
- Build_WIN32_nanoCLR
- Generate_change_log
- Check_Code_Style
condition: and(ne( dependencies.Check_Code_Style.outputs['Check_Code_Style.CODE_STYLE_CHECK_FAILED'], true), or( failed('Build_STM32_targets'), failed('Build_ESP32_targets'), failed('Build_NXP_targets'), failed('Build_TI_SimpleLink_targets'), failed('Build_WIN32_nanoCLR'), failed('Generate_change_log')))
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: ''