299 строки
12 KiB
YAML
299 строки
12 KiB
YAML
variables:
|
|
CurrentSemanticVersionBase: '99.0.0'
|
|
PreviewNumber: $[counter(variables['CurrentSemanticVersionBase'], 1001)]
|
|
CurrentSemanticVersion: '$(CurrentSemanticVersionBase)-preview$(PreviewNumber)'
|
|
NugetPackageVersion: '$(CurrentSemanticVersion)'
|
|
NET_VERSION: '8.0.x'
|
|
RunPoliCheck: false
|
|
PathToLibrarySolution: 'src/CommunityToolkit.Maui.Markup.sln'
|
|
PathToSamplesSolution: 'samples/CommunityToolkit.Maui.Markup.Sample.sln'
|
|
PathToCommunityToolkitCsproj: 'src/CommunityToolkit.Maui.Markup/CommunityToolkit.Maui.Markup.csproj'
|
|
PathToCommunityToolkitSampleCsproj: 'samples/CommunityToolkit.Maui.Markup.Sample/CommunityToolkit.Maui.Markup.Sample.csproj'
|
|
PathToCommunityToolkitUnitTestCsproj: 'src/CommunityToolkit.Maui.Markup.UnitTests/CommunityToolkit.Maui.Markup.UnitTests.csproj'
|
|
PathToCommunityToolkitBenchmarkCsproj: 'src/CommunityToolkit.Maui.Markup.Benchmarks/CommunityToolkit.Maui.Markup.Benchmarks.csproj'
|
|
PathToCommunityToolkitSourceGeneratorsCsproj: 'src/CommunityToolkit.Maui.Markup.SourceGenerators/CommunityToolkit.Maui.Markup.SourceGenerators.csproj'
|
|
CommunityToolkitSampleApp_Xcode_Version: '16'
|
|
CommunityToolkitLibrary_Xcode_Version: '16'
|
|
ShouldCheckDependencies: true
|
|
|
|
trigger:
|
|
branches:
|
|
include:
|
|
- main
|
|
tags:
|
|
include:
|
|
- '*'
|
|
paths:
|
|
exclude:
|
|
- README.md
|
|
|
|
pr:
|
|
autoCancel: 'true'
|
|
branches:
|
|
include:
|
|
- main
|
|
paths:
|
|
exclude:
|
|
- README.md
|
|
|
|
schedules:
|
|
- cron: "0 0 * * *"
|
|
displayName: Daily midnight build
|
|
branches:
|
|
include:
|
|
- main
|
|
|
|
jobs:
|
|
- job: build_sample
|
|
displayName: Build Sample App
|
|
strategy:
|
|
matrix:
|
|
'Windows':
|
|
image: 'windows-latest'
|
|
'macOS':
|
|
image: 'macos-14'
|
|
pool:
|
|
vmImage: $(image)
|
|
steps:
|
|
- script: |
|
|
sudo xcode-select -s /Applications/Xcode_$(CommunityToolkitSampleApp_Xcode_Version).app
|
|
sudo xcode-select -p
|
|
displayName: 'Set Xcode v$(CommunityToolkitSampleApp_Xcode_Version)'
|
|
condition: eq(variables['Agent.OS'], 'Darwin') # Only run this step on macOS
|
|
|
|
- task: UseDotNet@2
|
|
displayName: 'Install .NET SDK'
|
|
inputs:
|
|
packageType: 'sdk'
|
|
version: '$(NET_VERSION)'
|
|
includePreviewVersions: false
|
|
|
|
- task: CmdLine@2
|
|
displayName: 'Install .NET MAUI Workload'
|
|
inputs:
|
|
script : 'dotnet workload install maui'
|
|
|
|
- pwsh: |
|
|
Invoke-WebRequest 'https://raw.githubusercontent.com/Samsung/Tizen.NET/main/workload/scripts/workload-install.ps1' -OutFile 'workload-install.ps1'
|
|
.\workload-install.ps1
|
|
displayName: Install Tizen Workload
|
|
|
|
# Print Information on the .NET SDK Used By the CI Build Host
|
|
# These logs are useful information when debugging CI Builds
|
|
# Note: This step doesn't execute nor modify any code; it is strictly used for logging + debugging purposes
|
|
- task: CmdLine@2
|
|
displayName: 'Display dotnet --info'
|
|
inputs:
|
|
script: dotnet --info
|
|
|
|
- task: CmdLine@2
|
|
displayName: 'Build CommunityToolkit.Maui.Markup.Sample'
|
|
inputs:
|
|
script: 'dotnet build -c Release $(PathToCommunityToolkitSampleCsproj)'
|
|
|
|
- job: build_library
|
|
displayName: Build Library
|
|
strategy:
|
|
matrix:
|
|
'Windows':
|
|
image: 'windows-latest'
|
|
'macOS':
|
|
image: 'macos-14'
|
|
pool:
|
|
vmImage: $(image)
|
|
steps:
|
|
# if this is a tagged build, then update the version number
|
|
- powershell: |
|
|
$buildSourceBranch = "$(Build.SourceBranch)"
|
|
$tagVersion = $buildSourceBranch.Substring($buildSourceBranch.LastIndexOf("/") + 1)
|
|
Write-Host("Branch = $buildSourceBranch, Version = $tagVersion");
|
|
Write-Host ("##vso[task.setvariable variable=NugetPackageVersion;]$tagVersion")
|
|
displayName: Set NuGet Version to Tag Number
|
|
condition: startsWith(variables['Build.SourceBranch'], 'refs/tags/')
|
|
|
|
# if this is a PR build, then update the version number
|
|
- powershell: |
|
|
$prNumber = $env:System_PullRequest_PullRequestNumber
|
|
$commitId = "$($env:System_PullRequest_SourceCommitId)".Substring(0, 7)
|
|
$fullVersionString = "$(CurrentSemanticVersionBase)-build-$prNumber.$(Build.BuildId)+$commitId"
|
|
Write-Host("GitHub PR = $prNumber, Commit = $commitId");
|
|
Write-Host ("##vso[task.setvariable variable=NugetPackageVersion;]$fullVersionString")
|
|
Write-Host "##vso[build.updatebuildnumber]$fullVersionString"
|
|
displayName: Set NuGet Version to PR Version
|
|
condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'), eq(variables['build.reason'], 'PullRequest'))
|
|
|
|
- script: |
|
|
sudo xcode-select -s /Applications/Xcode_$(CommunityToolkitLibrary_Xcode_Version).app
|
|
sudo xcode-select -p
|
|
displayName: 'Set Xcode v$(CommunityToolkitLibrary_Xcode_Version)'
|
|
condition: eq(variables['Agent.OS'], 'Darwin') # Only run this step on macOS
|
|
|
|
- task: UseDotNet@2
|
|
displayName: 'Install .NET SDK'
|
|
inputs:
|
|
packageType: 'sdk'
|
|
version: '$(NET_VERSION)'
|
|
includePreviewVersions: false
|
|
|
|
- task: CmdLine@2
|
|
displayName: 'Install .NET MAUI Workload'
|
|
inputs:
|
|
script : 'dotnet workload install maui'
|
|
|
|
- pwsh: |
|
|
Invoke-WebRequest 'https://raw.githubusercontent.com/Samsung/Tizen.NET/main/workload/scripts/workload-install.ps1' -OutFile 'workload-install.ps1'
|
|
.\workload-install.ps1
|
|
displayName: Install Tizen Workload
|
|
|
|
# Print Information on the .NET SDK Used By the CI Build Host
|
|
# These logs are useful information when debugging CI Builds
|
|
# Note: This step doesn't execute nor modify any code; it is strictly used for logging + debugging purposes
|
|
- task: CmdLine@2
|
|
displayName: 'Display dotnet --info'
|
|
inputs:
|
|
script: dotnet --info
|
|
|
|
# build
|
|
- task: CmdLine@2
|
|
displayName: 'Build CommunityToolkit.Maui.Markup.SourceGenerators'
|
|
inputs:
|
|
script: 'dotnet build -c Release $(PathToCommunityToolkitSourceGeneratorsCsproj)'
|
|
|
|
- task: CmdLine@2
|
|
displayName: 'Build CommunityToolkit.Maui.Markup'
|
|
inputs:
|
|
script: 'dotnet build -c Release $(PathToCommunityToolkitCsproj)'
|
|
|
|
- task: CmdLine@2
|
|
displayName: 'Build CommunityToolkit.Maui.Markup.UnitTests'
|
|
inputs:
|
|
script: 'dotnet build -c Release $(PathToCommunityToolkitUnitTestCsproj)'
|
|
|
|
# test
|
|
- task: CmdLine@2
|
|
displayName: 'Run Unit Tests'
|
|
inputs:
|
|
script: 'dotnet test -c Release $(PathToCommunityToolkitUnitTestCsproj) --settings ".runsettings" --collect "XPlat code coverage" --logger trx --results-directory $(Agent.TempDirectory)'
|
|
|
|
- task: PublishTestResults@2
|
|
condition: eq(variables['Agent.OS'], 'Windows_NT') # Only run this step on Windows
|
|
displayName: 'Publish Test Results'
|
|
inputs:
|
|
testResultsFormat: VSTest
|
|
testResultsFiles: '**/*.trx'
|
|
searchFolder: $(Agent.TempDirectory)
|
|
|
|
- task: PublishCodeCoverageResults@2
|
|
condition: eq(variables['Agent.OS'], 'Windows_NT') # Only run this step on Windows
|
|
displayName: 'Publish Code Coverage Results'
|
|
inputs:
|
|
codeCoverageTool: 'Cobertura'
|
|
summaryFileLocation: '$(Agent.TempDirectory)/**/coverage.cobertura.xml'
|
|
failIfCoverageEmpty: true
|
|
|
|
# pack
|
|
- task: CmdLine@2
|
|
displayName: 'Build and Pack CommunityToolkit.Maui.Markup'
|
|
inputs:
|
|
script: 'dotnet pack -c Release $(PathToCommunityToolkitCsproj) -p:PackageVersion=$(NugetPackageVersion) -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg'
|
|
|
|
# check vulnerabilities
|
|
- powershell: |
|
|
cd src
|
|
dotnet list package --include-transitive # Print all transitive packages
|
|
dotnet list package --vulnerable --include-transitive | findstr /S /c:"has the following vulnerable packages"; # Print all transitive packages with vulnerabilities
|
|
if ($LastExitCode -ne 1)
|
|
{
|
|
dotnet list package --vulnerable --include-transitive;
|
|
exit 1;
|
|
}
|
|
|
|
exit 0;
|
|
displayName: 'Check Dependencies'
|
|
condition: eq(variables['Agent.OS'], 'Windows_NT') # Only run this step on Windows
|
|
|
|
# Copy all NuGet packages
|
|
- task: PowerShell@2
|
|
displayName: 'Copy NuGet Packages to Staging Directory'
|
|
inputs:
|
|
targetType: 'inline'
|
|
script: |
|
|
$source = ".\src"
|
|
$filter = "nupkg"
|
|
Get-ChildItem -Path $source -Recurse | Where-Object { $_.Extension -match $filter } | Copy-Item -Destination "$(Build.ArtifactStagingDirectory)"
|
|
pwsh: true
|
|
|
|
# Sign NuGet Packages
|
|
- task: PowerShell@2
|
|
displayName: Authenticode Sign Packages
|
|
inputs:
|
|
filePath: build/Sign-Package.ps1
|
|
env:
|
|
SignClientUser: $(SignClientUser)
|
|
SignClientSecret: $(SignClientSecret)
|
|
ArtifactDirectory: $(Build.ArtifactStagingDirectory)
|
|
condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'), not(eq(variables['build.reason'], 'PullRequest')), not(eq(variables['SignClientSecret'], '')), not(eq(variables['SignClientUser'], '')))
|
|
|
|
# publish the packages
|
|
- task: PublishBuildArtifacts@1
|
|
condition: eq(variables['Agent.OS'], 'Windows_NT') # Only run this step on Windows
|
|
displayName: 'Publish NuGets'
|
|
inputs:
|
|
artifactName: nuget
|
|
pathToPublish: '$(Build.ArtifactStagingDirectory)'
|
|
|
|
- job: run_benchmarks
|
|
displayName: Run Benchmarks
|
|
strategy:
|
|
matrix:
|
|
'Windows':
|
|
image: 'windows-latest'
|
|
'macOS':
|
|
image: 'macos-14'
|
|
pool:
|
|
vmImage: $(image)
|
|
steps:
|
|
- script: |
|
|
sudo xcode-select -s /Applications/Xcode_$(CommunityToolkitLibrary_Xcode_Version).app
|
|
sudo xcode-select -p
|
|
displayName: 'Set Xcode v$(CommunityToolkitLibrary_Xcode_Version)'
|
|
condition: eq(variables['Agent.OS'], 'Darwin') # Only run this step on macOS
|
|
|
|
- task: UseDotNet@2
|
|
displayName: 'Install .NET SDK'
|
|
inputs:
|
|
packageType: 'sdk'
|
|
version: '$(NET_VERSION)'
|
|
includePreviewVersions: false
|
|
|
|
- task: CmdLine@2
|
|
displayName: 'Install .NET MAUI Workload'
|
|
inputs:
|
|
script : 'dotnet workload install maui'
|
|
|
|
- pwsh: |
|
|
Invoke-WebRequest 'https://raw.githubusercontent.com/Samsung/Tizen.NET/main/workload/scripts/workload-install.ps1' -OutFile 'workload-install.ps1'
|
|
.\workload-install.ps1
|
|
displayName: Install Tizen Workload
|
|
|
|
# Print Information on the .NET SDK Used By the CI Build Host
|
|
# These logs are useful information when debugging CI Builds
|
|
# Note: This step doesn't execute nor modify any code; it is strictly used for logging + debugging purposes
|
|
- task: CmdLine@2
|
|
displayName: 'Display dotnet --info'
|
|
inputs:
|
|
script: dotnet --info
|
|
|
|
- task: CmdLine@2
|
|
displayName: 'Run Benchmarks'
|
|
inputs:
|
|
script : 'dotnet run --project $(PathToCommunityToolkitBenchmarkCsproj) -c Release -- -a $(Build.ArtifactStagingDirectory)'
|
|
|
|
# publish the Benchmark Results
|
|
- task: PublishBuildArtifacts@1
|
|
condition: eq(variables['Agent.OS'], 'Windows_NT') # Only run this step on Windows
|
|
displayName: 'Publish Benchmark Artifacts'
|
|
inputs:
|
|
artifactName: benchmarks
|
|
pathToPublish: '$(Build.ArtifactStagingDirectory)'
|