#################################################################### # VSTS Build Configuration, Version 1.4 # # (c)2022 superdev GmbH #################################################################### name: $[format('{0}', variables['buildName'])] pool: vmImage: 'windows-2022' trigger: branches: include: - refs/heads/* paths: exclude: - Docs/* variables: solution: 'MauiPopups.sln' buildPlatform: 'Any CPU' buildConfiguration: 'Release' majorVersion: 1 minorVersion: 3 patchVersion: $[counter(format('{0}.{1}', variables.majorVersion, variables.minorVersion), 0)] ${{ if eq(variables['Build.SourceBranch'], 'refs/heads/main') }}: # Versioning: 1.0.0 semVersion: $[format('{0}.{1}.{2}', variables.majorVersion, variables.minorVersion, variables.patchVersion)] ${{ if and(ne(variables['Build.SourceBranch'], 'refs/heads/main'), not(startsWith(variables['Build.SourceBranch'], 'refs/pull/'))) }}: # Versioning: 1.0.0-pre semVersion: $[format('{0}.{1}.{2}-pre', variables.majorVersion, variables.minorVersion, variables.patchVersion)] ${{ if startsWith(variables['Build.SourceBranch'], 'refs/pull/') }}: # Versioning: 1.0.0-pr.000000001 semVersion: $[format('{0}.{1}.{2}-pr.{3}', variables.majorVersion, variables.minorVersion, variables.patchVersion, variables['System.PullRequest.PullRequestId'])] buildName: $[format('{0}', variables.semVersion)] steps: - task: Bash@3 displayName: 'Print all variables' inputs: targetType: 'inline' script: 'env | sort' - task: Assembly-Info-NetCore@2 displayName: 'Update Assembly Info' inputs: Path: '$(Build.SourcesDirectory)' FileNames: | **/*.csproj InsertAttributes: true FileEncoding: 'auto' WriteBOM: false Product: 'MauiPopups' Description: '' Company: 'superdev GmbH' Copyright: '(c) $(date:YYYY) superdev GmbH' VersionNumber: '$(Build.BuildNumber)' FileVersionNumber: '$(Build.BuildNumber)' InformationalVersion: '$(Build.BuildNumber)' PackageVersion: '$(Build.BuildNumber)' LogLevel: 'verbose' FailOnWarning: false DisableTelemetry: false' - task: UseDotNet@2 displayName: 'Use .NET 8.x' inputs: version: 8.x - task: Bash@3 displayName: Install .NET MAUI inputs: targetType: 'inline' script: | dotnet nuget locals all --clear dotnet workload install maui android ios maui-android maui-ios --source https://api.nuget.org/v3/index.json - task: JavaToolInstaller@0 displayName: "Install Java" inputs: versionSpec: '11' jdkArchitectureOption: 'x64' jdkSourceOption: 'PreInstalled' - task: NuGetToolInstaller@0 displayName: 'Use NuGet 6.x' inputs: versionSpec: 6.x - task: DotNetCoreCLI@2 displayName: 'NuGet restore' inputs: command: restore projects: '$(solution)' - task: DotNetCoreCLI@2 displayName: 'Build solution' inputs: projects: '$(solution)' arguments: '--no-restore --configuration $(buildConfiguration)' - task: DotNetCoreCLI@2 displayName: 'Run UnitTests' inputs: command: test projects: '**/*.Tests.csproj' arguments: '--no-restore --no-build --configuration $(buildConfiguration) /p:CollectCoverage=true /p:Exclude="[Microsoft*]*%2C[Mono*]*%2C[xunit*]*%2C[*.Testdata]*" /p:CoverletOutput=UnitTests.coverage.cobertura.xml /p:MergeWith=$(Build.SourcesDirectory)/Tests/CoverletOutput/coverage.json /p:CoverletOutputFormat=cobertura' - task: Palmmedia.reportgenerator.reportgenerator-build-release-task.reportgenerator@4 displayName: 'Create Code Coverage Report' inputs: reports: '$(Build.SourcesDirectory)/Tests/**/*.coverage.cobertura*.xml' targetdir: '$(Build.SourcesDirectory)/CodeCoverage' reporttypes: 'Cobertura' assemblyfilters: '-xunit*' - task: DotNetCoreCLI@2 displayName: 'Pack Popups.Maui' inputs: command: pack packagesToPack: Popups.Maui/Popups.Maui.csproj versioningScheme: byEnvVar versionEnvVar: semVersion nobuild: true - task: DotNetCoreCLI@2 displayName: 'Pack Popups.Maui.Prism' inputs: command: pack packagesToPack: Popups.Maui.Prism/Popups.Maui.Prism.csproj versioningScheme: byEnvVar versionEnvVar: semVersion nobuild: true - task: CopyFiles@2 displayName: 'Copy Files to: $(Build.ArtifactStagingDirectory)' inputs: SourceFolder: '$(system.defaultworkingdirectory)' Contents: | **\bin\$(BuildConfiguration)\** **\bin\*.nupkg **\bin\*.snupkg TargetFolder: '$(Build.ArtifactStagingDirectory)' - task: PublishCodeCoverageResults@1 displayName: 'Publish code coverage' inputs: codeCoverageTool: Cobertura summaryFileLocation: '$(Build.SourcesDirectory)/CodeCoverage/Cobertura.xml' reportDirectory: '$(Build.SourcesDirectory)/CodeCoverage' - task: PublishBuildArtifacts@1 displayName: 'Publish Artifact: drop'