- Move pipelies to eng/pipelines
This commit is contained in:
Родитель
694edf6563
Коммит
c06b32b808
|
@ -1,19 +0,0 @@
|
||||||
# Build Demo project.
|
|
||||||
|
|
||||||
pr: none # Disable pull request triggers.
|
|
||||||
trigger:
|
|
||||||
- main
|
|
||||||
- dev
|
|
||||||
|
|
||||||
# Build.BuildNumber (see versioning.yml)
|
|
||||||
name: $(FileVersion).$(Year:yy)$(DayOfYear).$(Rev:r)
|
|
||||||
|
|
||||||
pool:
|
|
||||||
name: Fluent-Blazor-1ESPT
|
|
||||||
|
|
||||||
extends:
|
|
||||||
template: common/template-to-build-projects.yml
|
|
||||||
parameters:
|
|
||||||
Projects: |
|
|
||||||
**/FluentUI.Demo.Client.csproj
|
|
||||||
IsDemo: true
|
|
|
@ -1,293 +0,0 @@
|
||||||
parameters:
|
|
||||||
- name: Projects # List of projects to build
|
|
||||||
type: string
|
|
||||||
default: ''
|
|
||||||
|
|
||||||
- name: Tests # List of Unit-Test projects to run
|
|
||||||
type: string
|
|
||||||
default: ''
|
|
||||||
|
|
||||||
- name: IsDemo # Projects to publish
|
|
||||||
type: boolean
|
|
||||||
default: false
|
|
||||||
|
|
||||||
variables:
|
|
||||||
- template: versioning.yml # Versions
|
|
||||||
|
|
||||||
steps:
|
|
||||||
|
|
||||||
# Compute AssemblyVersion and PackageVersion
|
|
||||||
# -> Update Versioning.yml
|
|
||||||
- powershell: |
|
|
||||||
|
|
||||||
# Example with FileVersion: "1.2.4" and PackageSuffix: "RC.1"
|
|
||||||
# Build.BuildNumber = 1.2.4.23296.1
|
|
||||||
# = $(FileVersion).$(Year:yy)$(DayOfYear).$(Rev:r)
|
|
||||||
|
|
||||||
# Defaut values
|
|
||||||
$branch = "PR"
|
|
||||||
$package = ""
|
|
||||||
$demo = "${{ parameters.IsDemo }}".toLower()
|
|
||||||
|
|
||||||
# To Sign and To Test
|
|
||||||
$sign = "false"
|
|
||||||
$toTest = "true"
|
|
||||||
|
|
||||||
# BranchName = dev, main, archive or PR
|
|
||||||
if ("$(Build.SourceBranch)" -eq "refs/heads/main")
|
|
||||||
{
|
|
||||||
$branch = "main"
|
|
||||||
}
|
|
||||||
elseif ("$(Build.SourceBranch)" -eq "refs/heads/dev")
|
|
||||||
{
|
|
||||||
$branch = "dev"
|
|
||||||
}
|
|
||||||
elseif ("$(Build.SourceBranch)" -like "refs/heads/archives/*")
|
|
||||||
{
|
|
||||||
$branch = "archive"
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$branch = "PR"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Debug Only - To remove
|
|
||||||
# if ("$(PublicVersion)" -ne "")
|
|
||||||
# {
|
|
||||||
# $branch = "$(PublicVersion)"
|
|
||||||
# }
|
|
||||||
|
|
||||||
# [1, 2, 4, 23296, 1]
|
|
||||||
$builds = "$(Build.BuildNumber)".Split('.')
|
|
||||||
|
|
||||||
# 1.2.4.23296
|
|
||||||
$assembly = "$($builds[0]).$($builds[1]).$($builds[2]).$($builds[3])"
|
|
||||||
|
|
||||||
# Main or Archive without PackageSuffix: 1.2.4
|
|
||||||
# Main or Archive with PackageSuffix: 1.2.4-rc.1
|
|
||||||
if ("$branch" -eq "main" -or "$branch" -eq "archive")
|
|
||||||
{
|
|
||||||
# Main without PackageSuffix
|
|
||||||
if ("$(PackageSuffix)" -eq "")
|
|
||||||
{
|
|
||||||
$package = "$($builds[0]).$($builds[1]).$($builds[2])"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Main with PackageSuffix
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$package = "$($builds[0]).$($builds[1]).$($builds[2])-$(PackageSuffix)"
|
|
||||||
}
|
|
||||||
|
|
||||||
$sign = "true"
|
|
||||||
$toTest = "true"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Dev: 1.2.4-preview-23296-1
|
|
||||||
elseif ("$branch" -eq "dev")
|
|
||||||
{
|
|
||||||
$package = "$($builds[0]).$($builds[1]).$($builds[2])-preview.$($builds[3]).$($builds[4])"
|
|
||||||
$sign = "true"
|
|
||||||
$toTest = "true"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Other branches: 1.2.4-preview-23296-1
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$package = "$($builds[0]).$($builds[1]).$($builds[2])-preview.$($builds[3]).$($builds[4])"
|
|
||||||
$sign = "false"
|
|
||||||
$toTest = "true"
|
|
||||||
}
|
|
||||||
|
|
||||||
if ("${{ parameters.Tests }}" -eq "")
|
|
||||||
{
|
|
||||||
$toTest = "false"
|
|
||||||
}
|
|
||||||
|
|
||||||
if ("$demo" -eq "true")
|
|
||||||
{
|
|
||||||
$sign = "false"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Set the output variable for use in other tasks.
|
|
||||||
Write-Host "##vso[task.setvariable variable=BranchName]${branch}"
|
|
||||||
Write-Host "##vso[task.setvariable variable=AssemblyVersion]${assembly}"
|
|
||||||
Write-Host "##vso[task.setvariable variable=PackageVersion]${package}"
|
|
||||||
Write-Host "##vso[task.setvariable variable=ShouldSign]${sign}"
|
|
||||||
Write-Host "##vso[task.setvariable variable=ShouldTest]${toTest}"
|
|
||||||
Write-Host "##vso[task.setvariable variable=ShouldPublish]${demo}"
|
|
||||||
displayName: Compute AssemblyVersion and PackageVersion
|
|
||||||
|
|
||||||
# Display computed variables
|
|
||||||
- script: |
|
|
||||||
echo 🔸 FileVersion = $(FileVersion)
|
|
||||||
echo 🔸 PackageSuffix = $(PackageSuffix)
|
|
||||||
echo 🔸 Build.BuildNumber = $(Build.BuildNumber)
|
|
||||||
echo 🔸 Build.SourceBranch = $(Build.SourceBranch)
|
|
||||||
echo -----------------------------------------------
|
|
||||||
echo 🔸 BranchName = $(BranchName)
|
|
||||||
echo 🔸 AssemblyVersion = $(AssemblyVersion)
|
|
||||||
echo 🔸 PackageVersion = $(PackageVersion)
|
|
||||||
echo -----------------------------------------------
|
|
||||||
echo 🔸 ShouldSign = $(ShouldSign)
|
|
||||||
echo 🔸 ShouldTest = $(ShouldTest)
|
|
||||||
echo 🔸 ShouldPublish = $(ShouldPublish)
|
|
||||||
displayName: Display computed variables
|
|
||||||
|
|
||||||
# Install NuGet tools
|
|
||||||
- task: NuGetToolInstaller@1
|
|
||||||
displayName: Install NuGet tools
|
|
||||||
|
|
||||||
# Install .NET 6.0
|
|
||||||
- task: UseDotNet@2
|
|
||||||
displayName: Install .NET 6.0
|
|
||||||
inputs:
|
|
||||||
version: 6.0.x
|
|
||||||
includePreviewVersions: true
|
|
||||||
|
|
||||||
# Install .NET 7.0
|
|
||||||
- task: UseDotNet@2
|
|
||||||
displayName: 'Install .NET 7.0'
|
|
||||||
inputs:
|
|
||||||
version: 7.0.x
|
|
||||||
includePreviewVersions: true
|
|
||||||
|
|
||||||
# Install .NET 8.0
|
|
||||||
- task: UseDotNet@2
|
|
||||||
displayName: 'Install .NET 8.0'
|
|
||||||
inputs:
|
|
||||||
version: 8.0.x
|
|
||||||
includePreviewVersions: true
|
|
||||||
|
|
||||||
# Install nodejs
|
|
||||||
- task: NodeTool@0
|
|
||||||
displayName: 'Install nodejs'
|
|
||||||
inputs:
|
|
||||||
versionSpec: '20.x'
|
|
||||||
|
|
||||||
# Set version number (exclude some folders)
|
|
||||||
- task: PowerShell@2
|
|
||||||
displayName: 'Versioning $(Build.BuildNumber)'
|
|
||||||
inputs:
|
|
||||||
targetType: 'filePath'
|
|
||||||
filePath: $(System.DefaultWorkingDirectory)/.azure-devops/common/update-assembly-version.ps1
|
|
||||||
arguments: > # Use this to avoid newline characters in multiline string
|
|
||||||
-sourcePath "$(System.DefaultWorkingDirectory)/"
|
|
||||||
-excludePatterns "**/src/Templates/content/**/*.csproj", "**/tests/TemplateValidation/**/*.csproj"
|
|
||||||
-assemblyVersion "$(AssemblyVersion)"
|
|
||||||
-packageVersion "$(PackageVersion)"
|
|
||||||
|
|
||||||
# Install dependencies
|
|
||||||
- task: DotNetCoreCLI@2
|
|
||||||
displayName: Install dependencies
|
|
||||||
inputs:
|
|
||||||
command: 'restore'
|
|
||||||
projects: ${{ parameters.Projects }}
|
|
||||||
|
|
||||||
# Build the projects
|
|
||||||
- task: DotNetCoreCLI@2
|
|
||||||
displayName: 'Build $(Build.BuildNumber)'
|
|
||||||
condition: eq(variables['ShouldPublish'], 'false')
|
|
||||||
inputs:
|
|
||||||
command: 'build'
|
|
||||||
projects: ${{ parameters.Projects }}
|
|
||||||
arguments: '--configuration Release'
|
|
||||||
|
|
||||||
# Test and generate Code Coverage
|
|
||||||
- task: DotNetCoreCLI@2
|
|
||||||
condition: eq(variables['ShouldTest'], 'true')
|
|
||||||
displayName: 'Test and Code Coverage'
|
|
||||||
inputs:
|
|
||||||
command: test
|
|
||||||
projects: ${{ parameters.Tests }}
|
|
||||||
arguments: '--configuration Release /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura /p:DebugType=Full'
|
|
||||||
publishTestResults: true
|
|
||||||
|
|
||||||
# Coverage Generation
|
|
||||||
- task: reportgenerator@5
|
|
||||||
condition: eq(variables['ShouldTest'], 'true')
|
|
||||||
displayName: Generate reports
|
|
||||||
inputs:
|
|
||||||
reports: '**/*.cobertura.xml'
|
|
||||||
targetdir: 'CoverageFolder'
|
|
||||||
reporttypes: 'HtmlInline_AzurePipelines'
|
|
||||||
|
|
||||||
# Publish code coverage
|
|
||||||
- task: PublishCodeCoverageResults@2
|
|
||||||
condition: eq(variables['ShouldTest'], 'true')
|
|
||||||
displayName: 'Publish code coverage'
|
|
||||||
inputs:
|
|
||||||
codeCoverageTool: Cobertura
|
|
||||||
summaryFileLocation: '**/*.cobertura.xml'
|
|
||||||
reportDirectory: CoverageFolder
|
|
||||||
|
|
||||||
# Not currently used (kept for archives)
|
|
||||||
# - task: DotNetCoreCLI@2
|
|
||||||
# displayName: Pack $(Build.BuildNumber)
|
|
||||||
# inputs:
|
|
||||||
# command: 'pack'
|
|
||||||
# packagesToPack: ${{ parameters.Projects }}
|
|
||||||
# versioningScheme: 'off'
|
|
||||||
# nobuild: true
|
|
||||||
# verbosityPack: 'Normal'
|
|
||||||
# feedsToUse: 'config'
|
|
||||||
# nugetConfigPath:
|
|
||||||
|
|
||||||
# Since NuGet packages are generated during the build, we need to copy them to the artifacts folder.
|
|
||||||
- task: CopyFiles@2
|
|
||||||
displayName: 'Pack $(Build.BuildNumber)'
|
|
||||||
condition: eq(variables['ShouldPublish'], 'false')
|
|
||||||
inputs:
|
|
||||||
SourceFolder: '$(Build.SourcesDirectory)'
|
|
||||||
Contents: '**/*$(PackageVersion).nupkg'
|
|
||||||
TargetFolder: '$(Build.ArtifactStagingDirectory)'
|
|
||||||
CleanTargetFolder: true
|
|
||||||
OverWrite: true
|
|
||||||
flattenFolders: true
|
|
||||||
|
|
||||||
# ESRP Code Signing SC
|
|
||||||
- task: EsrpCodeSigning@3
|
|
||||||
condition: eq(variables['ShouldSign'], 'true')
|
|
||||||
inputs:
|
|
||||||
ConnectedServiceName: 'ESRP Code Signing SC'
|
|
||||||
FolderPath: '$(Build.ArtifactStagingDirectory)'
|
|
||||||
Pattern: '**/*.nupkg'
|
|
||||||
UseMinimatch: true
|
|
||||||
signConfigType: 'inlineSignParams'
|
|
||||||
inlineOperation: |
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"KeyCode" : "CP-401405",
|
|
||||||
"OperationCode" : "NuGetSign",
|
|
||||||
"Parameters" : {},
|
|
||||||
"ToolName" : "sign",
|
|
||||||
"ToolVersion" : "1.0"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"KeyCode" : "CP-401405",
|
|
||||||
"OperationCode" : "NuGetVerify",
|
|
||||||
"Parameters" : {},
|
|
||||||
"ToolName" : "sign",
|
|
||||||
"ToolVersion" : "1.0"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
SessionTimeout: '60'
|
|
||||||
MaxConcurrency: '200'
|
|
||||||
MaxRetryAttempts: '5'
|
|
||||||
|
|
||||||
# Publish the projects
|
|
||||||
- task: DotNetCoreCLI@2
|
|
||||||
displayName: 'Publish $(Build.BuildNumber)'
|
|
||||||
condition: eq(variables['ShouldPublish'], 'true')
|
|
||||||
inputs:
|
|
||||||
command: 'publish'
|
|
||||||
publishWebProjects: false # True to build all Web Projects
|
|
||||||
projects: ${{ parameters.Projects }}
|
|
||||||
arguments: '--configuration Release --output $(Build.ArtifactStagingDirectory)'
|
|
||||||
zipAfterPublish: false
|
|
||||||
workingDirectory: '$(Build.SourcesDirectory)'
|
|
||||||
|
|
||||||
# Publish the Artifacts
|
|
||||||
- task: PublishBuildArtifacts@1
|
|
||||||
inputs:
|
|
||||||
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
|
|
|
@ -41,17 +41,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "AssetExplorer", "AssetExplo
|
||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FluentUI.Demo.AssetExplorer", "examples\Demo\AssetExplorer\FluentUI.Demo.AssetExplorer.csproj", "{E4E62EAA-38FC-48FE-B63E-EB4ABAD660D2}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FluentUI.Demo.AssetExplorer", "examples\Demo\AssetExplorer\FluentUI.Demo.AssetExplorer.csproj", "{E4E62EAA-38FC-48FE-B63E-EB4ABAD660D2}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{B89F06FD-2497-4041-B9EE-EDD889A2C14C}"
|
|
||||||
ProjectSection(SolutionItems) = preProject
|
|
||||||
.editorconfig = .editorconfig
|
|
||||||
Directory.Build.props = Directory.Build.props
|
|
||||||
Directory.Packages.props = Directory.Packages.props
|
|
||||||
global.json = global.json
|
|
||||||
LICENSE = LICENSE
|
|
||||||
NuGet.config = NuGet.config
|
|
||||||
spelling.dic = spelling.dic
|
|
||||||
EndProjectSection
|
|
||||||
EndProject
|
|
||||||
Project("{54A90642-561A-4BB1-A94E-469ADEE60C69}") = "Microsoft.FluentUI.AspNetCore.Components.Assets", "src\Core.Assets\Microsoft.FluentUI.AspNetCore.Components.Assets.esproj", "{292081C2-5076-467C-AEFF-12DC0617531A}"
|
Project("{54A90642-561A-4BB1-A94E-469ADEE60C69}") = "Microsoft.FluentUI.AspNetCore.Components.Assets", "src\Core.Assets\Microsoft.FluentUI.AspNetCore.Components.Assets.esproj", "{292081C2-5076-467C-AEFF-12DC0617531A}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
# Build all projects.
|
||||||
|
|
||||||
|
# Build only manually
|
||||||
|
pr: none # Disable pull request triggers.
|
||||||
|
trigger: none # Disable dev and main branches.
|
||||||
|
|
||||||
|
# Build.BuildNumber (see versioning.yml)
|
||||||
|
name: $(FileVersion).$(Year:yy)$(DayOfYear).$(Rev:r)
|
||||||
|
|
||||||
|
pool:
|
||||||
|
name: Fluent-Blazor-1ESPT
|
||||||
|
|
||||||
|
extends:
|
||||||
|
template: common/template-to-build-projects.yml
|
||||||
|
parameters:
|
||||||
|
Projects: |
|
||||||
|
**/Microsoft.FluentUI.AspNetCore.Components.csproj
|
||||||
|
**/Microsoft.FluentUI.AspNetCore.Components.Icons.csproj
|
||||||
|
**/Microsoft.FluentUI.AspNetCore.Components.Emoji.csproj
|
||||||
|
**/Microsoft.FluentUI.AspNetCore.Templates.csproj
|
||||||
|
**/Microsoft.FluentUI.AspNetCore.Components.DataGrid.EntityFrameworkAdapter.csproj
|
||||||
|
Tests: |
|
||||||
|
**/Microsoft.FluentUI.AspNetCore.Components.Tests.csproj
|
|
@ -0,0 +1,316 @@
|
||||||
|
# Build and test Core project.
|
||||||
|
name: $(FileVersion).$(Year:yy)$(DayOfYear).$(Rev:r)
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
batch: true
|
||||||
|
branches:
|
||||||
|
include:
|
||||||
|
- main
|
||||||
|
- dev
|
||||||
|
- archives/v3
|
||||||
|
|
||||||
|
paths:
|
||||||
|
include:
|
||||||
|
- '*'
|
||||||
|
exclude:
|
||||||
|
- .github/*
|
||||||
|
- .devcontainer/*
|
||||||
|
- docs/*
|
||||||
|
- CODE_OF_CONDUCT.md
|
||||||
|
- README.md
|
||||||
|
- SECURITY.md
|
||||||
|
- LICENSE.TXT
|
||||||
|
- THIRD-PARTY-NOTICES.TXT
|
||||||
|
|
||||||
|
pr:
|
||||||
|
branches:
|
||||||
|
include:
|
||||||
|
- main
|
||||||
|
- dev
|
||||||
|
|
||||||
|
paths:
|
||||||
|
include:
|
||||||
|
- '*'
|
||||||
|
exclude:
|
||||||
|
- .github/*
|
||||||
|
- .devcontainer/*
|
||||||
|
- docs/*
|
||||||
|
- CODE_OF_CONDUCT.md
|
||||||
|
- README.md
|
||||||
|
- SECURITY.md
|
||||||
|
- LICENSE.TXT
|
||||||
|
- THIRD-PARTY-NOTICES.TXT
|
||||||
|
|
||||||
|
parameters:
|
||||||
|
- name: Projects # List of projects to build
|
||||||
|
type: string
|
||||||
|
default: '**/Microsoft.FluentUI.AspNetCore.Components.csproj'
|
||||||
|
|
||||||
|
- name: Tests # List of Unit-Test projects to run
|
||||||
|
type: string
|
||||||
|
default: '**/Microsoft.FluentUI.AspNetCore.Components.Tests.csproj'
|
||||||
|
|
||||||
|
variables:
|
||||||
|
- template: /eng/pipelines/version.yml@self
|
||||||
|
|
||||||
|
- name: SignType
|
||||||
|
value: real
|
||||||
|
|
||||||
|
# The `resources` specify the location and version of the 1ES PT.
|
||||||
|
resources:
|
||||||
|
repositories:
|
||||||
|
#- repository: 1esPipelines
|
||||||
|
- repository: MicroBuildTemplate
|
||||||
|
type: git
|
||||||
|
#name: 1ESPipelineTemplates/1ESPipelineTemplates
|
||||||
|
name: 1ESPipelineTemplates/MicroBuildTemplate
|
||||||
|
ref: refs/tags/release
|
||||||
|
|
||||||
|
extends:
|
||||||
|
# The pipeline extends the 1ES PT which will inject different SDL and compliance tasks.
|
||||||
|
# For non-production pipelines, use "Unofficial" as defined below.
|
||||||
|
# For productions pipelines, use "Official".
|
||||||
|
#template: v1/1ES.Unofficial.PipelineTemplate.yml@1esPipelines
|
||||||
|
template: azure-pipelines/MicroBuild.1ES.Unofficial.yml@MicroBuildTemplate
|
||||||
|
parameters:
|
||||||
|
# Update the pool with your team's 1ES hosted pool.
|
||||||
|
pool:
|
||||||
|
name: NetCore1ESPool-Internal
|
||||||
|
image: windows.vs2022preview.amd64
|
||||||
|
os: windows
|
||||||
|
|
||||||
|
stages:
|
||||||
|
|
||||||
|
# ----------------------------------------------------------------
|
||||||
|
# This stage performs build, test, packaging
|
||||||
|
# ----------------------------------------------------------------
|
||||||
|
- stage: build
|
||||||
|
displayName: Build
|
||||||
|
jobs:
|
||||||
|
- job: BuildTestPackJob
|
||||||
|
templateContext:
|
||||||
|
mb:
|
||||||
|
signing:
|
||||||
|
enabled: true
|
||||||
|
signType: $(SignType)
|
||||||
|
zipSources: false
|
||||||
|
feedSource: https://dnceng.pkgs.visualstudio.com/_packaging/MicroBuildToolset/nuget/v3/index.json
|
||||||
|
env:
|
||||||
|
TeamName: 'fluentui-blazor'
|
||||||
|
outputs:
|
||||||
|
- output: pipelineArtifact
|
||||||
|
targetPath: '$(Build.ArtifactStagingDirectory)\SignedPackages'
|
||||||
|
artifactName: build-core-artifacts
|
||||||
|
|
||||||
|
steps:
|
||||||
|
# Compute AssemblyVersion and PackageVersion
|
||||||
|
# -> Update version.yml
|
||||||
|
- powershell: |
|
||||||
|
|
||||||
|
# Example with FileVersion: "1.2.4" and PackageSuffix: "RC.1"
|
||||||
|
# Build.BuildNumber = 1.2.4.23296.1
|
||||||
|
# = $(FileVersion).$(Year:yy)$(DayOfYear).$(Rev:r)
|
||||||
|
|
||||||
|
# Default values
|
||||||
|
$branch = "PR"
|
||||||
|
$package = ""
|
||||||
|
|
||||||
|
# To Test?
|
||||||
|
$toTest = "true"
|
||||||
|
|
||||||
|
# BranchName = dev, main, archive or PR
|
||||||
|
if ("$(Build.SourceBranchName)" -eq "main")
|
||||||
|
{
|
||||||
|
$branch = "main"
|
||||||
|
}
|
||||||
|
elseif ("$(Build.SourceBranchName)" -eq "dev")
|
||||||
|
{
|
||||||
|
$branch = "dev"
|
||||||
|
}
|
||||||
|
elseif ("$(Build.SourceBranch)" -like "refs/heads/archives/*")
|
||||||
|
{
|
||||||
|
$branch = "archive"
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$branch = "PR"
|
||||||
|
}
|
||||||
|
|
||||||
|
# [1, 2, 4, 23296, 1]
|
||||||
|
$builds = "$(Build.BuildNumber)".Split('.')
|
||||||
|
|
||||||
|
# 1.2.4.23296
|
||||||
|
$assembly = "$($builds[0]).$($builds[1]).$($builds[2]).$($builds[3])"
|
||||||
|
|
||||||
|
# Main or Archive without PackageSuffix: 1.2.4
|
||||||
|
# Main or Archive with PackageSuffix: 1.2.4-rc.1
|
||||||
|
if ("$branch" -eq "main" -or "$branch" -eq "archive")
|
||||||
|
{
|
||||||
|
# Main without PackageSuffix
|
||||||
|
if ("$(PackageSuffix)" -eq "")
|
||||||
|
{
|
||||||
|
$package = "$($builds[0]).$($builds[1]).$($builds[2])"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Main with PackageSuffix
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$package = "$($builds[0]).$($builds[1]).$($builds[2])-$(PackageSuffix)"
|
||||||
|
}
|
||||||
|
|
||||||
|
$toTest = "true"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Dev: 1.2.4-preview-23296-1
|
||||||
|
elseif ("$branch" -eq "dev")
|
||||||
|
{
|
||||||
|
$package = "$($builds[0]).$($builds[1]).$($builds[2])-preview.$($builds[3]).$($builds[4])"
|
||||||
|
$toTest = "true"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Other branches: 1.2.4-preview-23296-1
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$package = "$($builds[0]).$($builds[1]).$($builds[2])-preview.$($builds[3]).$($builds[4])"
|
||||||
|
$toTest = "true"
|
||||||
|
}
|
||||||
|
|
||||||
|
if ("${{ parameters.Tests }}" -eq "")
|
||||||
|
{
|
||||||
|
$toTest = "false"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Set the output variable for use in other tasks.
|
||||||
|
Write-Host "##vso[task.setvariable variable=AssemblyVersion]${assembly}"
|
||||||
|
Write-Host "##vso[task.setvariable variable=PackageVersion]${package}"
|
||||||
|
Write-Host "##vso[task.setvariable variable=ShouldTest]${toTest}"
|
||||||
|
displayName: Compute AssemblyVersion and PackageVersion
|
||||||
|
|
||||||
|
# Display computed variables
|
||||||
|
- script: |
|
||||||
|
echo 🔸 FileVersion = $(FileVersion)
|
||||||
|
echo 🔸 PackageSuffix = $(PackageSuffix)
|
||||||
|
echo 🔸 Build.BuildNumber = $(Build.BuildNumber)
|
||||||
|
echo 🔸 Build.SourceBranch = $(Build.SourceBranch)
|
||||||
|
echo -----------------------------------------------
|
||||||
|
echo 🔸 AssemblyVersion = $(AssemblyVersion)
|
||||||
|
echo 🔸 PackageVersion = $(PackageVersion)
|
||||||
|
echo -----------------------------------------------
|
||||||
|
echo 🔸 ShouldTest = $(ShouldTest)
|
||||||
|
displayName: Display computed variables
|
||||||
|
|
||||||
|
# Install NuGet tools
|
||||||
|
- task: NuGetToolInstaller@1
|
||||||
|
displayName: Install NuGet tools
|
||||||
|
|
||||||
|
- ${{ if eq(variables['Build.SourceBranchName'], 'v3') }}:
|
||||||
|
# Install .NET 6.0
|
||||||
|
- task: UseDotNet@2
|
||||||
|
displayName: Install .NET 6.0
|
||||||
|
inputs:
|
||||||
|
version: 6.0.x
|
||||||
|
includePreviewVersions: true
|
||||||
|
|
||||||
|
# Install .NET 7.0
|
||||||
|
- task: UseDotNet@2
|
||||||
|
displayName: 'Install .NET 7.0'
|
||||||
|
inputs:
|
||||||
|
version: 7.0.x
|
||||||
|
includePreviewVersions: true
|
||||||
|
|
||||||
|
# Install .NET 8.0
|
||||||
|
- task: UseDotNet@2
|
||||||
|
displayName: 'Install .NET 8.0'
|
||||||
|
inputs:
|
||||||
|
version: 8.0.x
|
||||||
|
includePreviewVersions: true
|
||||||
|
|
||||||
|
# Install nodejs
|
||||||
|
- task: NodeTool@0
|
||||||
|
displayName: 'Install nodejs'
|
||||||
|
inputs:
|
||||||
|
versionSpec: '20.x'
|
||||||
|
|
||||||
|
# Set version number (exclude some folders)
|
||||||
|
- task: PowerShell@2
|
||||||
|
displayName: 'Versioning $(Build.BuildNumber)'
|
||||||
|
inputs:
|
||||||
|
targetType: 'filePath'
|
||||||
|
filePath: /eng/pipelines/update-assembly-version.ps1
|
||||||
|
arguments: > # Use this to avoid newline characters in multiline string
|
||||||
|
-sourcePath "$(System.DefaultWorkingDirectory)/"
|
||||||
|
-excludePatterns "**/src/Templates/content/**/*.csproj", "**/tests/TemplateValidation/**/*.csproj"
|
||||||
|
-assemblyVersion "$(AssemblyVersion)"
|
||||||
|
-packageVersion "$(PackageVersion)"
|
||||||
|
|
||||||
|
# Install dependencies
|
||||||
|
- task: DotNetCoreCLI@2
|
||||||
|
displayName: Install dependencies
|
||||||
|
inputs:
|
||||||
|
command: 'restore'
|
||||||
|
projects: ${{ parameters.Projects }}
|
||||||
|
|
||||||
|
# Build the projects
|
||||||
|
- task: DotNetCoreCLI@2
|
||||||
|
displayName: 'Build $(Build.BuildNumber)'
|
||||||
|
inputs:
|
||||||
|
command: 'build'
|
||||||
|
projects: ${{ parameters.Projects }}
|
||||||
|
arguments: '--configuration Release /p:ContinuousIntegrationBuild=true'
|
||||||
|
|
||||||
|
# Test and generate Code Coverage
|
||||||
|
- task: DotNetCoreCLI@2
|
||||||
|
condition: eq(variables['ShouldTest'], 'true')
|
||||||
|
displayName: 'Test and Code Coverage'
|
||||||
|
inputs:
|
||||||
|
command: test
|
||||||
|
projects: ${{ parameters.Tests }}
|
||||||
|
arguments: '--configuration Release /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura /p:DebugType=Full'
|
||||||
|
publishTestResults: true
|
||||||
|
|
||||||
|
# Coverage Generation
|
||||||
|
- task: reportgenerator@5
|
||||||
|
condition: eq(variables['ShouldTest'], 'true')
|
||||||
|
displayName: Generate reports
|
||||||
|
inputs:
|
||||||
|
reports: '**/*.cobertura.xml'
|
||||||
|
targetdir: 'CoverageFolder'
|
||||||
|
reporttypes: 'HtmlInline_AzurePipelines'
|
||||||
|
|
||||||
|
# Publish code coverage
|
||||||
|
- task: PublishCodeCoverageResults@2
|
||||||
|
condition: eq(variables['ShouldTest'], 'true')
|
||||||
|
displayName: 'Publish code coverage'
|
||||||
|
inputs:
|
||||||
|
codeCoverageTool: Cobertura
|
||||||
|
summaryFileLocation: '**/*.cobertura.xml'
|
||||||
|
reportDirectory: CoverageFolder
|
||||||
|
|
||||||
|
# Since NuGet packages are generated during the build, we need to copy them to the artifacts folder.
|
||||||
|
- task: CopyFiles@2
|
||||||
|
displayName: 'Pack $(Build.BuildNumber)'
|
||||||
|
inputs:
|
||||||
|
SourceFolder: '$(Build.SourcesDirectory)'
|
||||||
|
Contents: '**/*$(PackageVersion).nupkg'
|
||||||
|
TargetFolder: '$(Build.ArtifactStagingDirectory)'
|
||||||
|
CleanTargetFolder: false
|
||||||
|
OverWrite: true
|
||||||
|
flattenFolders: true
|
||||||
|
|
||||||
|
# Sign
|
||||||
|
- task: MSBuild@1
|
||||||
|
displayName: 'Sign NuGet Packages'
|
||||||
|
inputs:
|
||||||
|
solution: 'Microsoft.FluentUI.signproj'
|
||||||
|
msbuildArguments: '/p:OutDir=$(Build.ArtifactStagingDirectory)\ /p:IntermediateOutputPath=$(Build.ArtifactStagingDirectory)\sign\'
|
||||||
|
|
||||||
|
|
||||||
|
- task: CopyFiles@2
|
||||||
|
displayName: 'Copy signed packages to pickup folder'
|
||||||
|
inputs:
|
||||||
|
SourceFolder: '$(Build.SourcesDirectory)'
|
||||||
|
Contents: '**/*$(PackageVersion).nupkg'
|
||||||
|
TargetFolder: '$(Build.ArtifactStagingDirectory)\SignedPackages'
|
||||||
|
CleanTargetFolder: false
|
||||||
|
OverWrite: true
|
||||||
|
flattenFolders: true
|
Загрузка…
Ссылка в новой задаче