Skip to content

Commit

Permalink
[CI] Fix the pipeline that runs the macOS tests.
Browse files Browse the repository at this point in the history
Fixed several issues with te yaml:

* Missing config stage.
* Missing parameters,
* Hitting the same bug as Uno here: unoplatform/uno#18243 related to microsoft/azure-pipelines-tasks#17207



Co-authored-by: Rolf Bjarne Kvinge <[email protected]>
  • Loading branch information
mandel-macaque and rolfbjarne authored Sep 26, 2024
1 parent ca9419a commit 6df33a8
Show file tree
Hide file tree
Showing 4 changed files with 159 additions and 45 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
# This job builds the macOS tests.
- job: build_macos_tests_job
displayName: 'Build macOS tests'
timeoutInMinutes: 120
timeoutInMinutes: 180
variables:
DOTNET_PLATFORMS: $[ stageDependencies.configure_build.configure.outputs['configure_platforms.DOTNET_PLATFORMS'] ]
ENABLE_DOTNET: $[ stageDependencies.configure_build.configure.outputs['configure_platforms.ENABLE_DOTNET'] ]
Expand Down
5 changes: 2 additions & 3 deletions tools/devops/automation/templates/mac/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,8 @@ steps:
# Go get the tests!, this depends on how the test was triggered
- ${{ if or(contains(variables['Build.Reason'], 'ResourceTrigger'), contains(variables['Build.Reason'], 'BuildCompletion'), contains(variables['Build.DefinitionName'], 'xamarin-macios-ci-tests'), contains(variables['Build.DefinitionName'], 'xamarin-macios-pr-tests')) }}:
- download: macios
artifact: mac-test-package
displayName: Download Mac tests
patterns: '**/mac-test-package.7z'
artifact: 'mac-test-package'

# the default location when downloading is $(Pipeline.Workspace)/<pipeline resource identifier>/<artifact name>
- pwsh: |
Expand All @@ -162,7 +161,7 @@ steps:
- task: DownloadPipelineArtifact@2
displayName: Download Mac tests
inputs:
patterns: '**/mac-test-package.7z'
artifact: 'mac-test-package'
allowFailedBuilds: true
path: $(Build.SourcesDirectory)/artifacts/tmp

Expand Down
45 changes: 4 additions & 41 deletions tools/devops/automation/templates/mac/stage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,49 +39,12 @@ parameters:
type: boolean
default: false

stages:
- stage: configure_build
displayName: '${{ parameters.stageDisplayNamePrefix }}Configure'
dependsOn: ${{ parameters.dependsOn }}
${{ if and(ne(parameters.dependsOn, ''), ne(parameters.dependsOnResult, '')) }}:
condition: eq(dependencies.${{ parameters.dependsOn }}.result, '${{ parameters.dependsOnResult }}')
jobs:

- ${{ if eq(parameters.pool, 'automatic') }}:
- job: AgentPoolSelector # https://docs.microsoft.com/en-us/azure/devops/pipelines/process/phases?view=azure-devops&tabs=yaml
pool: # Consider using an agentless (server) job here, but would need to host selection logic as an Azure function: https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=azure-devops&tabs=schema#server
vmImage: ubuntu-latest
steps:
- checkout: none # https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=azure-devops&tabs=schema#checkout

# Selects appropriate agent pool based on trigger type (PR or CI); manually triggered builds target the PR pool
- template: azure-devops-pools/agent-pool-selector.yml@yaml-templates
parameters:
agentPoolPR: $(PRBuildPool)
agentPoolPRUrl: $(PRBuildPoolUrl)
agentPoolCI: $(CIBuildPool)
agentPoolCIUrl: $(CIBuildPoolUrl)

- job: configure
displayName: 'Configure build'
pool:
vmImage: windows-latest
- name: stageDisplayNamePrefix
type: string
default: ''

variables:
isMain: $[eq(variables['Build.SourceBranch'], 'refs/heads/main')]
isScheduled: $[eq(variables['Build.Reason'], 'Schedule')]
BRANCH_NAME: $[ replace(variables['Build.SourceBranch'], 'refs/heads/', '') ]

steps:
- template: common/load_configuration.yml
parameters:
repositoryAlias: ${{ parameters.repositoryAlias }}
commit: ${{ parameters.commit }}
testConfigurations: ${{ parameters.testConfigurations }}
supportedPlatforms: ${{ parameters.supportedPlatforms }}
testsLabels: '--label=skip-all-tests,run-ios-tests,run-ios-simulator-tests,run-tvos-tests,run-watchos-tests,run-mac-tests,run-maccatalyst-tests,run-dotnet-tests,run-system-permission-tests,run-legacy-xamarin-tests'
statusContext: 'VSTS: simulator tests'
uploadArtifacts: true
stages:

