Skip to content

Commit a976c0e

Browse files
Set up Azure Pipelines (#1149)
Co-authored-by: José Simões <[email protected]>
1 parent d876122 commit a976c0e

File tree

3 files changed

+46
-23
lines changed

3 files changed

+46
-23
lines changed

Build/build-functions.psm1

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@ $testReportDir = "$root\Artifacts\Logs"
55
$testCoverageDir = "$root\Artifacts\Coverage"
66
$nuget = "$root\Tools\NuGet.exe"
77
$vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
8-
$msbuild = & $vswhere -latest -products * -requires Microsoft.Component.MSBuild -property installationPath
9-
if ($msbuild) {
10-
$msbuild = join-path $msbuild 'MSBuild\Current\Bin\MSBuild.exe'
8+
$msbuildPath = & $vswhere -latest -products * -requires Microsoft.Component.MSBuild -property installationPath
9+
if ($msbuildPath) {
10+
$msbuild = join-path $msbuildPath 'MSBuild\Current\Bin\MSBuild.exe'
11+
$msbuildx64 = join-path $msbuildPath 'MSBuild\Current\Bin\amd64\MSBuild.exe'
1112
}
1213

1314
import-module $PSScriptRoot\build-pack-nano-nugets.psm1
@@ -70,7 +71,7 @@ function Start-Build([boolean] $IncludeWindowsRuntimeComponent = $false, [boolea
7071
# msbuild does not auto-restore nugets for this project type
7172
& "$nuget" restore "$root\UnitsNet.NanoFramework\GeneratedCode\UnitsNet.nanoFramework.sln"
7273
# now build
73-
& "$msbuild" "$root\UnitsNet.NanoFramework\GeneratedCode\UnitsNet.nanoFramework.sln" /verbosity:minimal /p:Configuration=Release $fileLoggerArg $appVeyorLoggerArg
74+
& "$msbuildx64" "$root\UnitsNet.NanoFramework\GeneratedCode\UnitsNet.nanoFramework.sln" /verbosity:minimal /p:Configuration=Release /p:Platform="Any CPU" $fileLoggerArg $appVeyorLoggerArg
7475
if ($lastexitcode -ne 0) { exit 1 }
7576
}
7677

Build/init.ps1

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ if (-not (Test-Path "$root/Tools/reportgenerator.exe")) {
1414
Write-Host -Foreground Green "Download dotnet-reportgenerator-globaltool...OK."
1515
}
1616

17+
###################################################
18+
## TODO: OK to remove after moving to AZDO pipeline
1719
$VsWherePath = "${env:PROGRAMFILES(X86)}\Microsoft Visual Studio\Installer\vswhere.exe"
1820
$VsPath = $(&$VsWherePath -latest -property installationPath)
1921
$msbuildPath = Join-Path -Path $VsPath -ChildPath "\MSBuild"
@@ -82,6 +84,7 @@ if (!(Test-Path "$msbuildPath/nanoFramework")) {
8284

8385
Write-Host "Installed VS extension $extensionVersion"
8486
}
87+
###################################################
8588

8689
# Cleanup
8790
[system.io.Directory]::Delete($tempDir, $true) | out-null

azure-pipelines.yml

Lines changed: 38 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,42 +3,61 @@
33
# Add steps that build, run tests, deploy, and more:
44
# https://aka.ms/yaml
55

6-
trigger: none
6+
trigger:
7+
branches:
8+
include:
9+
- master
710

811
pool:
9-
vmImage: ubuntu-latest
12+
vmImage: windows-latest
13+
14+
variables:
15+
- group: common
16+
17+
steps:
18+
- checkout: self
19+
fetchDepth: 1
20+
clean: false
21+
lfs: true
22+
submodules: false
23+
fetchTags: false
24+
25+
- task: InstallNanoMSBuildComponents@1
26+
displayName: Install .NET nanoFramework MSBuild components
1027

11-
- task: Bash@3
12-
displayName: 'Generate code'
13-
inputs:
14-
targetType: 'inline'
15-
script: 'dotnet run CodeGen'
16-
failOnStderr: true
1728
- task: PowerShell@2
1829
displayName: 'Build, test, pack'
1930
inputs:
2031
filePath: 'Build/build.ps1'
21-
arguments: '-IncludeWindowsRuntimeComponent -IncludeNanoFramework'
32+
arguments: '-IncludeNanoFramework'
33+
# arguments: '-IncludeWindowsRuntimeComponent -IncludeNanoFramework'
2234
failOnStderr: true
2335
showWarnings: true
2436
pwsh: true
37+
workingDirectory: '$(Build.SourcesDirectory)'
38+
2539
- task: PowerShell@2
40+
displayName: Upload to codecov.io
41+
env:
42+
CODECOV_TOKEN: $(CODECOV_TOKEN)
2643
inputs:
2744
targetType: 'inline'
28-
failOnStderr: true
29-
showWarnings: true
30-
pwsh: true
3145
script: |
32-
$ProgressPreference = 'SilentlyContinue'
33-
Invoke-WebRequest -Uri https://keybase.io/codecovsecurity/pgp_keys.asc -OutFile codecov.asc
46+
Write-Host -Foreground Green "Downloading codecov binaries..."
47+
48+
Invoke-WebRequest -Uri https://uploader.codecov.io/verification.gpg -OutFile codecov.asc
3449
gpg.exe --import codecov.asc
35-
50+
3651
Invoke-WebRequest -Uri https://uploader.codecov.io/latest/windows/codecov.exe -Outfile codecov.exe
3752
Invoke-WebRequest -Uri https://uploader.codecov.io/latest/windows/codecov.exe.SHA256SUM -Outfile codecov.exe.SHA256SUM
3853
Invoke-WebRequest -Uri https://uploader.codecov.io/latest/windows/codecov.exe.SHA256SUM.sig -Outfile codecov.exe.SHA256SUM.sig
39-
54+
4055
gpg.exe --verify codecov.exe.SHA256SUM.sig codecov.exe.SHA256SUM
4156
If ($(Compare-Object -ReferenceObject $(($(certUtil -hashfile codecov.exe SHA256)[1], "codecov.exe") -join " ") -DifferenceObject $(Get-Content codecov.exe.SHA256SUM)).length -eq 0) { echo "SHASUM verified" } Else {exit 1}
42-
43-
.\codecov.exe "Artifacts/Coverage" -t $env:codecov_upload_token
44-
57+
58+
Write-Host -Foreground Green "Uploading to codecov..."
59+
60+
.\codecov.exe --dir "Artifacts/Coverage" -t "$env:CODECOV_TOKEN" -b "$(Build.BuildNumber)"
61+
62+
Write-Host -Foreground Green "✅ Uploaded to codecov."
63+
pwsh: true

0 commit comments

Comments
 (0)