251 строка
8.0 KiB
YAML
251 строка
8.0 KiB
YAML
# 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
|
|
default: |
|
|
**/Microsoft.FluentUI.AspNetCore.Components.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: test
|
|
|
|
- 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: 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 -warnaserror'
|
|
|
|
# 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\'
|
|
|
|
# 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
|