diff --git a/azure-pipelines.yml b/azure-pipelines.yml index f53e97b6b..fc500236b 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -1,19 +1,128 @@ -# Starter pipeline -# Start with a minimal pipeline that you can customize to build and deploy your code. -# Add steps that build, run tests, deploy, and more: -# https://aka.ms/yaml +variables: + CurrentSemanticVersionBase: '1.0.0' + PreviewNumber: $[counter(variables['CurrentSemanticVersionBase'], 1001)] + CurrentSemanticVersion: '$(CurrentSemanticVersionBase)-preview$(PreviewNumber)' + NugetPackageVersion: '$(CurrentSemanticVersion)' + NET_VERSION: '6.0.x' + RunPoliCheck: 'false' + PathToSolution: 'src/CommunityToolkit.Maui.sln' + PathToCommunityToolkitCsproj: 'src/CommunityToolkit.Maui/CommunityToolkit.Maui.csproj' + PathToCommunityToolkitUnitTestCsproj: 'src/CommunityToolkit.Maui.UnitTests/CommunityToolkit.Maui.UnitTests.csproj' trigger: -- main + branches: + include: + - main + - develop + tags: + include: + - '*' + paths: + exclude: + - README.md -pool: - vmImage: ubuntu-latest +pr: + autoCancel: true + branches: + include: + - main + - develop + paths: + exclude: + - README.md -steps: -- script: echo Hello, world! - displayName: 'Run a one-line script' +schedules: +- cron: "0 0 * * *" + displayName: Daily midnight build + branches: + include: + - develop -- script: | - echo Add other tasks to build, test, and deploy your project. - echo See https://aka.ms/yaml - displayName: 'Run a multi-line script' +jobs: + - job: build_windows + displayName: Build Windows Library + pool: + vmImage: windows-latest + steps: + - task: UseDotNet@2 + displayName: 'Install .NET SDK' + inputs: + version: '$(NET_VERSION)' + includePreviewVersions: true + + - task: CmdLine@2 + displayName: 'Install .NET MAUI workload' + inputs: + script: 'dotnet workload install maui' + - task: CmdLine@2 + displayName: 'Clear Local NuGet Cache' #https://github.com/actions/virtual-environments/issues/1090#issuecomment-748452120 + inputs: + script: 'nuget locals all -clear' + - task: CmdLine@2 + displayName: 'Clean Solution' + inputs: + script: 'dotnet clean $(PathToSolution)' + # 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/') + # restore, build and pack the packages + - task: CmdLine@2 + displayName: 'Build Community Toolkit' + inputs: + script: 'dotnet build $(PathToCommunityToolkitCsproj) -c Release' + - task: CmdLine@2 + displayName: Pack Community Toolkit NuGets + inputs: + script: 'dotnet pack -c Release $(PathToCommunityToolkitCsproj) -p:PackageVersion=$(NugetPackageVersion) --output $(Build.ArtifactStagingDirectory)/nuget' + # publish the packages + - task: PublishBuildArtifacts@1 + displayName: 'Publish Unsigned NuGets' + inputs: + artifactName: nuget + pathToPublish: '$(Build.ArtifactStagingDirectory)/nuget' + + - job: build_macos + displayName: Build macOS Library + pool: + vmImage: macos-10.15 + 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/') + - task: UseDotNet@2 + displayName: 'Install .NET SDK' + inputs: + version: $(NET_VERSION) + includePreviewVersions: true + - task: CmdLine@2 + displayName: 'Install .NET MAUI workload' + inputs: + script: 'dotnet workload install maui' + - task: CmdLine@2 + displayName: 'Restore NuGet Packages' + inputs: + script: 'dotnet restore $(PathToCommunityToolkitCsproj)' + - task: CmdLine@2 + displayName: 'Build Community Toolkit' + inputs: + script: 'dotnet build $(PathToCommunityToolkitCsproj) -c Release' + # Doesn't seem to work (yet)? + # - task: DotNetCoreCLI@2 + # displayName: 'Run Unit Tests' + # inputs: + # command: 'test' + # projects: $(PathToCommunityToolkitUnitTestCsproj) + - task: CmdLine@2 + displayName: 'Pack CommunityToolkit NuGets' + inputs: + script: 'dotnet pack -c Release $(PathToCommunityToolkitCsproj) -p:PackageVersion=$(NugetPackageVersion) --output $(Build.ArtifactStagingDirectory)/nuget' \ No newline at end of file diff --git a/build/nuget.png b/build/nuget.png new file mode 100644 index 000000000..cb8172be0 Binary files /dev/null and b/build/nuget.png differ diff --git a/src/CommunityToolkit.Maui/CommunityToolkit.Maui.csproj b/src/CommunityToolkit.Maui/CommunityToolkit.Maui.csproj index 7d72ccb31..9f6704608 100644 --- a/src/CommunityToolkit.Maui/CommunityToolkit.Maui.csproj +++ b/src/CommunityToolkit.Maui/CommunityToolkit.Maui.csproj @@ -4,6 +4,7 @@ net6.0-ios;net6.0-android;net6.0-maccatalyst true + false @@ -34,13 +35,10 @@ Debug;Release - - false - true - iossimulator-x64 - maccatalyst-x64 - False - + + + + @@ -76,4 +74,4 @@ - \ No newline at end of file +