diff --git a/Build/build-functions.psm1 b/Build/build-functions.psm1 index a343bfed0e..d033a06448 100644 --- a/Build/build-functions.psm1 +++ b/Build/build-functions.psm1 @@ -5,9 +5,10 @@ $testReportDir = "$root\Artifacts\Logs" $testCoverageDir = "$root\Artifacts\Coverage" $nuget = "$root\Tools\NuGet.exe" $vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -$msbuild = & $vswhere -latest -products * -requires Microsoft.Component.MSBuild -property installationPath -if ($msbuild) { - $msbuild = join-path $msbuild 'MSBuild\Current\Bin\MSBuild.exe' +$msbuildPath = & $vswhere -latest -products * -requires Microsoft.Component.MSBuild -property installationPath +if ($msbuildPath) { + $msbuild = join-path $msbuildPath 'MSBuild\Current\Bin\MSBuild.exe' + $msbuildx64 = join-path $msbuildPath 'MSBuild\Current\Bin\amd64\MSBuild.exe' } import-module $PSScriptRoot\build-pack-nano-nugets.psm1 @@ -70,7 +71,7 @@ function Start-Build([boolean] $IncludeWindowsRuntimeComponent = $false, [boolea # msbuild does not auto-restore nugets for this project type & "$nuget" restore "$root\UnitsNet.NanoFramework\GeneratedCode\UnitsNet.nanoFramework.sln" # now build - & "$msbuild" "$root\UnitsNet.NanoFramework\GeneratedCode\UnitsNet.nanoFramework.sln" /verbosity:minimal /p:Configuration=Release $fileLoggerArg $appVeyorLoggerArg + & "$msbuildx64" "$root\UnitsNet.NanoFramework\GeneratedCode\UnitsNet.nanoFramework.sln" /verbosity:minimal /p:Configuration=Release /p:Platform="Any CPU" $fileLoggerArg $appVeyorLoggerArg if ($lastexitcode -ne 0) { exit 1 } } diff --git a/Build/init.ps1 b/Build/init.ps1 index dec31365aa..6892afbe76 100644 --- a/Build/init.ps1 +++ b/Build/init.ps1 @@ -14,6 +14,8 @@ if (-not (Test-Path "$root/Tools/reportgenerator.exe")) { Write-Host -Foreground Green "Download dotnet-reportgenerator-globaltool...OK." } +################################################### +## TODO: OK to remove after moving to AZDO pipeline $VsWherePath = "${env:PROGRAMFILES(X86)}\Microsoft Visual Studio\Installer\vswhere.exe" $VsPath = $(&$VsWherePath -latest -property installationPath) $msbuildPath = Join-Path -Path $VsPath -ChildPath "\MSBuild" @@ -82,6 +84,7 @@ if (!(Test-Path "$msbuildPath/nanoFramework")) { Write-Host "Installed VS extension $extensionVersion" } +################################################### # Cleanup [system.io.Directory]::Delete($tempDir, $true) | out-null diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 9ee6f55381..dc2c73e924 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -3,42 +3,61 @@ # Add steps that build, run tests, deploy, and more: # https://aka.ms/yaml -trigger: none +trigger: + branches: + include: + - master pool: - vmImage: ubuntu-latest + vmImage: windows-latest + +variables: +- group: common + +steps: +- checkout: self + fetchDepth: 1 + clean: false + lfs: true + submodules: false + fetchTags: false + +- task: InstallNanoMSBuildComponents@1 + displayName: Install .NET nanoFramework MSBuild components -- task: Bash@3 - displayName: 'Generate code' - inputs: - targetType: 'inline' - script: 'dotnet run CodeGen' - failOnStderr: true - task: PowerShell@2 displayName: 'Build, test, pack' inputs: filePath: 'Build/build.ps1' - arguments: '-IncludeWindowsRuntimeComponent -IncludeNanoFramework' + arguments: '-IncludeNanoFramework' +# arguments: '-IncludeWindowsRuntimeComponent -IncludeNanoFramework' failOnStderr: true showWarnings: true pwsh: true + workingDirectory: '$(Build.SourcesDirectory)' + - task: PowerShell@2 + displayName: Upload to codecov.io + env: + CODECOV_TOKEN: $(CODECOV_TOKEN) inputs: targetType: 'inline' - failOnStderr: true - showWarnings: true - pwsh: true script: | - $ProgressPreference = 'SilentlyContinue' - Invoke-WebRequest -Uri https://keybase.io/codecovsecurity/pgp_keys.asc -OutFile codecov.asc + Write-Host -Foreground Green "Downloading codecov binaries..." + + Invoke-WebRequest -Uri https://uploader.codecov.io/verification.gpg -OutFile codecov.asc gpg.exe --import codecov.asc - + Invoke-WebRequest -Uri https://uploader.codecov.io/latest/windows/codecov.exe -Outfile codecov.exe Invoke-WebRequest -Uri https://uploader.codecov.io/latest/windows/codecov.exe.SHA256SUM -Outfile codecov.exe.SHA256SUM Invoke-WebRequest -Uri https://uploader.codecov.io/latest/windows/codecov.exe.SHA256SUM.sig -Outfile codecov.exe.SHA256SUM.sig - + gpg.exe --verify codecov.exe.SHA256SUM.sig codecov.exe.SHA256SUM 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} - - .\codecov.exe "Artifacts/Coverage" -t $env:codecov_upload_token - + + Write-Host -Foreground Green "Uploading to codecov..." + + .\codecov.exe --dir "Artifacts/Coverage" -t "$env:CODECOV_TOKEN" -b "$(Build.BuildNumber)" + + Write-Host -Foreground Green "✅ Uploaded to codecov." + pwsh: true \ No newline at end of file