Skip to content

Commit 1795fb3

Browse files
committed
Add a build definition for Azure DevOps
This commit adds an azure-pipelines.yml file which is Azure DevOps' equivalent to Travis CI's .travis.yml. The main idea is to replicate the Travis configuration as faithfully as possible, to make it easy to compare the Azure Pipeline builds to the Travis ones (spoiler: some parts, especially the macOS jobs, are way faster in Azure Pileines). Meaning: the number and the order of the jobs added in this commit faithfully replicates what we have in .travis.yml. Note: Our .travis.yml configuration has a Windows part that is *not* replicated in the Azure Pipelines definition. The reason is easy to see: As Travis cannot support our Windws needs (even with the preliminary Windows support that was recently added to Travis after waiting for *years* for that feature, our test suite would simply hit Travis' timeout every single time). To make things a bit easier to understand, we refrain from using the `matrix` feature here because (while it is powerful) it can be a bit confusing to users who are not familiar with CI setups. Therefore, we use a separate phase even for similar configurations (such as GCC vs Clang on Linux, GCC vs Clang on macOS). Also, we make use of the shiny new feature we just introduced where the test suite can output JUnit-style .xml files. This information is made available in a nice UI that allows the viewer to filter by phase and/or test number, and to see trends such as: number of (failing) tests, time spent running the test suite, etc. (While this seemingly contradicts the intention to replicate the Travis configuration as faithfully as possible, it is just too nice to show off that capability here already.) Signed-off-by: Johannes Schindelin <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent e5c2d82 commit 1795fb3

File tree

2 files changed

+284
-0
lines changed

2 files changed

+284
-0
lines changed

azure-pipelines.yml

Lines changed: 259 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,259 @@
1+
resources:
2+
- repo: self
3+
fetchDepth: 1
4+
5+
jobs:
6+
- job: linux_clang
7+
displayName: linux-clang
8+
condition: succeeded()
9+
pool: Hosted Ubuntu 1604
10+
steps:
11+
- bash: |
12+
test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || ci/mount-fileshare.sh //gitfileshare.file.core.windows.net/test-cache gitfileshare "$GITFILESHAREPWD" "$HOME/test-cache" || exit 1
13+
14+
sudo apt-get update &&
15+
sudo apt-get -y install git gcc make libssl-dev libcurl4-openssl-dev libexpat-dev tcl tk gettext git-email zlib1g-dev apache2-bin &&
16+
17+
export CC=clang || exit 1
18+
19+
ci/install-dependencies.sh || exit 1
20+
ci/run-build-and-tests.sh || {
21+
ci/print-test-failures.sh
22+
exit 1
23+
}
24+
25+
test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || sudo umount "$HOME/test-cache" || exit 1
26+
displayName: 'ci/run-build-and-tests.sh'
27+
env:
28+
GITFILESHAREPWD: $(gitfileshare.pwd)
29+
- task: PublishTestResults@2
30+
displayName: 'Publish Test Results **/TEST-*.xml'
31+
inputs:
32+
mergeTestResults: true
33+
testRunTitle: 'linux-clang'
34+
platform: Linux
35+
publishRunAttachments: false
36+
condition: succeededOrFailed()
37+
- task: PublishBuildArtifacts@1
38+
displayName: 'Publish trash directories of failed tests'
39+
condition: failed()
40+
inputs:
41+
PathtoPublish: t/failed-test-artifacts
42+
ArtifactName: failed-test-artifacts
43+
44+
- job: linux_gcc
45+
displayName: linux-gcc
46+
condition: succeeded()
47+
pool: Hosted Ubuntu 1604
48+
steps:
49+
- bash: |
50+
test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || ci/mount-fileshare.sh //gitfileshare.file.core.windows.net/test-cache gitfileshare "$GITFILESHAREPWD" "$HOME/test-cache" || exit 1
51+
52+
sudo add-apt-repository ppa:ubuntu-toolchain-r/test &&
53+
sudo apt-get update &&
54+
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
55+
56+
ci/install-dependencies.sh || exit 1
57+
ci/run-build-and-tests.sh || {
58+
ci/print-test-failures.sh
59+
exit 1
60+
}
61+
62+
test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || sudo umount "$HOME/test-cache" || exit 1
63+
displayName: 'ci/run-build-and-tests.sh'
64+
env:
65+
GITFILESHAREPWD: $(gitfileshare.pwd)
66+
- task: PublishTestResults@2
67+
displayName: 'Publish Test Results **/TEST-*.xml'
68+
inputs:
69+
mergeTestResults: true
70+
testRunTitle: 'linux-gcc'
71+
platform: Linux
72+
publishRunAttachments: false
73+
condition: succeededOrFailed()
74+
- task: PublishBuildArtifacts@1
75+
displayName: 'Publish trash directories of failed tests'
76+
condition: failed()
77+
inputs:
78+
PathtoPublish: t/failed-test-artifacts
79+
ArtifactName: failed-test-artifacts
80+
81+
- job: osx_clang
82+
displayName: osx-clang
83+
condition: succeeded()
84+
pool: Hosted macOS
85+
steps:
86+
- bash: |
87+
test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || ci/mount-fileshare.sh //gitfileshare.file.core.windows.net/test-cache gitfileshare "$GITFILESHAREPWD" "$HOME/test-cache" || exit 1
88+
89+
export CC=clang
90+
91+
ci/install-dependencies.sh || exit 1
92+
ci/run-build-and-tests.sh || {
93+
ci/print-test-failures.sh
94+
exit 1
95+
}
96+
97+
test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || umount "$HOME/test-cache" || exit 1
98+
displayName: 'ci/run-build-and-tests.sh'
99+
env:
100+
GITFILESHAREPWD: $(gitfileshare.pwd)
101+
- task: PublishTestResults@2
102+
displayName: 'Publish Test Results **/TEST-*.xml'
103+
inputs:
104+
mergeTestResults: true
105+
testRunTitle: 'osx-clang'
106+
platform: macOS
107+
publishRunAttachments: false
108+
condition: succeededOrFailed()
109+
- task: PublishBuildArtifacts@1
110+
displayName: 'Publish trash directories of failed tests'
111+
condition: failed()
112+
inputs:
113+
PathtoPublish: t/failed-test-artifacts
114+
ArtifactName: failed-test-artifacts
115+
116+
- job: osx_gcc
117+
displayName: osx-gcc
118+
condition: succeeded()
119+
pool: Hosted macOS
120+
steps:
121+
- bash: |
122+
test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || ci/mount-fileshare.sh //gitfileshare.file.core.windows.net/test-cache gitfileshare "$GITFILESHAREPWD" "$HOME/test-cache" || exit 1
123+
124+
ci/install-dependencies.sh || exit 1
125+
ci/run-build-and-tests.sh || {
126+
ci/print-test-failures.sh
127+
exit 1
128+
}
129+
130+
test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || umount "$HOME/test-cache" || exit 1
131+
displayName: 'ci/run-build-and-tests.sh'
132+
env:
133+
GITFILESHAREPWD: $(gitfileshare.pwd)
134+
- task: PublishTestResults@2
135+
displayName: 'Publish Test Results **/TEST-*.xml'
136+
inputs:
137+
mergeTestResults: true
138+
testRunTitle: 'osx-gcc'
139+
platform: macOS
140+
publishRunAttachments: false
141+
condition: succeededOrFailed()
142+
- task: PublishBuildArtifacts@1
143+
displayName: 'Publish trash directories of failed tests'
144+
condition: failed()
145+
inputs:
146+
PathtoPublish: t/failed-test-artifacts
147+
ArtifactName: failed-test-artifacts
148+
149+
- job: gettext_poison
150+
displayName: GETTEXT_POISON
151+
condition: succeeded()
152+
pool: Hosted Ubuntu 1604
153+
steps:
154+
- bash: |
155+
test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || ci/mount-fileshare.sh //gitfileshare.file.core.windows.net/test-cache gitfileshare "$GITFILESHAREPWD" "$HOME/test-cache" || exit 1
156+
157+
sudo apt-get update &&
158+
sudo apt-get -y install git gcc make libssl-dev libcurl4-openssl-dev libexpat-dev tcl tk gettext git-email zlib1g-dev &&
159+
160+
export jobname=GETTEXT_POISON || exit 1
161+
162+
ci/run-build-and-tests.sh || {
163+
ci/print-test-failures.sh
164+
exit 1
165+
}
166+
167+
test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || sudo umount "$HOME/test-cache" || exit 1
168+
displayName: 'ci/run-build-and-tests.sh'
169+
env:
170+
GITFILESHAREPWD: $(gitfileshare.pwd)
171+
- task: PublishTestResults@2
172+
displayName: 'Publish Test Results **/TEST-*.xml'
173+
inputs:
174+
mergeTestResults: true
175+
testRunTitle: 'gettext-poison'
176+
platform: Linux
177+
publishRunAttachments: false
178+
condition: succeededOrFailed()
179+
- task: PublishBuildArtifacts@1
180+
displayName: 'Publish trash directories of failed tests'
181+
condition: failed()
182+
inputs:
183+
PathtoPublish: t/failed-test-artifacts
184+
ArtifactName: failed-test-artifacts
185+
186+
- job: linux32
187+
displayName: Linux32
188+
condition: succeeded()
189+
pool: Hosted Ubuntu 1604
190+
steps:
191+
- bash: |
192+
test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || ci/mount-fileshare.sh //gitfileshare.file.core.windows.net/test-cache gitfileshare "$GITFILESHAREPWD" "$HOME/test-cache" || exit 1
193+
194+
res=0
195+
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
196+
197+
sudo chmod a+r t/out/TEST-*.xml
198+
test ! -d t/failed-test-artifacts || sudo chmod a+r t/failed-test-artifacts
199+
200+
test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || sudo umount "$HOME/test-cache" || res=1
201+
exit $res
202+
displayName: 'ci/run-linux32-docker.sh'
203+
env:
204+
GITFILESHAREPWD: $(gitfileshare.pwd)
205+
- task: PublishTestResults@2
206+
displayName: 'Publish Test Results **/TEST-*.xml'
207+
inputs:
208+
mergeTestResults: true
209+
testRunTitle: 'linux32'
210+
platform: Linux
211+
publishRunAttachments: false
212+
condition: succeededOrFailed()
213+
- task: PublishBuildArtifacts@1
214+
displayName: 'Publish trash directories of failed tests'
215+
condition: failed()
216+
inputs:
217+
PathtoPublish: t/failed-test-artifacts
218+
ArtifactName: failed-test-artifacts
219+
220+
- job: static_analysis
221+
displayName: StaticAnalysis
222+
condition: succeeded()
223+
pool: Hosted Ubuntu 1604
224+
steps:
225+
- bash: |
226+
test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || ci/mount-fileshare.sh //gitfileshare.file.core.windows.net/test-cache gitfileshare "$GITFILESHAREPWD" "$HOME/test-cache" || exit 1
227+
228+
sudo apt-get update &&
229+
sudo apt-get install -y coccinelle &&
230+
231+
export jobname=StaticAnalysis &&
232+
233+
ci/run-static-analysis.sh || exit 1
234+
235+
test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || sudo umount "$HOME/test-cache" || exit 1
236+
displayName: 'ci/run-static-analysis.sh'
237+
env:
238+
GITFILESHAREPWD: $(gitfileshare.pwd)
239+
240+
- job: documentation
241+
displayName: Documentation
242+
condition: succeeded()
243+
pool: Hosted Ubuntu 1604
244+
steps:
245+
- bash: |
246+
test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || ci/mount-fileshare.sh //gitfileshare.file.core.windows.net/test-cache gitfileshare "$GITFILESHAREPWD" "$HOME/test-cache" || exit 1
247+
248+
sudo apt-get update &&
249+
sudo apt-get install -y asciidoc xmlto asciidoctor &&
250+
251+
export ALREADY_HAVE_ASCIIDOCTOR=yes. &&
252+
export jobname=Documentation &&
253+
254+
ci/test-documentation.sh || exit 1
255+
256+
test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || sudo umount "$HOME/test-cache" || exit 1
257+
displayName: 'ci/test-documentation.sh'
258+
env:
259+
GITFILESHAREPWD: $(gitfileshare.pwd)

ci/mount-fileshare.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/bin/sh
2+
3+
die () {
4+
echo "$*" >&2
5+
exit 1
6+
}
7+
8+
test $# = 4 ||
9+
die "Usage: $0 <share> <username> <password> <mountpoint>"
10+
11+
mkdir -p "$4" || die "Could not create $4"
12+
13+
case "$(uname -s)" in
14+
Linux)
15+
sudo mount -t cifs -o vers=3.0,username="$2",password="$3",dir_mode=0777,file_mode=0777,serverino "$1" "$4"
16+
;;
17+
Darwin)
18+
pass="$(echo "$3" | sed -e 's/\//%2F/g' -e 's/+/%2B/g')" &&
19+
mount -t smbfs,soft "smb://$2:$pass@${1#//}" "$4"
20+
;;
21+
*)
22+
die "No support for $(uname -s)"
23+
;;
24+
esac ||
25+
die "Could not mount $4"

0 commit comments

Comments
 (0)