Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/aspnet/MessagePack-CSharp.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Arnott <andrewarnott@gmail.com>2019-11-20 01:28:05 +0300
committerAndrew Arnott <andrewarnott@gmail.com>2019-11-20 01:59:07 +0300
commita81989f414b53f6ce91e169aa909643f0487a465 (patch)
tree59ffde5794c2685c42e4bc5b54c33d7602e1e308 /azure-pipelines
parent9a8bb438be9369dc4bbd85344c50e9c4a443a8c2 (diff)
Reduce number of build tasks
This moves some of the logic from YML to ps1 scripts where it can be reproduced locally and therefore is more diagnosable and maintainable. It also adds an init script to the repo root which installs whatever .NET Core SDK and runtimes are required to build and run tests in this repo.
Diffstat (limited to 'azure-pipelines')
-rw-r--r--azure-pipelines/Get-TempToolsPath.ps113
-rw-r--r--azure-pipelines/Get-nbgv.ps128
-rw-r--r--azure-pipelines/Set-EnvVars.ps139
-rw-r--r--azure-pipelines/artifacts/Variables.ps140
-rw-r--r--azure-pipelines/artifacts/_all.ps150
-rw-r--r--azure-pipelines/artifacts/_pipelines.ps155
-rw-r--r--azure-pipelines/artifacts/build_logs.ps112
-rw-r--r--azure-pipelines/artifacts/mpc-linux.ps113
-rw-r--r--azure-pipelines/artifacts/mpc-osx.ps113
-rw-r--r--azure-pipelines/artifacts/mpc-win.ps113
-rw-r--r--azure-pipelines/artifacts/nuget.ps114
-rw-r--r--azure-pipelines/artifacts/projectAssetsJson.ps19
-rw-r--r--azure-pipelines/artifacts/unity.ps114
-rw-r--r--azure-pipelines/artifacts/vsix.ps114
-rw-r--r--azure-pipelines/build.yml118
-rw-r--r--azure-pipelines/build_nonWindows.yml26
-rw-r--r--azure-pipelines/build_unity.yml17
-rw-r--r--azure-pipelines/install-dependencies.yml15
-rw-r--r--azure-pipelines/justnugetorg.nuget.config7
-rw-r--r--azure-pipelines/variables/DotNetSdkVersion.ps12
-rw-r--r--azure-pipelines/variables/_all.ps111
-rw-r--r--azure-pipelines/variables/_pipelines.ps115
22 files changed, 389 insertions, 149 deletions
diff --git a/azure-pipelines/Get-TempToolsPath.ps1 b/azure-pipelines/Get-TempToolsPath.ps1
new file mode 100644
index 00000000..97c552c0
--- /dev/null
+++ b/azure-pipelines/Get-TempToolsPath.ps1
@@ -0,0 +1,13 @@
+if ($env:AGENT_TOOLSDIRECTORY) {
+ $path = "$env:AGENT_TOOLSDIRECTORY\vs-platform\tools"
+} elseif ($env:localappdata) {
+ $path = "$env:localappdata\vs-platform\tools"
+} else {
+ $path = "$PSScriptRoot\..\obj\tools"
+}
+
+if (!(Test-Path $path)) {
+ New-Item -ItemType Directory -Path $Path | Out-Null
+}
+
+(Resolve-Path $path).Path
diff --git a/azure-pipelines/Get-nbgv.ps1 b/azure-pipelines/Get-nbgv.ps1
new file mode 100644
index 00000000..925eecdd
--- /dev/null
+++ b/azure-pipelines/Get-nbgv.ps1
@@ -0,0 +1,28 @@
+<#
+.SYNOPSIS
+ Gets the path to the nbgv CLI tool, installing it if necessary.
+#>
+Param(
+)
+
+$existingTool = Get-Command "nbgv" -ErrorAction SilentlyContinue
+if ($existingTool) {
+ return $existingTool.Path
+}
+
+if ($env:AGENT_TEMPDIRECTORY) {
+ $toolInstallDir = "$env:AGENT_TEMPDIRECTORY/$env:BUILD_BUILDID"
+} else {
+ $toolInstallDir = "$PSScriptRoot/../obj/tools"
+}
+
+$toolPath = "$toolInstallDir/nbgv"
+if (!(Test-Path $toolInstallDir)) { New-Item -Path $toolInstallDir -ItemType Directory | Out-Null }
+
+if (!(Get-Command $toolPath -ErrorAction SilentlyContinue)) {
+ Write-Host "Installing nbgv to $toolInstallDir"
+ dotnet tool install --tool-path "$toolInstallDir" nbgv --configfile "$PSScriptRoot/justnugetorg.nuget.config" | Out-Null
+}
+
+# Normalize the path on the way out.
+return (Get-Command $toolPath).Path
diff --git a/azure-pipelines/Set-EnvVars.ps1 b/azure-pipelines/Set-EnvVars.ps1
new file mode 100644
index 00000000..313cecff
--- /dev/null
+++ b/azure-pipelines/Set-EnvVars.ps1
@@ -0,0 +1,39 @@
+<#
+.SYNOPSIS
+ Set environment variables in the environment.
+ Azure Pipeline and CMD environments are considered.
+.PARAMETER Variables
+ A hashtable of variables to be set.
+.OUTPUTS
+ A boolean indicating whether the environment variables can be expected to propagate to the caller's environment.
+#>
+[CmdletBinding(SupportsShouldProcess=$true)]
+Param(
+ [Parameter(Mandatory=$true, Position=1)]
+ $Variables
+)
+
+if ($Variables.Count -eq 0) {
+ return $true
+}
+
+$cmdInstructions = !$env:TF_BUILD -and $env:PS1UnderCmd -eq '1'
+if ($cmdInstructions) {
+ Write-Warning "Environment variables have been set that will be lost because you're running under cmd.exe"
+ Write-Host "Environment variables that must be set manually:" -ForegroundColor Blue
+}
+
+$Variables.GetEnumerator() |% {
+ Set-Item -Path env:$($_.Key) -Value $_.Value
+
+ # If we're running in Azure Pipelines, set these environment variables
+ if ($env:TF_BUILD) {
+ Write-Host "##vso[task.setvariable variable=$($_.Key);]$($_.Value)"
+ }
+
+ if ($cmdInstructions) {
+ Write-Host "SET $($_.Key)=$($_.Value)"
+ }
+}
+
+return !$cmdInstructions
diff --git a/azure-pipelines/artifacts/Variables.ps1 b/azure-pipelines/artifacts/Variables.ps1
new file mode 100644
index 00000000..cfcb7df5
--- /dev/null
+++ b/azure-pipelines/artifacts/Variables.ps1
@@ -0,0 +1,40 @@
+# This artifact captures all variables defined in the ..\variables folder.
+# It "snaps" the values of these variables where we can compute them during the build,
+# and otherwise captures the scripts to run later during an Azure Pipelines environment release.
+
+$RepoRoot = [System.IO.Path]::GetFullPath("$PSScriptRoot\..\..")
+$ArtifactBasePath = "$RepoRoot\obj\_artifacts"
+$VariablesArtifactPath = "$ArtifactBasePath\variables"
+if (-not (Test-Path $VariablesArtifactPath)) { New-Item -ItemType Directory -Path $VariablesArtifactPath | Out-Null }
+
+# Copy variables, either by value if the value is calculable now, or by script
+Get-ChildItem -Path "$PSScriptRoot\..\variables" |% {
+ $value = $null
+ if (-not $_.BaseName.StartsWith('_')) { # Skip trying to interpret special scripts
+ # First check the environment variables in case the variable was set in a queued build
+ if (Test-Path env:$($_.BaseName)) {
+ $value = Get-Content "env:$($_.BaseName)"
+ }
+
+ # If that didn't give us anything, try executing the script right now from its original position
+ if (-not $value) {
+ $value = & $_.FullName
+ }
+
+ if ($value) {
+ # We got something, so wrap it with quotes so it's treated like a literal value.
+ $value = "'$value'"
+ }
+ }
+
+ # If that didn't get us anything, just copy the script itself
+ if (-not $value) {
+ $value = Get-Content -Path $_.FullName
+ }
+
+ Set-Content -Path "$VariablesArtifactPath\$($_.Name)" -Value $value
+}
+
+@{
+ "$VariablesArtifactPath" = (Get-ChildItem $VariablesArtifactPath -Recurse);
+}
diff --git a/azure-pipelines/artifacts/_all.ps1 b/azure-pipelines/artifacts/_all.ps1
new file mode 100644
index 00000000..6f62be5c
--- /dev/null
+++ b/azure-pipelines/artifacts/_all.ps1
@@ -0,0 +1,50 @@
+# This script returns all the artifacts that should be collected after a build.
+#
+# Each powershell artifact is expressed as an object with these properties:
+# Source - the full path to the source file
+# ArtifactName - the name of the artifact to upload to
+# ContainerFolder - the relative path within the artifact in which the file should appear
+#
+# Each artifact aggregating .ps1 script should return a hashtable:
+# Key = path to the directory from which relative paths within the artifact should be calculated
+# Value = an array of paths (absolute or relative to the BaseDirectory) to files to include in the artifact.
+# FileInfo objects are also allowed.
+
+$RepoRoot = [System.IO.Path]::GetFullPath("$PSScriptRoot\..\..")
+
+Function EnsureTrailingSlash($path) {
+ if ($path.length -gt 0 -and !$path.EndsWith('\') -and !$path.EndsWith('/')) {
+ $path = $path + [IO.Path]::DirectorySeparatorChar
+ }
+
+ $path.Replace('\', [IO.Path]::DirectorySeparatorChar)
+}
+
+Get-ChildItem "$PSScriptRoot\*.ps1" -Exclude "_*" -Recurse |% {
+ $ArtifactName = $_.BaseName
+
+ $fileGroups = & $_
+ if (!$fileGroups -or $fileGroups.Count -eq 0) {
+ Write-Warning "No files found for the `"$ArtifactName`" artifact."
+ } else {
+ $fileGroups.GetEnumerator() | % {
+ $BaseDirectory = New-Object Uri ((EnsureTrailingSlash $_.Key), [UriKind]::Absolute)
+ $_.Value | % {
+ if ($_.GetType() -eq [IO.FileInfo] -or $_.GetType() -eq [IO.DirectoryInfo]) {
+ $_ = $_.FullName
+ }
+
+ $artifact = New-Object -TypeName PSObject
+ Add-Member -InputObject $artifact -MemberType NoteProperty -Name ArtifactName -Value $ArtifactName
+
+ $SourceFullPath = New-Object Uri ($BaseDirectory, $_)
+ Add-Member -InputObject $artifact -MemberType NoteProperty -Name Source -Value $SourceFullPath.LocalPath
+
+ $RelativePath = [Uri]::UnescapeDataString($BaseDirectory.MakeRelative($SourceFullPath))
+ Add-Member -InputObject $artifact -MemberType NoteProperty -Name ContainerFolder -Value (Split-Path $RelativePath)
+
+ Write-Output $artifact
+ }
+ }
+ }
+}
diff --git a/azure-pipelines/artifacts/_pipelines.ps1 b/azure-pipelines/artifacts/_pipelines.ps1
new file mode 100644
index 00000000..7451ab11
--- /dev/null
+++ b/azure-pipelines/artifacts/_pipelines.ps1
@@ -0,0 +1,55 @@
+# This script translates all the artifacts described by _all.ps1
+# into commands that instruct Azure Pipelines to actually collect those artifacts.
+
+param (
+ [string]$ArtifactNameSuffix
+)
+
+$RepoRoot = [System.IO.Path]::GetFullPath("$PSScriptRoot\..\..")
+if ($env:BUILD_ARTIFACTSTAGINGDIRECTORY) {
+ $ArtifactStagingFolder = $env:BUILD_ARTIFACTSTAGINGDIRECTORY
+} else {
+ $ArtifactStagingFolder = "$RepoRoot\obj\_artifacts"
+ if (Test-Path $ArtifactStagingFolder) {
+ Remove-Item $ArtifactStagingFolder -Recurse -Force
+ }
+}
+
+function Create-SymbolicLink {
+ param (
+ $Link,
+ $Target
+ )
+
+ if ($Link -eq $Target) {
+ return
+ }
+
+ if (Test-Path $Link) { Remove-Item $Link }
+ $LinkContainer = Split-Path $Link -Parent
+ if (!(Test-Path $LinkContainer)) { mkdir $LinkContainer }
+ Write-Verbose "Linking $Link to $Target"
+ if ($IsMacOS -or $IsLinux) {
+ ln $Target $Link
+ } else {
+ cmd /c mklink $Link $Target
+ }
+}
+
+# Stage all artifacts
+$Artifacts = & "$PSScriptRoot\_all.ps1"
+$Artifacts |% {
+ $DestinationFolder = (Join-Path (Join-Path $ArtifactStagingFolder "$($_.ArtifactName)$ArtifactNameSuffix") $_.ContainerFolder).TrimEnd('\')
+ $Name = "$(Split-Path $_.Source -Leaf)"
+
+ #Write-Host "$($_.Source) -> $($_.ArtifactName)\$($_.ContainerFolder)" -ForegroundColor Yellow
+
+ if (-not (Test-Path $DestinationFolder)) { New-Item -ItemType Directory -Path $DestinationFolder | Out-Null }
+ if (Test-Path -PathType Leaf $_.Source) { # skip folders
+ Create-SymbolicLink -Link "$DestinationFolder\$Name" -Target $_.Source
+ }
+}
+
+$Artifacts |% { $_.ArtifactName } | Get-Unique |% {
+ Write-Host "##vso[artifact.upload containerfolder=$_$ArtifactNameSuffix;artifactname=$_$ArtifactNameSuffix;]$ArtifactStagingFolder/$_$ArtifactNameSuffix"
+}
diff --git a/azure-pipelines/artifacts/build_logs.ps1 b/azure-pipelines/artifacts/build_logs.ps1
new file mode 100644
index 00000000..b55ba48f
--- /dev/null
+++ b/azure-pipelines/artifacts/build_logs.ps1
@@ -0,0 +1,12 @@
+if ($env:BUILD_ARTIFACTSTAGINGDIRECTORY) {
+ $artifactsRoot = $env:BUILD_ARTIFACTSTAGINGDIRECTORY
+} else {
+ $RepoRoot = [System.IO.Path]::GetFullPath("$PSScriptRoot\..\..")
+ $artifactsRoot = "$RepoRoot\bin"
+}
+
+if (!(Test-Path $artifactsRoot/build_logs)) { return }
+
+@{
+ "$artifactsRoot/build_logs" = (Get-ChildItem -Recurse "$artifactsRoot/build_logs")
+}
diff --git a/azure-pipelines/artifacts/mpc-linux.ps1 b/azure-pipelines/artifacts/mpc-linux.ps1
new file mode 100644
index 00000000..73fb44ed
--- /dev/null
+++ b/azure-pipelines/artifacts/mpc-linux.ps1
@@ -0,0 +1,13 @@
+$RepoRoot = [System.IO.Path]::GetFullPath("$PSScriptRoot\..\..")
+$BuildConfiguration = $env:BUILDCONFIGURATION
+if (!$BuildConfiguration) {
+ $BuildConfiguration = 'Debug'
+}
+
+$MpcBin = "$RepoRoot/bin/MessagePack.Generator/$BuildConfiguration/netcoreapp3.0/linux-x64/publish"
+
+if (!(Test-Path $MpcBin)) { return }
+
+@{
+ "$MpcBin" = (Get-ChildItem $MpcBin)
+}
diff --git a/azure-pipelines/artifacts/mpc-osx.ps1 b/azure-pipelines/artifacts/mpc-osx.ps1
new file mode 100644
index 00000000..8c539e8c
--- /dev/null
+++ b/azure-pipelines/artifacts/mpc-osx.ps1
@@ -0,0 +1,13 @@
+$RepoRoot = [System.IO.Path]::GetFullPath("$PSScriptRoot\..\..")
+$BuildConfiguration = $env:BUILDCONFIGURATION
+if (!$BuildConfiguration) {
+ $BuildConfiguration = 'Debug'
+}
+
+$MpcBin = "$RepoRoot/bin/MessagePack.Generator/$BuildConfiguration/netcoreapp3.0/osx-x64/publish"
+
+if (!(Test-Path $MpcBin)) { return }
+
+@{
+ "$MpcBin" = (Get-ChildItem $MpcBin)
+}
diff --git a/azure-pipelines/artifacts/mpc-win.ps1 b/azure-pipelines/artifacts/mpc-win.ps1
new file mode 100644
index 00000000..b20fcd48
--- /dev/null
+++ b/azure-pipelines/artifacts/mpc-win.ps1
@@ -0,0 +1,13 @@
+$RepoRoot = [System.IO.Path]::GetFullPath("$PSScriptRoot\..\..")
+$BuildConfiguration = $env:BUILDCONFIGURATION
+if (!$BuildConfiguration) {
+ $BuildConfiguration = 'Debug'
+}
+
+$MpcBin = "$RepoRoot/bin/MessagePack.Generator/$BuildConfiguration/netcoreapp3.0/win-x64/publish"
+
+if (!(Test-Path $MpcBin)) { return }
+
+@{
+ "$MpcBin" = (Get-ChildItem $MpcBin)
+}
diff --git a/azure-pipelines/artifacts/nuget.ps1 b/azure-pipelines/artifacts/nuget.ps1
new file mode 100644
index 00000000..ea4a55a0
--- /dev/null
+++ b/azure-pipelines/artifacts/nuget.ps1
@@ -0,0 +1,14 @@
+$RepoRoot = [System.IO.Path]::GetFullPath("$PSScriptRoot\..\..")
+$BuildConfiguration = $env:BUILDCONFIGURATION
+if (!$BuildConfiguration) {
+ $BuildConfiguration = 'Debug'
+}
+
+$result = @{}
+
+$PackagesRoot = "$RepoRoot/bin/Packages/$BuildConfiguration/NuGet"
+if (Test-Path $PackagesRoot) {
+ $result[$PackagesRoot] = (Get-ChildItem $PackagesRoot -Recurse)
+}
+
+return $result
diff --git a/azure-pipelines/artifacts/projectAssetsJson.ps1 b/azure-pipelines/artifacts/projectAssetsJson.ps1
new file mode 100644
index 00000000..d2e85ffb
--- /dev/null
+++ b/azure-pipelines/artifacts/projectAssetsJson.ps1
@@ -0,0 +1,9 @@
+$ObjRoot = [System.IO.Path]::GetFullPath("$PSScriptRoot\..\..\obj")
+
+if (!(Test-Path $ObjRoot)) { return }
+
+@{
+ "$ObjRoot" = (
+ (Get-ChildItem "$ObjRoot\project.assets.json" -Recurse)
+ );
+}
diff --git a/azure-pipelines/artifacts/unity.ps1 b/azure-pipelines/artifacts/unity.ps1
new file mode 100644
index 00000000..b5059b30
--- /dev/null
+++ b/azure-pipelines/artifacts/unity.ps1
@@ -0,0 +1,14 @@
+$RepoRoot = [System.IO.Path]::GetFullPath("$PSScriptRoot\..\..")
+$BuildConfiguration = $env:BUILDCONFIGURATION
+if (!$BuildConfiguration) {
+ $BuildConfiguration = 'Debug'
+}
+
+$result = @{}
+
+$UnityPackRoot = "$RepoRoot/bin"
+if (Test-Path $UnityPackRoot) {
+ $result[$UnityPackRoot] = (Get-ChildItem $UnityPackRoot/*.unitypackage)
+}
+
+return $result
diff --git a/azure-pipelines/artifacts/vsix.ps1 b/azure-pipelines/artifacts/vsix.ps1
new file mode 100644
index 00000000..963404f9
--- /dev/null
+++ b/azure-pipelines/artifacts/vsix.ps1
@@ -0,0 +1,14 @@
+$RepoRoot = [System.IO.Path]::GetFullPath("$PSScriptRoot\..\..")
+$BuildConfiguration = $env:BUILDCONFIGURATION
+if (!$BuildConfiguration) {
+ $BuildConfiguration = 'Debug'
+}
+
+$result = @{}
+
+$VsixRoot = "$RepoRoot/bin/MessagePackAnalyzer.Vsix/$BuildConfiguration"
+if (Test-Path $VsixRoot) {
+ $result[$VsixRoot] = (Get-ChildItem "$VsixRoot/*vsix")
+}
+
+return $result
diff --git a/azure-pipelines/build.yml b/azure-pipelines/build.yml
index 126b0976..e15a2c20 100644
--- a/azure-pipelines/build.yml
+++ b/azure-pipelines/build.yml
@@ -1,63 +1,4 @@
steps:
-- checkout: self
- clean: true
-
-- task: UseDotNet@2
- displayName: Install .NET Core SDK 3.0.100
- inputs:
- packageType: sdk
- version: 3.0.100
-- task: UseDotNet@2
- displayName: Install .NET Core runtime 2.1.x
- inputs:
- packageType: runtime
- version: 2.1.x
-- task: UseDotNet@2
- displayName: Install .NET Core runtime 2.2.x
- inputs:
- packageType: runtime
- version: 2.2.x
-- script: dotnet --info
- displayName: Show dotnet SDK info
-
-- script: |
- dotnet tool install --tool-path . nbgv
- .\nbgv cloud -p src
- displayName: Set build number
-
-- task: PowerShell@2
- displayName: Set VSTS variables
- inputs:
- targetType: inline
- script: |
- if ($env:SignType -eq 'Real') {
- $feedGuid = '09d8d03c-1ac8-456e-9274-4d2364527d99'
- } else {
- $feedGuid = 'da484c78-f942-44ef-b197-99e2a1bef53c'
- }
-
- Write-Host "##vso[task.setvariable variable=feedGuid]$feedGuid"
-
- if ($env:ComputerName.StartsWith('factoryvm', [StringComparison]::OrdinalIgnoreCase)) {
- Write-Host "Running on hosted queue"
- Write-Host "##vso[task.setvariable variable=Hosted]true"
- }
-
- if ($env:SYSTEM_COLLECTIONID -eq '011b8bdf-6d56-4f87-be0d-0092136884d9') {
- Write-Host "Running on official devdiv account: $env:System_TeamFoundationCollectionUri"
- } else {
- Write-Host "Running under OSS account: $env:System_TeamFoundationCollectionUri"
- }
-
-- task: DotNetCoreCLI@2
- displayName: Restore
- inputs:
- command: restore
- verbosityRestore: normal # detailed, normal, minimal
- projects: '**\*.sln'
- feedsToUse: config
- nugetConfigPath: nuget.config
-
# Use VSBuild to pack because `dotnet pack` can't build VSIX projects.
- task: VSBuild@1
inputs:
@@ -81,59 +22,18 @@ steps:
dotnet publish src/MessagePack.Generator -r linux-x64 -c $(BuildConfiguration) /p:PublishSingleFile=true,PublishTrimmed=true,IncludeSymbolsInSingleFile=true
displayName: Building standalone mpc tool for all OSs
-- task: CopyFiles@1
- inputs:
- Contents: |
- obj/**/project.assets.json
- TargetFolder: $(Build.ArtifactStagingDirectory)/projectAssetsJson
- displayName: Collecting project.assets.json artifacts
- condition: succeededOrFailed()
-
-- task: PublishBuildArtifacts@1
- inputs:
- PathtoPublish: $(Build.ArtifactStagingDirectory)/projectAssetsJson
- ArtifactName: projectAssetsJson
- ArtifactType: Container
- displayName: Publish projectAssetsJson artifacts
- condition: succeededOrFailed()
-
-- task: PublishBuildArtifacts@1
- inputs:
- PathtoPublish: $(Build.ArtifactStagingDirectory)/build_logs
- ArtifactName: build_logs
- ArtifactType: Container
- displayName: Publish build_logs artifacts
- condition: succeededOrFailed()
-
## The rest of these steps are for deployment and skipped for PR builds
-- task: CopyFiles@1
+- task: PowerShell@2
inputs:
- Contents: |
- bin/Packages/$(BuildConfiguration)/**/*.nupkg
- bin/Packages/$(BuildConfiguration)/**/*.snupkg
- bin/MessagePackAnalyzer.Vsix/$(BuildConfiguration)/**/*.vsix
- bin/*.unitypackage
- TargetFolder: $(Build.ArtifactStagingDirectory)/deployables
- flattenFolders: true
- displayName: Collecting deployables
+ filePath: azure-pipelines/variables/_pipelines.ps1
+ failOnStderr: true
+ displayName: Update pipeline variables based on build outputs
+ condition: succeededOrFailed()
-- task: PublishBuildArtifacts@1
+- task: PowerShell@2
inputs:
- PathtoPublish: $(Build.ArtifactStagingDirectory)/deployables
- ArtifactName: deployables
- ArtifactType: Container
- displayName: Publish deployables artifacts
+ filePath: azure-pipelines/artifacts/_pipelines.ps1
+ # arguments: -ArtifactNameSuffix "-$(Agent.JobName)"
+ displayName: Publish artifacts
condition: succeededOrFailed()
-
-- publish: bin/MessagePack.Generator/$(BuildConfiguration)/netcoreapp3.0/win-x64/publish
- artifact: mpc-win
- displayName: Publish mpc for Windows
-
-- publish: bin/MessagePack.Generator/$(BuildConfiguration)/netcoreapp3.0/osx-x64/publish
- artifact: mpc-osx
- displayName: Publish mpc for OSX
-
-- publish: bin/MessagePack.Generator/$(BuildConfiguration)/netcoreapp3.0/linux-x64/publish
- artifact: mpc-linux
- displayName: Publish mpc for Linux
diff --git a/azure-pipelines/build_nonWindows.yml b/azure-pipelines/build_nonWindows.yml
index d694d4f5..98d895ba 100644
--- a/azure-pipelines/build_nonWindows.yml
+++ b/azure-pipelines/build_nonWindows.yml
@@ -1,30 +1,4 @@
steps:
-- task: UseDotNet@2
- displayName: Install .NET Core SDK 3.0.100
- inputs:
- packageType: sdk
- version: 3.0.100
-- task: UseDotNet@2
- displayName: Install .NET Core runtime 2.1.x
- inputs:
- packageType: runtime
- version: 2.1.x
-- task: UseDotNet@2
- displayName: Install .NET Core runtime 2.2.x
- inputs:
- packageType: runtime
- version: 2.2.x
-- script: dotnet --info
- displayName: Show dotnet SDK info
-
-- task: DotNetCoreCLI@2
- displayName: Restore
- inputs:
- command: restore
- verbosityRestore: normal # detailed, normal, minimal
- feedsToUse: config
- nugetConfigPath: nuget.config
-
- task: DotNetCoreCLI@2
displayName: Build MessagePack.sln
inputs:
diff --git a/azure-pipelines/build_unity.yml b/azure-pipelines/build_unity.yml
index 43e11986..faaac167 100644
--- a/azure-pipelines/build_unity.yml
+++ b/azure-pipelines/build_unity.yml
@@ -1,15 +1,4 @@
steps:
-- checkout: self
- clean: true
-
-- task: UseDotNet@2
- displayName: Install .NET Core SDK 3.0.100
- inputs:
- packageType: sdk
- version: 3.0.100
-- script: dotnet --info
- displayName: Show dotnet SDK info
-
- script: dotnet publish src/MessagePack -c $(BuildConfiguration) -f netstandard2.0
displayName: Build MessagePack
@@ -28,15 +17,15 @@ steps:
inputs:
Contents: |
bin/*.unitypackage
- TargetFolder: $(Build.ArtifactStagingDirectory)/deployables
+ TargetFolder: $(Build.ArtifactStagingDirectory)/unity
flattenFolders: true
displayName: Collecting deployables
condition: succeededOrFailed()
- task: PublishBuildArtifacts@1
inputs:
- PathtoPublish: $(Build.ArtifactStagingDirectory)/deployables
- ArtifactName: deployables
+ PathtoPublish: $(Build.ArtifactStagingDirectory)/unity
+ ArtifactName: unity
ArtifactType: Container
displayName: Publish deployables artifacts
condition: succeededOrFailed()
diff --git a/azure-pipelines/install-dependencies.yml b/azure-pipelines/install-dependencies.yml
new file mode 100644
index 00000000..8da07957
--- /dev/null
+++ b/azure-pipelines/install-dependencies.yml
@@ -0,0 +1,15 @@
+parameters:
+ initArgs:
+
+steps:
+
+- powershell: |
+ .\init.ps1 -AccessToken '$(System.AccessToken)' ${{ parameters['initArgs'] }}
+ dotnet --info
+ displayName: Install prerequisites
+
+- task: PowerShell@2
+ inputs:
+ filePath: azure-pipelines/variables/_pipelines.ps1
+ failOnStderr: true
+ displayName: Set pipeline variables based on source
diff --git a/azure-pipelines/justnugetorg.nuget.config b/azure-pipelines/justnugetorg.nuget.config
new file mode 100644
index 00000000..765346e5
--- /dev/null
+++ b/azure-pipelines/justnugetorg.nuget.config
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<configuration>
+ <packageSources>
+ <clear />
+ <add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
+ </packageSources>
+</configuration>
diff --git a/azure-pipelines/variables/DotNetSdkVersion.ps1 b/azure-pipelines/variables/DotNetSdkVersion.ps1
new file mode 100644
index 00000000..b213fbc2
--- /dev/null
+++ b/azure-pipelines/variables/DotNetSdkVersion.ps1
@@ -0,0 +1,2 @@
+$globalJson = Get-Content -Path "$PSScriptRoot\..\..\global.json" | ConvertFrom-Json
+$globalJson.sdk.version
diff --git a/azure-pipelines/variables/_all.ps1 b/azure-pipelines/variables/_all.ps1
new file mode 100644
index 00000000..ed099792
--- /dev/null
+++ b/azure-pipelines/variables/_all.ps1
@@ -0,0 +1,11 @@
+# This script returns a hashtable of build variables that should be set
+# at the start of a build or release definition's execution.
+
+$vars = @{}
+
+Get-ChildItem "$PSScriptRoot\*.ps1" -Exclude "_*" |% {
+ Write-Host "Computing $($_.BaseName) variable"
+ $vars[$_.BaseName] = & $_
+}
+
+$vars
diff --git a/azure-pipelines/variables/_pipelines.ps1 b/azure-pipelines/variables/_pipelines.ps1
new file mode 100644
index 00000000..9fa0c16b
--- /dev/null
+++ b/azure-pipelines/variables/_pipelines.ps1
@@ -0,0 +1,15 @@
+# This script translates the variables returned by the _all.ps1 script
+# into commands that instruct Azure Pipelines to actually set those variables for other pipeline tasks to consume.
+
+# The build or release definition may have set these variables to override
+# what the build would do. So only set them if they have not already been set.
+
+(& "$PSScriptRoot\_all.ps1").GetEnumerator() |% {
+ if (Test-Path -Path "env:$($_.Key.ToUpper())") {
+ Write-Host "Skipping setting $($_.Key) because variable is already set." -ForegroundColor Cyan
+ } else {
+ Write-Host "$($_.Key)=$($_.Value)" -ForegroundColor Yellow
+ Write-Host "##vso[task.setvariable variable=$($_.Key);]$($_.Value)"
+ Set-Item -Path "env:$($_.Key)" -Value $_.Value
+ }
+}