diff --git a/.github/workflows/dotnet-build.yml b/.github/workflows/dotnet-build.yml new file mode 100644 index 0000000000..9388d475ef --- /dev/null +++ b/.github/workflows/dotnet-build.yml @@ -0,0 +1,182 @@ +name: .NET + +on: + push: + branches: + - main + tags: + - '*' + paths-ignore: + - README.md + pull_request: + branches: + - main + paths-ignore: + - README.md + +env: + CurrentSemanticVersionBase: '99.0.0' + PreviewNumber: ${{ github.run_number }} + CurrentSemanticVersion: '99.0.0-preview${{ github.run_number }}' + NugetPackageVersion: '99.0.0-preview${{ github.run_number }}' + NugetPackageVersionCamera: '99.0.0-preview${{ github.run_number }}' + NugetPackageVersionMediaElement: '99.0.0-preview${{ github.run_number }}' + NugetPackageVersionMaps: '99.0.0-preview${{ github.run_number }}' + TOOLKIT_NET_VERSION: '8.0.203' + LATEST_NET_VERSION: '8.0.x' + PathToLibrarySolution: 'src/CommunityToolkit.Maui.sln' + PathToSamplesSolution: 'samples/CommunityToolkit.Maui.Sample.sln' + PathToCommunityToolkitCsproj: 'src/CommunityToolkit.Maui/CommunityToolkit.Maui.csproj' + PathToCommunityToolkitCoreCsproj: 'src/CommunityToolkit.Maui.Core/CommunityToolkit.Maui.Core.csproj' + PathToCommunityToolkitCameraCsproj: 'src/CommunityToolkit.Maui.Camera/CommunityToolkit.Maui.Camera.csproj' + PathToCommunityToolkitMediaElementCsproj: 'src/CommunityToolkit.Maui.MediaElement/CommunityToolkit.Maui.MediaElement.csproj' + PathToCommunityToolkitMapsCsproj: 'src/CommunityToolkit.Maui.Maps/CommunityToolkit.Maui.Maps.csproj' + PathToCommunityToolkitSampleCsproj: 'samples/CommunityToolkit.Maui.Sample/CommunityToolkit.Maui.Sample.csproj' + PathToCommunityToolkitUnitTestCsproj: 'src/CommunityToolkit.Maui.UnitTests/CommunityToolkit.Maui.UnitTests.csproj' + PathToCommunityToolkitAnalyzersCsproj: 'src/CommunityToolkit.Maui.Analyzers/CommunityToolkit.Maui.Analyzers.csproj' + PathToCommunityToolkitCameraAnalyzersCsproj: 'src/CommunityToolkit.Maui.Camera.Analyzers/CommunityToolkit.Maui.Camera.Analyzers.csproj' + PathToCommunityToolkitMediaElementAnalyzersCsproj: 'src/CommunityToolkit.Maui.MediaElement.Analyzers/CommunityToolkit.Maui.MediaElement.Analyzers.csproj' + PathToCommunityToolkitSourceGeneratorsCsproj: 'src/CommunityToolkit.Maui.SourceGenerators/CommunityToolkit.Maui.SourceGenerators.csproj' + PathToCommunityToolkitSourceGeneratorsInternalCsproj: 'src/CommunityToolkit.Maui.SourceGenerators.Internal/CommunityToolkit.Maui.SourceGenerators.Internal.csproj' + PathToCommunityToolkitAnalyzersCodeFixCsproj: 'src/CommunityToolkit.Maui.Analyzers.CodeFixes/CommunityToolkit.Maui.Analyzers.CodeFixes.csproj' + PathToCommunityToolkitCameraAnalyzersCodeFixCsproj: 'src/CommunityToolkit.Maui.Camera.Analyzers.CodeFixes/CommunityToolkit.Maui.Camera.Analyzers.CodeFixes.csproj' + PathToCommunityToolkitMediaElementAnalyzersCodeFixCsproj: 'src/CommunityToolkit.Maui.MediaElement.Analyzers.CodeFixes/CommunityToolkit.Maui.MediaElement.Analyzers.CodeFixes.csproj' + PathToCommunityToolkitAnalyzersUnitTestCsproj: 'src/CommunityToolkit.Maui.Analyzers.UnitTests/CommunityToolkit.Maui.Analyzers.UnitTests.csproj' + DotNetMauiRollbackFile: 'https://maui.blob.core.windows.net/metadata/rollbacks/8.0.6.json' + CommunityToolkitSampleApp_Xcode_Version: '15.2.0' + CommunityToolkitLibrary_Xcode_Version: '15.3.0' + +jobs: + build_sample: + name: Build Sample App using Latest .NET SDK + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [windows-latest, macos-14] + steps: + - name: Checkout code + uses: actions/checkout@main + + - name: Set Xcode version + if: runner.os == 'macOS' + run: | + sudo xcode-select --switch /Applications/Xcode_${{ env.CommunityToolkitSampleApp_Xcode_Version }}.app/Contents/Developer + + - name: Install Latest .NET SDK + uses: actions/setup-dotnet@v3 + with: + dotnet-version: ${{ env.LATEST_NET_VERSION }} + + - name: Install .NET MAUI Workload + run: dotnet workload install maui + + - name: Install Tizen Workload + run: | + Invoke-WebRequest 'https://raw.githubusercontent.com/Samsung/Tizen.NET/main/workload/scripts/workload-install.ps1' -OutFile 'workload-install.ps1' + .\workload-install.ps1 + shell: pwsh + + - name: Display dotnet info + run: dotnet --info + + - name: Build Community Toolkit Sample + run: dotnet build -c Release ${{ env.PathToCommunityToolkitSampleCsproj }} + + build_library: + name: Build Library + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [windows-latest, macos-14] + steps: + - name: Checkout code + uses: actions/checkout@main + + - name: Set NuGet Version to Tag Number + if: startsWith(github.ref, 'refs/tags/') && !endsWith(github.ref, '-mediaelement') + run: echo "NugetPackageVersion=${{ github.ref }}" >> $GITHUB_ENV + + - name: Set NuGet Version to Tag Number for Camera + if: startsWith(github.ref, 'refs/tags/') && endsWith(github.ref, '-camera') + run: echo "NugetPackageVersionCamera=${{ github.ref }}" >> $GITHUB_ENV + + - name: Set NuGet Version to Tag Number for MediaElement + if: startsWith(github.ref, 'refs/tags/') && endsWith(github.ref, '-mediaelement') + run: echo "NugetPackageVersionMediaElement=${{ github.ref }}" >> $GITHUB_ENV + + - name: Set NuGet Version to Tag Number for Maps + if: startsWith(github.ref, 'refs/tags/') && endsWith(github.ref, '-maps') + run: echo "NugetPackageVersionMaps=${{ github.ref }}" >> $GITHUB_ENV + + - name: Set NuGet Version to PR Version + if: ${{ github.event_name == 'pull_request' }} + run: | + echo "NugetPackageVersion=${{ env.CurrentSemanticVersionBase }}-build-${{ github.event.pull_request.number }}.${{ github.run_number }}+${{ github.sha }}" + echo "NugetPackageVersionMediaElement=${{ env.CurrentSemanticVersionBase }}-build-${{ github.event.pull_request.number }}.${{ github.run_number }}+${{ github.sha }}" + echo "NugetPackageVersionMaps=${{ env.CurrentSemanticVersionBase }}-build-${{ github.event.pull_request.number }}.${{ github.run_number }}+${{ github.sha }}" + shell: bash + + - name: Set Xcode version + if: runner.os == 'macOS' + run: | + sudo xcode-select --switch /Applications/Xcode_${{ env.CommunityToolkitLibrary_Xcode_Version }}.app/Contents/Developer + + - name: Install .NET SDK + uses: actions/setup-dotnet@v3 + with: + dotnet-version: ${{ env.TOOLKIT_NET_VERSION }} + + - name: Install .NET MAUI Workload + run: dotnet workload install maui --skip-sign-check --source https://api.nuget.org/v3/index.json + + - name: Install Tizen Workload + run: | + Invoke-WebRequest 'https://raw.githubusercontent.com/Samsung/Tizen.NET/main/workload/scripts/workload-install.ps1' -OutFile 'workload-install.ps1' + .\workload-install.ps1 + shell: pwsh + + - name: Display dotnet info + run: dotnet --info + + - name: Build CommunityToolkit.Maui + run: dotnet build -c Release ${{ env.PathToLibrarySolution }} + + - name: Run CommunityToolkit.Maui.UnitTests + run: dotnet test -c Release ${{ env.PathToLibrarySolution }} --settings ".runsettings" --collect "XPlat code coverage" --logger trx --results-directory ${{ runner.temp }} + + - name: Publish Test Results + if: runner.os == 'Windows' + uses: actions/upload-artifact@v4 + with: + name: Test Results + path: | + ${{ runner.temp }}/**/*.trx + + - name: Pack CommunityToolkit.Maui.Core NuGet + run: dotnet pack -c Release ${{ env.PathToCommunityToolkitCoreCsproj }} -p:PackageVersion=${{ env.NugetPackageVersion }} + + - name: Pack CommunityToolkit.Maui NuGet + run: dotnet pack -c Release ${{ env.PathToCommunityToolkitCsproj }} -p:PackageVersion=${{ env.NugetPackageVersion }} + + - name: Pack CommunityToolkit.Maui.Camera NuGet + run: dotnet pack -c Release ${{ env.PathToCommunityToolkitCameraCsproj }} -p:PackageVersion=${{ env.NugetPackageVersionCamera }} + + - name: Pack CommunityToolkit.Maui.MediaElement NuGet + run: dotnet pack -c Release ${{ env.PathToCommunityToolkitMediaElementCsproj }} -p:PackageVersion=${{ env.NugetPackageVersionMediaElement }} + + - name: Pack CommunityToolkit.Maui.Maps NuGet + run: dotnet pack -c Release ${{ env.PathToCommunityToolkitMapsCsproj }} -p:PackageVersion=${{ env.NugetPackageVersionMaps }} + + - name: Copy NuGet Packages to Staging Directory + if: runner.os == 'Windows' && !startsWith(github.ref, 'refs/tags/') + run: | + mkdir -p ${{ github.workspace }}/nuget + Get-ChildItem -Path "./src" -Recurse | Where-Object { $_.Extension -match "nupkg" } | Copy-Item -Destination "${{ github.workspace }}/nuget" + shell: pwsh + + - name: Publish Packages + if: runner.os == 'Windows' + uses: actions/upload-artifact@v4 + with: + name: Packages + path: ${{ github.workspace }}/nuget/ \ No newline at end of file diff --git a/azure-pipelines.yml b/azure-pipelines.yml deleted file mode 100644 index 76bc033c97..0000000000 --- a/azure-pipelines.yml +++ /dev/null @@ -1,440 +0,0 @@ -variables: - CurrentSemanticVersionBase: '99.0.0' - PreviewNumber: $[counter(variables['CurrentSemanticVersionBase'], 1001)] - CurrentSemanticVersion: '$(CurrentSemanticVersionBase)-preview$(PreviewNumber)' - NugetPackageVersion: '$(CurrentSemanticVersion)' - NugetPackageVersionCamera: '$(CurrentSemanticVersion)' - NugetPackageVersionMediaElement: '$(CurrentSemanticVersion)' - NugetPackageVersionMaps: '$(CurrentSemanticVersion)' - TOOLKIT_NET_VERSION: '8.0.303' - LATEST_NET_VERSION: '8.0.x' - PathToLibrarySolution: 'src/CommunityToolkit.Maui.sln' - PathToSamplesSolution: 'samples/CommunityToolkit.Maui.Sample.sln' - PathToCommunityToolkitCsproj: 'src/CommunityToolkit.Maui/CommunityToolkit.Maui.csproj' - PathToCommunityToolkitCoreCsproj: 'src/CommunityToolkit.Maui.Core/CommunityToolkit.Maui.Core.csproj' - PathToCommunityToolkitCameraCsproj: 'src/CommunityToolkit.Maui.Camera/CommunityToolkit.Maui.Camera.csproj' - PathToCommunityToolkitMediaElementCsproj: 'src/CommunityToolkit.Maui.MediaElement/CommunityToolkit.Maui.MediaElement.csproj' - PathToCommunityToolkitMapsCsproj: 'src/CommunityToolkit.Maui.Maps/CommunityToolkit.Maui.Maps.csproj' - PathToCommunityToolkitSampleCsproj: 'samples/CommunityToolkit.Maui.Sample/CommunityToolkit.Maui.Sample.csproj' - PathToCommunityToolkitUnitTestCsproj: 'src/CommunityToolkit.Maui.UnitTests/CommunityToolkit.Maui.UnitTests.csproj' - PathToCommunityToolkitAnalyzersCsproj: 'src/CommunityToolkit.Maui.Analyzers/CommunityToolkit.Maui.Analyzers.csproj' - PathToCommunityToolkitCameraAnalyzersCsproj: 'src/CommunityToolkit.Maui.Camera.Analyzers/CommunityToolkit.Maui.Camera.Analyzers.csproj' - PathToCommunityToolkitMediaElementAnalyzersCsproj: 'src/CommunityToolkit.Maui.MediaElement.Analyzers/CommunityToolkit.Maui.MediaElement.Analyzers.csproj' - PathToCommunityToolkitSourceGeneratorsCsproj: 'src/CommunityToolkit.Maui.SourceGenerators/CommunityToolkit.Maui.SourceGenerators.csproj' - PathToCommunityToolkitSourceGeneratorsInternalCsproj: 'src/CommunityToolkit.Maui.SourceGenerators.Internal/CommunityToolkit.Maui.SourceGenerators.Internal.csproj' - PathToCommunityToolkitAnalyzersCodeFixCsproj: 'src/CommunityToolkit.Maui.Analyzers.CodeFixes/CommunityToolkit.Maui.Analyzers.CodeFixes.csproj' - PathToCommunityToolkitCameraAnalyzersCodeFixCsproj: 'src/CommunityToolkit.Maui.Camera.Analyzers.CodeFixes/CommunityToolkit.Maui.Camera.Analyzers.CodeFixes.csproj' - PathToCommunityToolkitMediaElementAnalyzersCodeFixCsproj: 'src/CommunityToolkit.Maui.MediaElement.Analyzers.CodeFixes/CommunityToolkit.Maui.MediaElement.Analyzers.CodeFixes.csproj' - PathToCommunityToolkitAnalyzersUnitTestCsproj: 'src/CommunityToolkit.Maui.Analyzers.UnitTests/CommunityToolkit.Maui.Analyzers.UnitTests.csproj' - DotNetMauiRollbackFile: 'https://maui.blob.core.windows.net/metadata/rollbacks/8.0.6.json' - CommunityToolkitSampleApp_Xcode_Version: '15.4' - CommunityToolkitLibrary_Xcode_Version: '15.4' - -trigger: - branches: - include: - - main - - develop - tags: - include: - - '*' - paths: - exclude: - - README.md - -pr: - autoCancel: 'true' - branches: - include: - - main - - develop - paths: - exclude: - - README.md - -jobs: - - job: build_sample - displayName: Build Sample App using Latest .NET SDK - strategy: - matrix: - 'Windows': - image: 'windows-latest' - 'macOS': - image: 'macos-14' - pool: - vmImage: $(image) - steps: - - task: CmdLine@2 - displayName: 'Set Xcode v$(CommunityToolkitSampleApp_Xcode_Version)' - condition: eq(variables['Agent.OS'], 'Darwin') # Only run this step on macOS - inputs: - script: echo '##vso[task.setvariable variable=MD_APPLE_SDK_ROOT;]'/Applications/Xcode_$(CommunityToolkitSampleApp_Xcode_Version).app;sudo xcode-select --switch /Applications/Xcode_$(CommunityToolkitSampleApp_Xcode_Version).app/Contents/Developer - - - task: UseDotNet@2 - displayName: 'Install Latest .NET SDK, v$(LATEST_NET_VERSION)' - inputs: - packageType: 'sdk' - version: '$(LATEST_NET_VERSION)' - includePreviewVersions: false - - - task: CmdLine@2 - displayName: 'Install Latest .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.Analyzers' - inputs: - script: 'dotnet build -c Release $(PathToCommunityToolkitAnalyzersCsproj)' - - - task: CmdLine@2 - displayName: 'Build CommunityToolkit.Maui.Analyzers.CodeFixes' - inputs: - script: 'dotnet build -c Release $(PathToCommunityToolkitAnalyzersCodeFixCsproj)' - - - task: CmdLine@2 - displayName: 'Build CommunityToolkit.Maui.MediaElement.Analyzers' - inputs: - script: 'dotnet build -c Release $(PathToCommunityToolkitMediaElementAnalyzersCsproj)' - - - task: CmdLine@2 - displayName: 'Build CommunityToolkit.Maui.MediaElement.Analyzers.CodeFixes' - inputs: - script: 'dotnet build -c Release $(PathToCommunityToolkitMediaElementAnalyzersCodeFixCsproj)' - - - task: CmdLine@2 - displayName: 'Build CommunityToolkit.Maui.SourceGenerators' - inputs: - script: 'dotnet build -c Release $(PathToCommunityToolkitSourceGeneratorsCsproj)' - - - task: CmdLine@2 - displayName: 'Build CommunityToolkit.SourceGenerators.Internal' - inputs: - script: 'dotnet build -c Release $(PathToCommunityToolkitSourceGeneratorsInternalCsproj)' - - # build sample - - task: CmdLine@2 - displayName: 'Build Community Toolkit Sample' - inputs: - script: 'dotnet build $(PathToCommunityToolkitSampleCsproj) -c Release' - - - 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 for CommunityToolkit.Maui, 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: and(startsWith(variables['Build.SourceBranch'], 'refs/tags/'), not(endsWith(variables['Build.SourceBranch'], '-mediaelement'))) # Only run this step when a Tag has triggered the CI Pipeline - - # if this is a tagged build for CommunityToolkit.Maui.Camera, then update the version number - - powershell: | - $buildSourceBranch = "$(Build.SourceBranch)" - $tagVersion = $buildSourceBranch.Substring($buildSourceBranch.LastIndexOf("/") + 1) - $tagVersion = $tagVersion.Substring(0, $tagVersion.LastIndexOf("-")) - Write-Host("Branch = $buildSourceBranch, Version = $tagVersion"); - Write-Host ("##vso[task.setvariable variable=NugetPackageVersionCamera;]$tagVersion") - displayName: Set NuGet Version to Tag Number - condition: and(startsWith(variables['Build.SourceBranch'], 'refs/tags/'), endsWith(variables['Build.SourceBranch'], '-camera')) # Only run this step when a Tag has triggered the CI Pipeline - - # if this is a tagged build for CommunityToolkit.Maui.MediaElement, then update the version number - - powershell: | - $buildSourceBranch = "$(Build.SourceBranch)" - $tagVersion = $buildSourceBranch.Substring($buildSourceBranch.LastIndexOf("/") + 1) - $tagVersion = $tagVersion.Substring(0, $tagVersion.LastIndexOf("-")) - Write-Host("Branch = $buildSourceBranch, Version = $tagVersion"); - Write-Host ("##vso[task.setvariable variable=NugetPackageVersionMediaElement;]$tagVersion") - displayName: Set NuGet Version to Tag Number - condition: and(startsWith(variables['Build.SourceBranch'], 'refs/tags/'), endsWith(variables['Build.SourceBranch'], '-mediaelement')) # Only run this step when a Tag has triggered the CI Pipeline - - # if this is a tagged build for CommunityToolkit.Maui.Maps, then update the version number - - powershell: | - $buildSourceBranch = "$(Build.SourceBranch)" - $tagVersion = $buildSourceBranch.Substring($buildSourceBranch.LastIndexOf("/") + 1) - $tagVersion = $tagVersion.Substring(0, $tagVersion.LastIndexOf("-")) - Write-Host("Branch = $buildSourceBranch, Version = $tagVersion"); - Write-Host ("##vso[task.setvariable variable=NugetPackageVersionMaps;]$tagVersion") - displayName: Set NuGet Version to Tag Number - condition: and(startsWith(variables['Build.SourceBranch'], 'refs/tags/'), endsWith(variables['Build.SourceBranch'], '-maps')) # Only run this step when a Tag has triggered the CI Pipeline - - # 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[task.setvariable variable=NugetPackageVersionMediaElement;]$fullVersionString") - Write-Host ("##vso[task.setvariable variable=NugetPackageVersionMaps;]$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')) # Only run this step on Windows when a Pull Request has triggered the CI Pipeline - - - task: CmdLine@2 - displayName: 'Set Xcode v$(CommunityToolkitLibrary_Xcode_Version)' - condition: eq(variables['Agent.OS'], 'Darwin') # Only run this step on macOS - inputs: - script: echo '##vso[task.setvariable variable=MD_APPLE_SDK_ROOT;]'/Applications/Xcode_$(CommunityToolkitLibrary_Xcode_Version).app;sudo xcode-select --switch /Applications/Xcode_$(CommunityToolkitLibrary_Xcode_Version).app/Contents/Developer - - - task: UseDotNet@2 - displayName: Install .NET v$(TOOLKIT_NET_VERSION) - inputs: - packageType: 'sdk' - version: '$(TOOLKIT_NET_VERSION)' - includePreviewVersions: false - - - task: CmdLine@2 - displayName: 'Install .NET MAUI Workload $(TOOLKIT_NET_VERSION)' - inputs: - script: dotnet workload install maui --skip-sign-check --source https://api.nuget.org/v3/index.json - - - 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.Analyzers' - inputs: - script: 'dotnet build -c Release $(PathToCommunityToolkitAnalyzersCsproj)' - - - task: CmdLine@2 - displayName: 'Build CommunityToolkit.Maui.Analyzers.CodeFixes' - inputs: - script: 'dotnet build -c Release $(PathToCommunityToolkitAnalyzersCodeFixCsproj)' - - - task: CmdLine@2 - displayName: 'Build CommunityToolkit.Maui.Camera.Analyzers' - inputs: - script: 'dotnet build -c Release $(PathToCommunityToolkitCameraAnalyzersCsproj)' - - - task: CmdLine@2 - displayName: 'Build CommunityToolkit.Maui.Camera.Analyzers.CodeFixes' - inputs: - script: 'dotnet build -c Release $(PathToCommunityToolkitCameraAnalyzersCodeFixCsproj)' - - - task: CmdLine@2 - displayName: 'Build CommunityToolkit.Maui.MediaElement.Analyzers' - inputs: - script: 'dotnet build -c Release $(PathToCommunityToolkitMediaElementAnalyzersCsproj)' - - - task: CmdLine@2 - displayName: 'Build CommunityToolkit.Maui.MediaElement.Analyzers.CodeFixes' - inputs: - script: 'dotnet build -c Release $(PathToCommunityToolkitMediaElementAnalyzersCodeFixCsproj)' - - - task: CmdLine@2 - displayName: 'Build CommunityToolkit.Maui.SourceGenerators' - inputs: - script: 'dotnet build -c Release $(PathToCommunityToolkitSourceGeneratorsCsproj)' - - - task: CmdLine@2 - displayName: 'Build CommunityToolkit.SourceGenerators.Internal' - inputs: - script: 'dotnet build -c Release $(PathToCommunityToolkitSourceGeneratorsInternalCsproj)' - - - task: CmdLine@2 - displayName: 'Run CommunityToolkit.Maui.Analyzers.UnitTests' - inputs: - script: 'dotnet test $(PathToCommunityToolkitAnalyzersUnitTestCsproj) -c Release' - - - task: CmdLine@2 - displayName: 'Build CommunityToolkit.Maui.Core' - inputs: - script: 'dotnet build $(PathToCommunityToolkitCoreCsproj) -c Release -p:PackageVersion=$(NugetPackageVersion)' - - - task: CmdLine@2 - displayName: 'Build CommunityToolkit.Maui' - inputs: - script: 'dotnet build $(PathToCommunityToolkitCsproj) -c Release -p:PackageVersion=$(NugetPackageVersion)' - - - task: CmdLine@2 - displayName: 'Build CommunityToolkit.Maui.Camera' - inputs: - script: 'dotnet build $(PathToCommunityToolkitCameraCsproj) -c Release -p:PackageVersion=$(NugetPackageVersionCamera)' - - - task: CmdLine@2 - displayName: 'Build CommunityToolkit.Maui.MediaElement' - inputs: - script: 'dotnet build $(PathToCommunityToolkitMediaElementCsproj) -c Release -p:PackageVersion=$(NugetPackageVersionMediaElement)' - - - task: CmdLine@2 - displayName: 'Build CommunityToolkit.Maui.Maps' - inputs: - script: 'dotnet build $(PathToCommunityToolkitMapsCsproj) -c Release -p:PackageVersion=$(NugetPackageVersionMaps)' - - - task: CmdLine@2 - displayName: 'Run CommunityToolkit.Maui.UnitTests' - inputs: - script: 'dotnet test $(PathToCommunityToolkitUnitTestCsproj) -c Release --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 - - - task: CmdLine@2 - displayName: 'Pack CommunityToolkit.Maui.Core NuGet' - inputs: - script: 'dotnet pack $(PathToCommunityToolkitCoreCsproj) -c Release -p:PackageVersion=$(NugetPackageVersion)' - - - task: CmdLine@2 - displayName: 'Pack CommunityToolkit.Maui NuGet' - inputs: - script: 'dotnet pack $(PathToCommunityToolkitCsproj) -c Release -p:PackageVersion=$(NugetPackageVersion)' - - - task: CmdLine@2 - displayName: 'Pack CommunityToolkit.Maui.Camera NuGet' - inputs: - script: 'dotnet pack $(PathToCommunityToolkitCameraCsproj) -c Release -p:PackageVersion=$(NugetPackageVersionCamera)' - - - task: CmdLine@2 - displayName: 'Pack CommunityToolkit.Maui.MediaElement NuGet' - inputs: - script: 'dotnet pack $(PathToCommunityToolkitMediaElementCsproj) -c Release -p:PackageVersion=$(NugetPackageVersionMediaElement)' - - - task: CmdLine@2 - displayName: 'Pack CommunityToolkit.Maui.Maps NuGet' - inputs: - script: 'dotnet pack $(PathToCommunityToolkitMapsCsproj) -c Release -p:PackageVersion=$(NugetPackageVersionMaps)' - - # 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 - condition: and(eq(variables['Agent.OS'], 'Windows_NT'), not(startsWith(variables['Build.SourceBranch'], 'refs/tags/'))) # Only run this step on Windows and when it's not a tagged build - 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 - - # Copy CommunityToolkit.Maui & CommunityToolkit.Maui.Core packages - - task: PowerShell@2 - condition: and(eq(variables['Agent.OS'], 'Windows_NT'), - startsWith(variables['Build.SourceBranch'], 'refs/tags/'), - not(endsWith(variables['Build.SourceBranch'], '-mediaelement')), - not(endsWith(variables['Build.SourceBranch'], '-maps')), - not(endsWith(variables['Build.SourceBranch'], '-camera'))) # Only run this step on Windows and when it's a tagged build and the tag does NOT end with -mediaelement and does NOT end with -maps and does NOT end with -camera - displayName: 'Copy CommunityToolkit.Maui & CommunityToolkit.Maui.Core NuGet Packages to Staging Directory' - inputs: - targetType: 'inline' - script: | - $source = ".\src" - $filter = "CommunityToolkit.Maui.(Core.)*[0-9]+.[0-9]+.[0-9]+(-[a-zA-Z0-9]*)*.nupkg" - Get-ChildItem -Path $source -Recurse | Where-Object { $_.Name -match $filter } | Copy-Item -Destination "$(Build.ArtifactStagingDirectory)" - pwsh: true - - # Copy CommunityToolkit.Maui.Camera package - - task: PowerShell@2 - condition: and(eq(variables['Agent.OS'], 'Windows_NT'), startsWith(variables['Build.SourceBranch'], 'refs/tags/'), endsWith(variables['Build.SourceBranch'], '-camera')) # Only run this step on Windows and when it's a tagged build and the tag ends with -camera - displayName: 'Copy CommunityToolkit.Maui.Camera NuGet Package to Staging Directory' - inputs: - targetType: 'inline' - script: | - $source = ".\src" - $filter = "CommunityToolkit.Maui.Camera.[0-9]+.[0-9]+.[0-9]+(-[a-zA-Z0-9]*)*.nupkg" - Get-ChildItem -Path $source -Recurse | Where-Object { $_.Name -match $filter } | Copy-Item -Destination "$(Build.ArtifactStagingDirectory)" - pwsh: true - - # Copy CommunityToolkit.Maui.MediaElement package - - task: PowerShell@2 - condition: and(eq(variables['Agent.OS'], 'Windows_NT'), startsWith(variables['Build.SourceBranch'], 'refs/tags/'), endsWith(variables['Build.SourceBranch'], '-mediaelement')) # Only run this step on Windows and when it's a tagged build and the tag ends with -mediaelement - displayName: 'Copy CommunityToolkit.Maui.MediaElement NuGet Package to Staging Directory' - inputs: - targetType: 'inline' - script: | - $source = ".\src" - $filter = "CommunityToolkit.Maui.MediaElement.[0-9]+.[0-9]+.[0-9]+(-[a-zA-Z0-9]*)*.nupkg" - Get-ChildItem -Path $source -Recurse | Where-Object { $_.Name -match $filter } | Copy-Item -Destination "$(Build.ArtifactStagingDirectory)" - pwsh: true - - # Copy CommunityToolkit.Maui.Maps package - - task: PowerShell@2 - condition: and(eq(variables['Agent.OS'], 'Windows_NT'), startsWith(variables['Build.SourceBranch'], 'refs/tags/'), endsWith(variables['Build.SourceBranch'], '-maps')) # Only run this step on Windows and when it's a tagged build and the tag ends with -maps - displayName: 'Copy CommunityToolkit.Maui.Maps NuGet Package to Staging Directory' - inputs: - targetType: 'inline' - script: | - $source = ".\src" - $filter = "CommunityToolkit.Maui.Maps.[0-9]+.[0-9]+.[0-9]+(-[a-zA-Z0-9]*)*.nupkg" - Get-ChildItem -Path $source -Recurse | Where-Object { $_.Name -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'], ''))) # Only run this step on Windows when the CI Pipeline has not been triggered by a Pull Request and the NuGet Signing Certificate is valid - - # Publish build artifacts - - 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)'