- stage: ${{ parameters.stageName }}
displayName: ${{ parameters.displayName }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,117 @@ parameters:
]
}]

- name: pool
type: string
default: automatic
values:
- pr
- ci
- automatic

- name: supportedPlatforms
type: object
default: [
{
platform: iOS,
isDotNetPlatform: true,
},
{
platform: macOS,
isDotNetPlatform: true,
},
{
platform: tvOS,
isDotNetPlatform: true,
},
{
platform: MacCatalyst,
isDotNetPlatform: true,
},
{
# when running platform-specific test runs, we also need a special test run that executes tests that only runs when multiple platforms are enabled
platform: Multiple,
isDotNetPlatform: true,
}
]


- name: testConfigurations
type: object
default: [
# Disabled by default #
# {
# label: bcl,
# splitByPlatforms: false,
# },
{
label: cecil,
splitByPlatforms: false,
testPrefix: 'simulator_tests',
},
{
label: dotnettests,
splitByPlatforms: true,
needsMultiplePlatforms: true,
testPrefix: 'simulator_tests',
},
{
label: fsharp,
splitByPlatforms: false,
testPrefix: 'simulator_tests',
},
{
label: framework,
splitByPlatforms: false,
testPrefix: 'simulator_tests',
},
{
label: generator,
splitByPlatforms: false,
testPrefix: 'simulator_tests',
},
{
label: interdependent-binding-projects,
splitByPlatforms: false,
testPrefix: 'simulator_tests',
},
{
label: introspection,
splitByPlatforms: false,
testPrefix: 'simulator_tests',
},
{
label: linker,
splitByPlatforms: false,
testPrefix: 'simulator_tests',
},
{
label: mmp,
splitByPlatforms: false,
testPrefix: 'simulator_tests',
},
{
label: monotouch,
splitByPlatforms: true,
needsMultiplePlatforms: false,
testPrefix: 'simulator_tests',
},
{
label: msbuild,
splitByPlatforms: false,
testPrefix: 'simulator_tests',
},
{
label: xcframework,
splitByPlatforms: false,
testPrefix: 'simulator_tests',
},
{
label: xtro,
splitByPlatforms: false,
testPrefix: 'simulator_tests',
},
]

resources:
repositories:
Expand Down Expand Up @@ -114,6 +225,47 @@ variables:
value: true

stages:

- stage: configure_build
displayName: '${{ parameters.stageDisplayNamePrefix }}Configure'
jobs:

- ${{ if eq(parameters.pool, 'automatic') }}:
- job: AgentPoolSelector # https://docs.microsoft.com/en-us/azure/devops/pipelines/process/phases?view=azure-devops&tabs=yaml
pool: # Consider using an agentless (server) job here, but would need to host selection logic as an Azure function: https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=azure-devops&tabs=schema#server
vmImage: ubuntu-latest
steps:
- checkout: none # https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=azure-devops&tabs=schema#checkout

# Selects appropriate agent pool based on trigger type (PR or CI); manually triggered builds target the PR pool
- template: azure-devops-pools/agent-pool-selector.yml@yaml-templates
parameters:
agentPoolPR: $(PRBuildPool)
agentPoolPRUrl: $(PRBuildPoolUrl)
agentPoolCI: $(CIBuildPool)
agentPoolCIUrl: $(CIBuildPoolUrl)

- job: configure
displayName: 'Configure build'
pool:
vmImage: windows-latest

variables:
isMain: $[eq(variables['Build.SourceBranch'], 'refs/heads/main')]
isScheduled: $[eq(variables['Build.Reason'], 'Schedule')]
BRANCH_NAME: $[ replace(variables['Build.SourceBranch'], 'refs/heads/', '') ]

steps:
- template: ../common/load_configuration.yml
parameters:
repositoryAlias: ${{ parameters.repositoryAlias }}
commit: ${{ parameters.commit }}
testConfigurations: ${{ parameters.testConfigurations }}
supportedPlatforms: ${{ parameters.supportedPlatforms }}
testsLabels: '--label=skip-all-tests,run-ios-tests,run-ios-simulator-tests,run-tvos-tests,run-watchos-tests,run-mac-tests,run-maccatalyst-tests,run-dotnet-tests,run-system-permission-tests,run-legacy-xamarin-tests'
statusContext: 'VSTS: simulator tests'
uploadArtifacts: true

- ${{ each config in parameters.macTestsConfigurations }}:
- template: ../mac/stage.yml
parameters:
Expand Down

15 comments on commit 6df33a8

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

Please sign in to comment.