Merge branch 'ab/workaround-dash-bug-in-test'
[git.git] / azure-pipelines.yml
blobc329b7218bb361c077bb373d6bb04a3196f17256
1 resources:
2 - repo: self
3   fetchDepth: 1
5 jobs:
6 - job: windows_build
7   displayName: Windows Build
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         ci/make-test-artifacts.sh artifacts
34       "@
35       if (!$?) { exit(1) }
36     displayName: Build
37     env:
38       HOME: $(Build.SourcesDirectory)
39       MSYSTEM: MINGW64
40       DEVELOPER: 1
41       NO_PERL: 1
42   - task: PublishPipelineArtifact@0
43     displayName: 'Publish Pipeline Artifact: test artifacts'
44     inputs:
45       artifactName: 'windows-artifacts'
46       targetPath: '$(Build.SourcesDirectory)\artifacts'
47   - task: PublishPipelineArtifact@0
48     displayName: 'Publish Pipeline Artifact: git-sdk-64-minimal'
49     inputs:
50       artifactName: 'git-sdk-64-minimal'
51       targetPath: '$(Build.SourcesDirectory)\git-sdk-64-minimal'
52   - powershell: |
53       if ("$GITFILESHAREPWD" -ne "" -and "$GITFILESHAREPWD" -ne "`$`(gitfileshare.pwd)") {
54         cmd /c rmdir "$(Build.SourcesDirectory)\test-cache"
55       }
56     displayName: 'Unmount test-cache'
57     condition: true
58     env:
59       GITFILESHAREPWD: $(gitfileshare.pwd)
61 - job: windows_test
62   displayName: Windows Test
63   dependsOn: windows_build
64   condition: succeeded()
65   pool: Hosted
66   timeoutInMinutes: 240
67   strategy:
68     parallel: 10
69   steps:
70   - powershell: |
71       if ("$GITFILESHAREPWD" -ne "" -and "$GITFILESHAREPWD" -ne "`$`(gitfileshare.pwd)") {
72         net use s: \\gitfileshare.file.core.windows.net\test-cache "$GITFILESHAREPWD" /user:AZURE\gitfileshare /persistent:no
73         cmd /c mklink /d "$(Build.SourcesDirectory)\test-cache" S:\
74       }
75     displayName: 'Mount test-cache'
76     env:
77       GITFILESHAREPWD: $(gitfileshare.pwd)
78   - task: DownloadPipelineArtifact@0
79     displayName: 'Download Pipeline Artifact: test artifacts'
80     inputs:
81       artifactName: 'windows-artifacts'
82       targetPath: '$(Build.SourcesDirectory)'
83   - task: DownloadPipelineArtifact@0
84     displayName: 'Download Pipeline Artifact: git-sdk-64-minimal'
85     inputs:
86       artifactName: 'git-sdk-64-minimal'
87       targetPath: '$(Build.SourcesDirectory)\git-sdk-64-minimal'
88   - powershell: |
89       & git-sdk-64-minimal\usr\bin\bash.exe -lc @"
90         test -f artifacts.tar.gz || {
91           echo No test artifacts found\; skipping >&2
92           exit 0
93         }
94         tar xf artifacts.tar.gz || exit 1
96         # Let Git ignore the SDK and the test-cache
97         printf '%s\n' /git-sdk-64-minimal/ /test-cache/ >>.git/info/exclude
99         ci/run-test-slice.sh `$SYSTEM_JOBPOSITIONINPHASE `$SYSTEM_TOTALJOBSINPHASE || {
100           ci/print-test-failures.sh
101           exit 1
102         }
103       "@
104       if (!$?) { exit(1) }
105     displayName: 'Test (parallel)'
106     env:
107       HOME: $(Build.SourcesDirectory)
108       MSYSTEM: MINGW64
109       NO_SVN_TESTS: 1
110       GIT_TEST_SKIP_REBASE_P: 1
111   - powershell: |
112       if ("$GITFILESHAREPWD" -ne "" -and "$GITFILESHAREPWD" -ne "`$`(gitfileshare.pwd)") {
113         cmd /c rmdir "$(Build.SourcesDirectory)\test-cache"
114       }
115     displayName: 'Unmount test-cache'
116     condition: true
117     env:
118       GITFILESHAREPWD: $(gitfileshare.pwd)
119   - task: PublishTestResults@2
120     displayName: 'Publish Test Results **/TEST-*.xml'
121     inputs:
122       mergeTestResults: true
123       testRunTitle: 'windows'
124       platform: Windows
125       publishRunAttachments: false
126     condition: succeededOrFailed()
127   - task: PublishBuildArtifacts@1
128     displayName: 'Publish trash directories of failed tests'
129     condition: failed()
130     inputs:
131       PathtoPublish: t/failed-test-artifacts
132       ArtifactName: failed-test-artifacts
134 - job: linux_clang
135   displayName: linux-clang
136   condition: succeeded()
137   pool: Hosted Ubuntu 1604
138   steps:
139   - bash: |
140        test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || ci/mount-fileshare.sh //gitfileshare.file.core.windows.net/test-cache gitfileshare "$GITFILESHAREPWD" "$HOME/test-cache" || exit 1
142        sudo apt-get update &&
143        sudo apt-get -y install git gcc make libssl-dev libcurl4-openssl-dev libexpat-dev tcl tk gettext git-email zlib1g-dev apache2-bin &&
145        export CC=clang || exit 1
147        ci/install-dependencies.sh || exit 1
148        ci/run-build-and-tests.sh || {
149            ci/print-test-failures.sh
150            exit 1
151        }
153        test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || sudo umount "$HOME/test-cache" || exit 1
154     displayName: 'ci/run-build-and-tests.sh'
155     env:
156       GITFILESHAREPWD: $(gitfileshare.pwd)
157   - task: PublishTestResults@2
158     displayName: 'Publish Test Results **/TEST-*.xml'
159     inputs:
160       mergeTestResults: true
161       testRunTitle: 'linux-clang'
162       platform: Linux
163       publishRunAttachments: false
164     condition: succeededOrFailed()
165   - task: PublishBuildArtifacts@1
166     displayName: 'Publish trash directories of failed tests'
167     condition: failed()
168     inputs:
169       PathtoPublish: t/failed-test-artifacts
170       ArtifactName: failed-test-artifacts
172 - job: linux_gcc
173   displayName: linux-gcc
174   condition: succeeded()
175   pool: Hosted Ubuntu 1604
176   steps:
177   - bash: |
178        test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || ci/mount-fileshare.sh //gitfileshare.file.core.windows.net/test-cache gitfileshare "$GITFILESHAREPWD" "$HOME/test-cache" || exit 1
180        sudo add-apt-repository ppa:ubuntu-toolchain-r/test &&
181        sudo apt-get update &&
182        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
184        ci/install-dependencies.sh || exit 1
185        ci/run-build-and-tests.sh || {
186            ci/print-test-failures.sh
187            exit 1
188        }
190        test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || sudo umount "$HOME/test-cache" || exit 1
191     displayName: 'ci/run-build-and-tests.sh'
192     env:
193       GITFILESHAREPWD: $(gitfileshare.pwd)
194   - task: PublishTestResults@2
195     displayName: 'Publish Test Results **/TEST-*.xml'
196     inputs:
197       mergeTestResults: true
198       testRunTitle: 'linux-gcc'
199       platform: Linux
200       publishRunAttachments: false
201     condition: succeededOrFailed()
202   - task: PublishBuildArtifacts@1
203     displayName: 'Publish trash directories of failed tests'
204     condition: failed()
205     inputs:
206       PathtoPublish: t/failed-test-artifacts
207       ArtifactName: failed-test-artifacts
209 - job: osx_clang
210   displayName: osx-clang
211   condition: succeeded()
212   pool: Hosted macOS
213   steps:
214   - bash: |
215        test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || ci/mount-fileshare.sh //gitfileshare.file.core.windows.net/test-cache gitfileshare "$GITFILESHAREPWD" "$HOME/test-cache" || exit 1
217        export CC=clang
219        ci/install-dependencies.sh || exit 1
220        ci/run-build-and-tests.sh || {
221            ci/print-test-failures.sh
222            exit 1
223        }
225        test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || umount "$HOME/test-cache" || exit 1
226     displayName: 'ci/run-build-and-tests.sh'
227     env:
228       GITFILESHAREPWD: $(gitfileshare.pwd)
229   - task: PublishTestResults@2
230     displayName: 'Publish Test Results **/TEST-*.xml'
231     inputs:
232       mergeTestResults: true
233       testRunTitle: 'osx-clang'
234       platform: macOS
235       publishRunAttachments: false
236     condition: succeededOrFailed()
237   - task: PublishBuildArtifacts@1
238     displayName: 'Publish trash directories of failed tests'
239     condition: failed()
240     inputs:
241       PathtoPublish: t/failed-test-artifacts
242       ArtifactName: failed-test-artifacts
244 - job: osx_gcc
245   displayName: osx-gcc
246   condition: succeeded()
247   pool: Hosted macOS
248   steps:
249   - bash: |
250        test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || ci/mount-fileshare.sh //gitfileshare.file.core.windows.net/test-cache gitfileshare "$GITFILESHAREPWD" "$HOME/test-cache" || exit 1
252        ci/install-dependencies.sh || exit 1
253        ci/run-build-and-tests.sh || {
254            ci/print-test-failures.sh
255            exit 1
256        }
258        test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || umount "$HOME/test-cache" || exit 1
259     displayName: 'ci/run-build-and-tests.sh'
260     env:
261       GITFILESHAREPWD: $(gitfileshare.pwd)
262   - task: PublishTestResults@2
263     displayName: 'Publish Test Results **/TEST-*.xml'
264     inputs:
265       mergeTestResults: true
266       testRunTitle: 'osx-gcc'
267       platform: macOS
268       publishRunAttachments: false
269     condition: succeededOrFailed()
270   - task: PublishBuildArtifacts@1
271     displayName: 'Publish trash directories of failed tests'
272     condition: failed()
273     inputs:
274       PathtoPublish: t/failed-test-artifacts
275       ArtifactName: failed-test-artifacts
277 - job: gettext_poison
278   displayName: GETTEXT_POISON
279   condition: succeeded()
280   pool: Hosted Ubuntu 1604
281   steps:
282   - bash: |
283        test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || ci/mount-fileshare.sh //gitfileshare.file.core.windows.net/test-cache gitfileshare "$GITFILESHAREPWD" "$HOME/test-cache" || exit 1
285        sudo apt-get update &&
286        sudo apt-get -y install git gcc make libssl-dev libcurl4-openssl-dev libexpat-dev tcl tk gettext git-email zlib1g-dev &&
288        export jobname=GETTEXT_POISON || exit 1
290        ci/run-build-and-tests.sh || {
291            ci/print-test-failures.sh
292            exit 1
293        }
295        test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || sudo umount "$HOME/test-cache" || exit 1
296     displayName: 'ci/run-build-and-tests.sh'
297     env:
298       GITFILESHAREPWD: $(gitfileshare.pwd)
299   - task: PublishTestResults@2
300     displayName: 'Publish Test Results **/TEST-*.xml'
301     inputs:
302       mergeTestResults: true
303       testRunTitle: 'gettext-poison'
304       platform: Linux
305       publishRunAttachments: false
306     condition: succeededOrFailed()
307   - task: PublishBuildArtifacts@1
308     displayName: 'Publish trash directories of failed tests'
309     condition: failed()
310     inputs:
311       PathtoPublish: t/failed-test-artifacts
312       ArtifactName: failed-test-artifacts
314 - job: linux32
315   displayName: Linux32
316   condition: succeeded()
317   pool: Hosted Ubuntu 1604
318   steps:
319   - bash: |
320        test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || ci/mount-fileshare.sh //gitfileshare.file.core.windows.net/test-cache gitfileshare "$GITFILESHAREPWD" "$HOME/test-cache" || exit 1
322        res=0
323        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
325        sudo chmod a+r t/out/TEST-*.xml
326        test ! -d t/failed-test-artifacts || sudo chmod a+r t/failed-test-artifacts
328        test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || sudo umount "$HOME/test-cache" || res=1
329        exit $res
330     displayName: 'ci/run-linux32-docker.sh'
331     env:
332       GITFILESHAREPWD: $(gitfileshare.pwd)
333   - task: PublishTestResults@2
334     displayName: 'Publish Test Results **/TEST-*.xml'
335     inputs:
336       mergeTestResults: true
337       testRunTitle: 'linux32'
338       platform: Linux
339       publishRunAttachments: false
340     condition: succeededOrFailed()
341   - task: PublishBuildArtifacts@1
342     displayName: 'Publish trash directories of failed tests'
343     condition: failed()
344     inputs:
345       PathtoPublish: t/failed-test-artifacts
346       ArtifactName: failed-test-artifacts
348 - job: static_analysis
349   displayName: StaticAnalysis
350   condition: succeeded()
351   pool: Hosted Ubuntu 1604
352   steps:
353   - bash: |
354        test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || ci/mount-fileshare.sh //gitfileshare.file.core.windows.net/test-cache gitfileshare "$GITFILESHAREPWD" "$HOME/test-cache" || exit 1
356        sudo apt-get update &&
357        sudo apt-get install -y coccinelle &&
359        export jobname=StaticAnalysis &&
361        ci/run-static-analysis.sh || exit 1
363        test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || sudo umount "$HOME/test-cache" || exit 1
364     displayName: 'ci/run-static-analysis.sh'
365     env:
366       GITFILESHAREPWD: $(gitfileshare.pwd)
368 - job: documentation
369   displayName: Documentation
370   condition: succeeded()
371   pool: Hosted Ubuntu 1604
372   steps:
373   - bash: |
374        test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || ci/mount-fileshare.sh //gitfileshare.file.core.windows.net/test-cache gitfileshare "$GITFILESHAREPWD" "$HOME/test-cache" || exit 1
376        sudo apt-get update &&
377        sudo apt-get install -y asciidoc xmlto asciidoctor &&
379        export ALREADY_HAVE_ASCIIDOCTOR=yes. &&
380        export jobname=Documentation &&
382        ci/test-documentation.sh || exit 1
384        test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || sudo umount "$HOME/test-cache" || exit 1
385     displayName: 'ci/test-documentation.sh'
386     env:
387       GITFILESHAREPWD: $(gitfileshare.pwd)