Skip to content

Commit 8ea6cd6

Browse files
[CI] Allow the windows tests to work on post build pipelines. (dotnet#20606)
1 parent 9d73bde commit 8ea6cd6

File tree

2 files changed

+84
-13
lines changed

2 files changed

+84
-13
lines changed

tools/devops/automation/templates/windows/build.yml

Lines changed: 43 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,20 +40,55 @@ steps:
4040
- pwsh: $(System.DefaultWorkingDirectory)/xamarin-macios/tools/devops/automation/scripts/show_env.ps1
4141
displayName: 'Dump Environment'
4242

43-
- task: DownloadPipelineArtifact@2
44-
displayName: Download artifacts
45-
inputs:
46-
allowFailedBuilds: true
47-
path: $(Build.SourcesDirectory)/artifacts
43+
- ${{ 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')) }}:
44+
- download: macios
45+
displayName: Download Build.props
46+
artifact: Build.props
47+
48+
- download: macios
49+
displayName: Download package-test-libraries
50+
artifact: package-test-libraries
51+
52+
- download: macios
53+
displayName: Download build-configuration
54+
artifact: build-configuration
55+
56+
- download: macios
57+
displayName: Download not-signed-package
58+
artifact: not-signed-package
59+
60+
- download: macios
61+
displayName: Download WorkloadRollback.json
62+
artifact: WorkloadRollback
63+
64+
- pwsh: |
65+
Get-ChildItem -Path "$(Pipeline.Workspace)/macios" -Recurse -Force
66+
displayName: 'Display downloads'
67+
timeoutInMinutes: 5
68+
69+
# the default location when downloading is $(Pipeline.Workspace)/<pipeline resource identifier>/<artifact name>
70+
- pwsh: |
71+
$source="$(Pipeline.Workspace)/macios"
72+
$destination="$(Build.SourcesDirectory)/artifacts"
73+
# move all the files from the source to the destination
74+
Move-Item -Path "$source" -Destination "$destination" -Force
75+
displayName: Move artifacts to the expected location
76+
77+
- ${{ else }}:
78+
- task: DownloadPipelineArtifact@2
79+
displayName: Download artifacts
80+
inputs:
81+
allowFailedBuilds: true
82+
path: $(Build.SourcesDirectory)/artifacts
4883

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

5388
- pwsh: |
5489
try {
55-
Write-Host "Looking in '$(Build.SourcesDirectory)\artifacts"
56-
Get-ChildItem "$(Build.SourcesDirectory)\artifacts" -Recurse
90+
Write-Host "Looking in '$(Build.SourcesDirectory)\\artifacts"
91+
Get-ChildItem "$(Build.SourcesDirectory)\\artifacts" -Recurse
5792
} catch {
5893
Write-Host "Exception occured: $_"
5994
}
@@ -150,7 +185,7 @@ steps:
150185
displayName: 'Install custom .NET'
151186

152187
- pwsh: |
153-
$Env:DOTNET = "$(Build.SourcesDirectory)\xamarin-macios\tests\dotnet\Windows\bin\dotnet\dotnet.exe"
188+
$Env:DOTNET = "$(Build.SourcesDirectory)\xamarin-macios\\tests\dotnet\Windows\\bin\dotnet\dotnet.exe"
154189
& dotnet build "$(Build.SourcesDirectory)/xamarin-macios/tests/dotnet/Windows/InstallDotNet.csproj" `
155190
--verbosity quiet `
156191
"-bl:$(Build.SourcesDirectory)/xamarin-macios/tests/dotnet/Windows/install-workloads.binlog" `

tools/devops/automation/templates/windows/reserve-mac.yml

Lines changed: 41 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,47 @@ steps:
9696
displayName: "Autorize id_rsa.pub"
9797
continueOnError: true
9898

99-
- task: DownloadPipelineArtifact@2
100-
displayName: Download artifacts
101-
inputs:
102-
allowFailedBuilds: true
103-
path: $(Build.SourcesDirectory)/artifacts
99+
- ${{ 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')) }}:
100+
101+
- download: macios
102+
displayName: Download Build.props
103+
artifact: Build.props
104+
105+
- download: macios
106+
displayName: Download package-test-libraries
107+
artifact: package-test-libraries
108+
109+
- download: macios
110+
displayName: Download build-configuration
111+
artifact: build-configuration
112+
113+
- download: macios
114+
displayName: Download not-signed-package
115+
artifact: not-signed-package
116+
117+
- download: macios
118+
displayName: Download WorkloadRollback.json
119+
artifact: WorkloadRollback
120+
121+
- pwsh: |
122+
Get-ChildItem -Path "$(Pipeline.Workspace)/macios" -Recurse -Force
123+
displayName: 'Display downloads'
124+
timeoutInMinutes: 5
125+
126+
# the default location when downloading is $(Pipeline.Workspace)/<pipeline resource identifier>/<artifact name>
127+
- bash: |
128+
source="$PIPELINE_WORKSPACE/macios"
129+
destination="$BUILD_SOURCESDIRECTORY/artifacts"
130+
# move all the files from the source to the destination
131+
mv -fv "$source" "$destination"
132+
displayName: Move artifacts to the expected location
133+
134+
- ${{ else }}:
135+
- task: DownloadPipelineArtifact@2
136+
displayName: Download artifacts
137+
inputs:
138+
allowFailedBuilds: true
139+
path: $(Build.SourcesDirectory)/artifacts
104140

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

0 commit comments

Comments
 (0)