fast-blazor/eng/pipelines/build-all-lib.yml

230 строки
8.2 KiB
YAML

# Build all projects (manual).
name: $(FileVersion).$(Year:yy)$(DayOfYear).$(Rev:r)
trigger: none # Disable dev and main branches.
pr: none # Disable pull request triggers.
parameters:
- name: Projects # List of projects to build #**/Microsoft.FluentUI.AspNetCore.Components.Emoji.csproj
default: |
**/Microsoft.FluentUI.AspNetCore.Components.csproj
**/Microsoft.FluentUI.AspNetCore.Components.Icons.csproj
**/Microsoft.FluentUI.AspNetCore.Templates.csproj
**/Microsoft.FluentUI.AspNetCore.Components.DataGrid.EntityFrameworkAdapter.csproj
- name: Tests # List of Unit-Test projects to run
default: |
**/Microsoft.FluentUI.AspNetCore.Components.Tests.csproj
variables:
- template: /eng/pipelines/version.yml@self
- name: SignType
value: real
- name: TeamName
value: fluentui-blazor
# 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.Official.yml@MicroBuildTemplate
parameters:
# Update the pool with your team's 1ES hosted pool.
pool:
name: NetCore1ESPool-Internal
#image: windows.vs2022preview.amd64
image: 1es-windows-2022
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: PackageArtifacts
- output: nuget
useDotNetTask: false
packagesToPush: '$(Build.ArtifactStagingDirectory)/**/*.nupkg'
packageParentPath: '$(Build.ArtifactStagingDirectory)'
nuGetFeedType: internal
publishVstsFeed: public/dotnet8
allowPackageConflicts: true
steps:
# Compute AssemblyVersion and PackageVersion
# -> Update version.yml
- task: PowerShell@2
displayName: 'Compute AssemblyVersion and PackageVersion'
inputs:
targetType: 'filePath'
filePath: $(System.DefaultWorkingDirectory)/eng/pipelines/compute-version-variables.ps1
arguments: > # Use this to avoid newline characters in multiline string
-branchName "$(Build.SourceBranchName)"
-buildNumber "$(Build.BuildNumber)"
-packageSuffix "$(PackageSuffix)"
-testProjects "${{ parameters.Tests }}"
# 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: false
- task: UseDotNet@2
displayName: 'Install .NET 9.0'
inputs:
version: 9.0.x
includePreviewVersions: true
# Set version number (exclude some folders)
- task: PowerShell@2
displayName: 'Versioning $(Build.BuildNumber)'
inputs:
targetType: 'filePath'
filePath: $(System.DefaultWorkingDirectory)/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)"
# Restore packages
- task: DotNetCoreCLI@2
displayName: Restore packages
inputs:
command: 'restore'
projects: ${{ parameters.Projects }}
feedsToUse: config
nugetConfigPath: nuget.config
includeNuGetOrg: false
# NPM install Core.Assets
- task: Npm@1
displayName: "NPM install Core.Assets"
inputs:
command: "install"
workingDir: "src/Core.Assets"
# 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
# Index sources and publish symbols
#- task: PublishSymbols@2
# inputs:
# SearchPattern: '**/bin/**/*.pdb' # string. Required. Search pattern. Default: **/bin/**/*.pdb.
# SymbolServerType: 'TeamServices'
# 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\'
# Copy signed packages
- 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