Skip to content

Commit

Permalink
[CI] Allow the windows tests to work on post build pipelines. (#20606)
Browse files Browse the repository at this point in the history
  • Loading branch information
mandel-macaque authored May 17, 2024
1 parent 9d73bde commit 8ea6cd6
Show file tree
Hide file tree
Showing 2 changed files with 84 additions and 13 deletions.
51 changes: 43 additions & 8 deletions tools/devops/automation/templates/windows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,20 +40,55 @@ steps:
- pwsh: $(System.DefaultWorkingDirectory)/xamarin-macios/tools/devops/automation/scripts/show_env.ps1
displayName: 'Dump Environment'

- task: DownloadPipelineArtifact@2
displayName: Download artifacts
inputs:
allowFailedBuilds: true
path: $(Build.SourcesDirectory)/artifacts
- ${{ 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
displayName: Download Build.props
artifact: Build.props

- download: macios
displayName: Download package-test-libraries
artifact: package-test-libraries

- download: macios
displayName: Download build-configuration
artifact: build-configuration

- download: macios
displayName: Download not-signed-package
artifact: not-signed-package

- download: macios
displayName: Download WorkloadRollback.json
artifact: WorkloadRollback

- pwsh: |
Get-ChildItem -Path "$(Pipeline.Workspace)/macios" -Recurse -Force
displayName: 'Display downloads'
timeoutInMinutes: 5
# the default location when downloading is $(Pipeline.Workspace)/<pipeline resource identifier>/<artifact name>
- pwsh: |
$source="$(Pipeline.Workspace)/macios"
$destination="$(Build.SourcesDirectory)/artifacts"
# move all the files from the source to the destination
Move-Item -Path "$source" -Destination "$destination" -Force
displayName: Move artifacts to the expected location
- ${{ else }}:
- task: DownloadPipelineArtifact@2
displayName: Download artifacts
inputs:
allowFailedBuilds: true
path: $(Build.SourcesDirectory)/artifacts

- pwsh: |
Get-ChildItem $(Build.SourcesDirectory)/artifacts -Recurse
displayName: "Debug downloads"

- pwsh: |
try {
Write-Host "Looking in '$(Build.SourcesDirectory)\artifacts"
Get-ChildItem "$(Build.SourcesDirectory)\artifacts" -Recurse
Write-Host "Looking in '$(Build.SourcesDirectory)\\artifacts"
Get-ChildItem "$(Build.SourcesDirectory)\\artifacts" -Recurse
} catch {
Write-Host "Exception occured: $_"
}
Expand Down Expand Up @@ -150,7 +185,7 @@ steps:
displayName: 'Install custom .NET'

- pwsh: |
$Env:DOTNET = "$(Build.SourcesDirectory)\xamarin-macios\tests\dotnet\Windows\bin\dotnet\dotnet.exe"
$Env:DOTNET = "$(Build.SourcesDirectory)\xamarin-macios\\tests\dotnet\Windows\\bin\dotnet\dotnet.exe"
& dotnet build "$(Build.SourcesDirectory)/xamarin-macios/tests/dotnet/Windows/InstallDotNet.csproj" `
--verbosity quiet `
"-bl:$(Build.SourcesDirectory)/xamarin-macios/tests/dotnet/Windows/install-workloads.binlog" `
Expand Down
46 changes: 41 additions & 5 deletions tools/devops/automation/templates/windows/reserve-mac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,47 @@ steps:
displayName: "Autorize id_rsa.pub"
continueOnError: true

- task: DownloadPipelineArtifact@2
displayName: Download artifacts
inputs:
allowFailedBuilds: true
path: $(Build.SourcesDirectory)/artifacts
- ${{ 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
displayName: Download Build.props
artifact: Build.props

- download: macios
displayName: Download package-test-libraries
artifact: package-test-libraries

- download: macios
displayName: Download build-configuration
artifact: build-configuration

- download: macios
displayName: Download not-signed-package
artifact: not-signed-package

- download: macios
displayName: Download WorkloadRollback.json
artifact: WorkloadRollback

- pwsh: |
Get-ChildItem -Path "$(Pipeline.Workspace)/macios" -Recurse -Force
displayName: 'Display downloads'
timeoutInMinutes: 5
# the default location when downloading is $(Pipeline.Workspace)/<pipeline resource identifier>/<artifact name>
- bash: |
source="$PIPELINE_WORKSPACE/macios"
destination="$BUILD_SOURCESDIRECTORY/artifacts"
# move all the files from the source to the destination
mv -fv "$source" "$destination"
displayName: Move artifacts to the expected location
- ${{ else }}:
- task: DownloadPipelineArtifact@2
displayName: Download artifacts
inputs:
allowFailedBuilds: true
path: $(Build.SourcesDirectory)/artifacts

- bash: $(Build.SourcesDirectory)/xamarin-macios/tools/devops/automation/scripts/bash/install-workloads.sh
workingDirectory: $(System.DefaultWorkingDirectory)/xamarin-macios
Expand Down

3 comments on commit 8ea6cd6

@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.