mingw: try to work around issues with the test cleanup
[git.git] / azure-pipelines.yml
blob480e841a85dd7067c6fb23ccfd2f3ed52281a0b4
1 resources:
2 - repo: self
3   fetchDepth: 1
5 jobs:
6 - job: windows
7   displayName: Windows
8   condition: succeeded()
9   pool: Hosted
10   timeoutInMinutes: 240
11   steps:
12   - powershell: |
13       if ("$GITFILESHAREPWD" -ne "" -and "$GITFILESHAREPWD" -ne "`$`(gitfileshare.pwd)") {
14         net use s: \\gitfileshare.file.core.windows.net\test-cache "$GITFILESHAREPWD" /user:AZURE\gitfileshare /persistent:no
15         cmd /c mklink /d "$(Build.SourcesDirectory)\test-cache" S:\
16       }
17     displayName: 'Mount test-cache'
18     env:
19       GITFILESHAREPWD: $(gitfileshare.pwd)
20   - powershell: |
21       $urlbase = "https://dev.azure.com/git-for-windows/git/_apis/build/builds"
22       $id = ((Invoke-WebRequest -UseBasicParsing "${urlbase}?definitions=22&statusFilter=completed&resultFilter=succeeded&`$top=1").content | ConvertFrom-JSON).value[0].id
23       $downloadUrl = ((Invoke-WebRequest -UseBasicParsing "${urlbase}/$id/artifacts").content | ConvertFrom-JSON).value[1].resource.downloadUrl
24       (New-Object Net.WebClient).DownloadFile($downloadUrl,"git-sdk-64-minimal.zip")
25       Expand-Archive git-sdk-64-minimal.zip -DestinationPath . -Force
26       Remove-Item git-sdk-64-minimal.zip
28       # Let Git ignore the SDK and the test-cache
29       "/git-sdk-64-minimal/`n/test-cache/`n" | Out-File -NoNewLine -Encoding ascii -Append "$(Build.SourcesDirectory)\.git\info\exclude"
30     displayName: 'Download git-sdk-64-minimal'
31   - powershell: |
32       & git-sdk-64-minimal\usr\bin\bash.exe -lc @"
33         export DEVELOPER=1
34         export NO_PERL=1
35         export NO_SVN_TESTS=1
36         export GIT_TEST_SKIP_REBASE_P=1
38         ci/run-build-and-tests.sh || {
39           ci/print-test-failures.sh
40           exit 1
41         }
42       "@
43       if (!$?) { exit(1) }
44     displayName: 'Build & Test'
45     env:
46       HOME: $(Build.SourcesDirectory)
47       MSYSTEM: MINGW64
48   - powershell: |
49       if ("$GITFILESHAREPWD" -ne "" -and "$GITFILESHAREPWD" -ne "`$`(gitfileshare.pwd)") {
50         cmd /c rmdir "$(Build.SourcesDirectory)\test-cache"
51       }
52     displayName: 'Unmount test-cache'
53     condition: true
54     env:
55       GITFILESHAREPWD: $(gitfileshare.pwd)
56   - task: PublishTestResults@2
57     displayName: 'Publish Test Results **/TEST-*.xml'
58     inputs:
59       mergeTestResults: true
60       testRunTitle: 'windows'
61       platform: Windows
62       publishRunAttachments: false
63     condition: succeededOrFailed()
64   - task: PublishBuildArtifacts@1
65     displayName: 'Publish trash directories of failed tests'
66     condition: failed()
67     inputs:
68       PathtoPublish: t/failed-test-artifacts
69       ArtifactName: failed-test-artifacts
71 - job: linux_clang
72   displayName: linux-clang
73   condition: succeeded()
74   pool: Hosted Ubuntu 1604
75   steps:
76   - bash: |
77        test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || ci/mount-fileshare.sh //gitfileshare.file.core.windows.net/test-cache gitfileshare "$GITFILESHAREPWD" "$HOME/test-cache" || exit 1
79        sudo apt-get update &&
80        sudo apt-get -y install git gcc make libssl-dev libcurl4-openssl-dev libexpat-dev tcl tk gettext git-email zlib1g-dev apache2-bin &&
82        export CC=clang || exit 1
84        ci/install-dependencies.sh || exit 1
85        ci/run-build-and-tests.sh || {
86            ci/print-test-failures.sh
87            exit 1
88        }
90        test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || sudo umount "$HOME/test-cache" || exit 1
91     displayName: 'ci/run-build-and-tests.sh'
92     env:
93       GITFILESHAREPWD: $(gitfileshare.pwd)
94   - task: PublishTestResults@2
95     displayName: 'Publish Test Results **/TEST-*.xml'
96     inputs:
97       mergeTestResults: true
98       testRunTitle: 'linux-clang'
99       platform: Linux
100       publishRunAttachments: false
101     condition: succeededOrFailed()
102   - task: PublishBuildArtifacts@1
103     displayName: 'Publish trash directories of failed tests'
104     condition: failed()
105     inputs:
106       PathtoPublish: t/failed-test-artifacts
107       ArtifactName: failed-test-artifacts
109 - job: linux_gcc
110   displayName: linux-gcc
111   condition: succeeded()
112   pool: Hosted Ubuntu 1604
113   steps:
114   - bash: |
115        test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || ci/mount-fileshare.sh //gitfileshare.file.core.windows.net/test-cache gitfileshare "$GITFILESHAREPWD" "$HOME/test-cache" || exit 1
117        sudo add-apt-repository ppa:ubuntu-toolchain-r/test &&
118        sudo apt-get update &&
119        sudo apt-get -y install git gcc make libssl-dev libcurl4-openssl-dev libexpat-dev tcl tk gettext git-email zlib1g-dev apache2 language-pack-is git-svn gcc-8 || exit 1
121        ci/install-dependencies.sh || exit 1
122        ci/run-build-and-tests.sh || {
123            ci/print-test-failures.sh
124            exit 1
125        }
127        test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || sudo umount "$HOME/test-cache" || exit 1
128     displayName: 'ci/run-build-and-tests.sh'
129     env:
130       GITFILESHAREPWD: $(gitfileshare.pwd)
131   - task: PublishTestResults@2
132     displayName: 'Publish Test Results **/TEST-*.xml'
133     inputs:
134       mergeTestResults: true
135       testRunTitle: 'linux-gcc'
136       platform: Linux
137       publishRunAttachments: false
138     condition: succeededOrFailed()
139   - task: PublishBuildArtifacts@1
140     displayName: 'Publish trash directories of failed tests'
141     condition: failed()
142     inputs:
143       PathtoPublish: t/failed-test-artifacts
144       ArtifactName: failed-test-artifacts
146 - job: osx_clang
147   displayName: osx-clang
148   condition: succeeded()
149   pool: Hosted macOS
150   steps:
151   - bash: |
152        test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || ci/mount-fileshare.sh //gitfileshare.file.core.windows.net/test-cache gitfileshare "$GITFILESHAREPWD" "$HOME/test-cache" || exit 1
154        export CC=clang
156        ci/install-dependencies.sh || exit 1
157        ci/run-build-and-tests.sh || {
158            ci/print-test-failures.sh
159            exit 1
160        }
162        test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || umount "$HOME/test-cache" || exit 1
163     displayName: 'ci/run-build-and-tests.sh'
164     env:
165       GITFILESHAREPWD: $(gitfileshare.pwd)
166   - task: PublishTestResults@2
167     displayName: 'Publish Test Results **/TEST-*.xml'
168     inputs:
169       mergeTestResults: true
170       testRunTitle: 'osx-clang'
171       platform: macOS
172       publishRunAttachments: false
173     condition: succeededOrFailed()
174   - task: PublishBuildArtifacts@1
175     displayName: 'Publish trash directories of failed tests'
176     condition: failed()
177     inputs:
178       PathtoPublish: t/failed-test-artifacts
179       ArtifactName: failed-test-artifacts
181 - job: osx_gcc
182   displayName: osx-gcc
183   condition: succeeded()
184   pool: Hosted macOS
185   steps:
186   - bash: |
187        test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || ci/mount-fileshare.sh //gitfileshare.file.core.windows.net/test-cache gitfileshare "$GITFILESHAREPWD" "$HOME/test-cache" || exit 1
189        ci/install-dependencies.sh || exit 1
190        ci/run-build-and-tests.sh || {
191            ci/print-test-failures.sh
192            exit 1
193        }
195        test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || umount "$HOME/test-cache" || exit 1
196     displayName: 'ci/run-build-and-tests.sh'
197     env:
198       GITFILESHAREPWD: $(gitfileshare.pwd)
199   - task: PublishTestResults@2
200     displayName: 'Publish Test Results **/TEST-*.xml'
201     inputs:
202       mergeTestResults: true
203       testRunTitle: 'osx-gcc'
204       platform: macOS
205       publishRunAttachments: false
206     condition: succeededOrFailed()
207   - task: PublishBuildArtifacts@1
208     displayName: 'Publish trash directories of failed tests'
209     condition: failed()
210     inputs:
211       PathtoPublish: t/failed-test-artifacts
212       ArtifactName: failed-test-artifacts
214 - job: gettext_poison
215   displayName: GETTEXT_POISON
216   condition: succeeded()
217   pool: Hosted Ubuntu 1604
218   steps:
219   - bash: |
220        test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || ci/mount-fileshare.sh //gitfileshare.file.core.windows.net/test-cache gitfileshare "$GITFILESHAREPWD" "$HOME/test-cache" || exit 1
222        sudo apt-get update &&
223        sudo apt-get -y install git gcc make libssl-dev libcurl4-openssl-dev libexpat-dev tcl tk gettext git-email zlib1g-dev &&
225        export jobname=GETTEXT_POISON || exit 1
227        ci/run-build-and-tests.sh || {
228            ci/print-test-failures.sh
229            exit 1
230        }
232        test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || sudo umount "$HOME/test-cache" || exit 1
233     displayName: 'ci/run-build-and-tests.sh'
234     env:
235       GITFILESHAREPWD: $(gitfileshare.pwd)
236   - task: PublishTestResults@2
237     displayName: 'Publish Test Results **/TEST-*.xml'
238     inputs:
239       mergeTestResults: true
240       testRunTitle: 'gettext-poison'
241       platform: Linux
242       publishRunAttachments: false
243     condition: succeededOrFailed()
244   - task: PublishBuildArtifacts@1
245     displayName: 'Publish trash directories of failed tests'
246     condition: failed()
247     inputs:
248       PathtoPublish: t/failed-test-artifacts
249       ArtifactName: failed-test-artifacts
251 - job: linux32
252   displayName: Linux32
253   condition: succeeded()
254   pool: Hosted Ubuntu 1604
255   steps:
256   - bash: |
257        test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || ci/mount-fileshare.sh //gitfileshare.file.core.windows.net/test-cache gitfileshare "$GITFILESHAREPWD" "$HOME/test-cache" || exit 1
259        res=0
260        sudo AGENT_OS="$AGENT_OS" BUILD_BUILDNUMBER="$BUILD_BUILDNUMBER" BUILD_REPOSITORY_URI="$BUILD_REPOSITORY_URI" BUILD_SOURCEBRANCH="$BUILD_SOURCEBRANCH" BUILD_SOURCEVERSION="$BUILD_SOURCEVERSION" SYSTEM_PHASENAME="$SYSTEM_PHASENAME" SYSTEM_TASKDEFINITIONSURI="$SYSTEM_TASKDEFINITIONSURI" SYSTEM_TEAMPROJECT="$SYSTEM_TEAMPROJECT" CC=$CC MAKEFLAGS="$MAKEFLAGS" bash -lxc ci/run-linux32-docker.sh || res=1
262        sudo chmod a+r t/out/TEST-*.xml
263        test ! -d t/failed-test-artifacts || sudo chmod a+r t/failed-test-artifacts
265        test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || sudo umount "$HOME/test-cache" || res=1
266        exit $res
267     displayName: 'ci/run-linux32-docker.sh'
268     env:
269       GITFILESHAREPWD: $(gitfileshare.pwd)
270   - task: PublishTestResults@2
271     displayName: 'Publish Test Results **/TEST-*.xml'
272     inputs:
273       mergeTestResults: true
274       testRunTitle: 'linux32'
275       platform: Linux
276       publishRunAttachments: false
277     condition: succeededOrFailed()
278   - task: PublishBuildArtifacts@1
279     displayName: 'Publish trash directories of failed tests'
280     condition: failed()
281     inputs:
282       PathtoPublish: t/failed-test-artifacts
283       ArtifactName: failed-test-artifacts
285 - job: static_analysis
286   displayName: StaticAnalysis
287   condition: succeeded()
288   pool: Hosted Ubuntu 1604
289   steps:
290   - bash: |
291        test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || ci/mount-fileshare.sh //gitfileshare.file.core.windows.net/test-cache gitfileshare "$GITFILESHAREPWD" "$HOME/test-cache" || exit 1
293        sudo apt-get update &&
294        sudo apt-get install -y coccinelle &&
296        export jobname=StaticAnalysis &&
298        ci/run-static-analysis.sh || exit 1
300        test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || sudo umount "$HOME/test-cache" || exit 1
301     displayName: 'ci/run-static-analysis.sh'
302     env:
303       GITFILESHAREPWD: $(gitfileshare.pwd)
305 - job: documentation
306   displayName: Documentation
307   condition: succeeded()
308   pool: Hosted Ubuntu 1604
309   steps:
310   - bash: |
311        test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || ci/mount-fileshare.sh //gitfileshare.file.core.windows.net/test-cache gitfileshare "$GITFILESHAREPWD" "$HOME/test-cache" || exit 1
313        sudo apt-get update &&
314        sudo apt-get install -y asciidoc xmlto asciidoctor &&
316        export ALREADY_HAVE_ASCIIDOCTOR=yes. &&
317        export jobname=Documentation &&
319        ci/test-documentation.sh || exit 1
321        test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || sudo umount "$HOME/test-cache" || exit 1
322     displayName: 'ci/test-documentation.sh'
323     env:
324       GITFILESHAREPWD: $(gitfileshare.pwd)