# Xamarin # Build samples variables: azure_build_url: '$(System.CollectionUri)/$(System.TeamProject)/_build/results?buildId=$(Build.BuildId)' azpPoolName: 'Azure Pipelines' macOSVersion: 'internal-macos-10.15' debug_filter: '^.*Debug.*$' release_filter: '^.*Release.*$' iphone_filter: '^iPhone$' iphonesimulator_filter: '^iPhoneSimulator$' mac_platform_filter: '^$' name_filter_af: '^[A-Fa-f].*$' name_filter_gr: '^[G-Rg-r].*$' name_filter_rest: '^[^A-Ra-r].*$' resources: repositories: - repository: xamarin-macios-data type: github name: xamarin/xamarin-macios-data ref: refs/heads/main endpoint: xamarin - repository: maccore type: github name: xamarin/maccore ref: refs/heads/main endpoint: xamarin ### ### Tell GitHub we're starting working on this commit ### jobs: - job: ReportStartToGitHub displayName: Set pending GitHub status pool: name: '$(azpPoolName)' vmImage: '$(macOSVersion)' steps: - bash: ./jenkins/add-commit-status.sh "--token=$(github-pat)" "--hash=$BUILD_SOURCEVERSION" "--state=pending" --target-url="$AZURE_BUILD_URL" --description="$BUILD_DEFINITIONNAME" --context="$BUILD_DEFINITIONNAME" displayName: Set pending GitHub status ### ### Run the sample tests. ### ### They're split over multiple bots to make them run faster (and not hit the ### max job time duration for a single job). ### - job: macOS dependsOn: ReportStartToGitHub displayName: Build samples timeoutInMinutes: 360 strategy: matrix: # We have rougly 900 tests, which take a while to build for device. # So in that case, we split them in 3 buckets of roughly 300 tests each, # based on the first letter of the project's filename. Debug_iPhone_AF: TEST_PLATFORM_FILTER_EXPRESSION: $(iphone_filter) TEST_CONFIG_FILTER_EXPRESSION: $(debug_filter) TEST_NAME_FILTER_EXPRESSION: $(name_filter_af) Debug_iPhone_GR: TEST_PLATFORM_FILTER_EXPRESSION: $(iphone_filter) TEST_CONFIG_FILTER_EXPRESSION: $(debug_filter) TEST_NAME_FILTER_EXPRESSION: $(name_filter_gr) Debug_iPhone_SZ: TEST_PLATFORM_FILTER_EXPRESSION: $(iphone_filter) TEST_CONFIG_FILTER_EXPRESSION: $(debug_filter) TEST_NAME_FILTER_EXPRESSION: $(name_filter_rest) Debug_iPhoneSimulator: TEST_PLATFORM_FILTER_EXPRESSION: $(iphonesimulator_filter) TEST_CONFIG_FILTER_EXPRESSION: $(debug_filter) Release_iPhone_AF: TEST_PLATFORM_FILTER_EXPRESSION: $(iphone_filter) TEST_CONFIG_FILTER_EXPRESSION: $(release_filter) TEST_NAME_FILTER_EXPRESSION: $(name_filter_af) Release_iPhone_GR: TEST_PLATFORM_FILTER_EXPRESSION: $(iphone_filter) TEST_CONFIG_FILTER_EXPRESSION: $(release_filter) TEST_NAME_FILTER_EXPRESSION: $(name_filter_gr) Release_iPhone_SZ: TEST_PLATFORM_FILTER_EXPRESSION: $(iphone_filter) TEST_CONFIG_FILTER_EXPRESSION: $(release_filter) TEST_NAME_FILTER_EXPRESSION: $(name_filter_rest) Release_iPhoneSimulator: TEST_PLATFORM_FILTER_EXPRESSION: $(iphonesimulator_filter) TEST_CONFIG_FILTER_EXPRESSION: $(release_filter) Debug_Mac: TEST_PLATFORM_FILTER_EXPRESSION: $(mac_platform_filter) TEST_CONFIG_FILTER_EXPRESSION: $(debug_filter) Release_Mac: TEST_PLATFORM_FILTER_EXPRESSION: $(mac_platform_filter) TEST_CONFIG_FILTER_EXPRESSION: $(release_filter) pool: name: '$(azpPoolName)' vmImage: '$(macOSVersion)' steps: - checkout: self - checkout: xamarin-macios-data persistCredentials: true - checkout: maccore persistCredentials: true - bash: ./xamarin-macios/tools/devops/system-info.sh displayName: System Info - bash: ./xamarin-macios/tools/devops/fetch-maccore.sh displayName: Fetch correct maccore hash - bash: | echo "Requested Xcode $XCODE_URL" make -C $(System.DefaultWorkingDirectory)/xamarin-macios/tools/devops/ provision-xcode.csx displayName: 'Generate Xcode provisioning csx file' - task: provisionator@2 displayName: Xcode inputs: provisionator_uri: '$(provisionator-uri)' github_token: '$(github-pat)' provisioning_script: $(System.DefaultWorkingDirectory)/xamarin-macios/tools/devops/provision-xcode.csx - task: provisionator@2 displayName: Provision XI/XM/Mono/Objective-Sharpie inputs: provisionator_uri: '$(provisionator-uri)' github_token: '$(github-pat)' provisioning_script: $(System.DefaultWorkingDirectory)/xamarin-macios/tools/devops/build-samples.csx - bash: ./xamarin-macios/tools/devops/system-info.sh displayName: System Info post provisioning - bash: ./xamarin-macios/tools/devops/build-samples.sh displayName: Run tests - task: PublishTestResults@2 displayName: Publish test results condition: always() inputs: testResultsFormat: NUnit testResultsFiles: '**/TestResult*.xml' testRunTitle: Sample tests (build) publishRunAttachments: true mergeTestResults: true - bash: ./xamarin-macios/tools/devops/prepare-performance-data.sh displayName: Prepare performance data condition: always() - publish: logs displayName: 'Upload perf data' condition: always() artifact: logs-$(System.JobId) - bash: echo "##vso[task.setvariable variable=JobStatus;isOutput=true]$AGENT_JOBSTATUS" name: ExportedVariables displayName: Export status condition: always() ### ### Push performance data to the xamarin-macios-data repository ### - job: PublishPerformanceData displayName: Publish Performance Data condition: always() dependsOn: macOS pool: name: '$(azpPoolName)' vmImage: '$(macOSVersion)' steps: - checkout: self - checkout: xamarin-macios-data persistCredentials: true - task: DownloadPipelineArtifact@2 displayName: Download performance data inputs: source: current path: logs - bash: ./xamarin-macios/tools/devops/push-performance-data.sh displayName: Publish perf data - bash: echo "##vso[task.setvariable variable=JobStatus;isOutput=true]$AGENT_JOBSTATUS" name: ExportedVariables displayName: Export status condition: always() ### ### Report final results to GitHub ### - job: ReportResultsToGitHub displayName: Report status/results to GitHub dependsOn: - PublishPerformanceData - macOS condition: always() pool: name: '$(azpPoolName)' vmImage: '$(macOSVersion)' variables: jobResultDebugiPhoneAF: $[ dependencies.macOS.outputs['Debug_iPhone_AF.ExportedVariables.JobStatus'] ] jobResultDebugiPhoneGR: $[ dependencies.macOS.outputs['Debug_iPhone_GR.ExportedVariables.JobStatus'] ] jobResultDebugiPhoneSZ: $[ dependencies.macOS.outputs['Debug_iPhone_SZ.ExportedVariables.JobStatus'] ] jobResultDebugiPhoneSimulator: $[ dependencies.macOS.outputs['Debug_iPhoneSimulator.ExportedVariables.JobStatus'] ] jobResultReleaseiPhoneAF: $[ dependencies.macOS.outputs['Release_iPhone_AF.ExportedVariables.JobStatus'] ] jobResultReleaseiPhoneGR: $[ dependencies.macOS.outputs['Release_iPhone_GR.ExportedVariables.JobStatus'] ] jobResultReleaseiPhoneSZ: $[ dependencies.macOS.outputs['Release_iPhone_SZ.ExportedVariables.JobStatus'] ] jobResultReleaseiPhoneSimulator: $[ dependencies.macOS.outputs['Release_iPhoneSimulator.ExportedVariables.JobStatus'] ] jobResultDebugMac: $[ dependencies.macOS.outputs['Debug_Mac.ExportedVariables.JobStatus'] ] jobResultReleaseMac: $[ dependencies.macOS.outputs['Release_Mac.ExportedVariables.JobStatus'] ] jobResultPublishPerformanceData: $[ dependencies.PublishPerformanceData.outputs['ExportedVariables.JobStatus'] ] steps: - bash: | ./tools/devops/build-samples-report-to-github.sh "$(github-pat)" \ "Debug_iPhone_AF" "Debug_iPhone_GR" "Debug_iPhone_SZ" \ "Debug_iPhoneSimulator" \ "Release_iPhone_AF" "Release_iPhone_GR" "Release_iPhone_SZ" \ "Release_iPhoneSimulator" \ "Debug_Mac" \ "Release_Mac" \ "PublishPerformanceData" displayName: Report results to GitHub as comment / status condition: always()