Skip to content

Commit e5c2d82

Browse files
committed
ci/lib.sh: add support for Azure Pipelines
This patch introduces a conditional arm that defines some environment variables and a function that displays the URL given the job id (to identify previous runs for known-good trees). Because Azure Pipeline's macOS agents already have git-lfs and gettext installed, we can leave `BREW_INSTALL_PACKAGES` empty (unlike in Travis' case). Note: this patch does not introduce an Azure Pipelines definition yet; That is left for the next patch. Signed-off-by: Johannes Schindelin <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 59befa9 commit e5c2d82

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

ci/lib.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,31 @@ then
102102
export GIT_PROVE_OPTS="--timer --jobs 3 --state=failed,slow,save"
103103
export GIT_TEST_OPTS="--verbose-log -x --immediate"
104104
export MAKEFLAGS="--jobs=2"
105+
elif test -n "$SYSTEM_COLLECTIONURI" || test -n "$SYSTEM_TASKDEFINITIONSURI"
106+
then
107+
CI_TYPE=azure-pipelines
108+
# We are running in Azure Pipelines
109+
CI_BRANCH="$BUILD_SOURCEBRANCH"
110+
CI_COMMIT="$BUILD_SOURCEVERSION"
111+
CI_JOB_ID="$BUILD_BUILDID"
112+
CI_JOB_NUMBER="$BUILD_BUILDNUMBER"
113+
CI_OS_NAME="$(echo "$AGENT_OS" | tr A-Z a-z)"
114+
test darwin != "$CI_OS_NAME" || CI_OS_NAME=osx
115+
CI_REPO_SLUG="$(expr "$BUILD_REPOSITORY_URI" : '.*/\([^/]*/[^/]*\)$')"
116+
CC="${CC:-gcc}"
117+
118+
# use a subdirectory of the cache dir (because the file share is shared
119+
# among *all* phases)
120+
cache_dir="$HOME/test-cache/$SYSTEM_PHASENAME"
121+
122+
url_for_job_id () {
123+
echo "$SYSTEM_TASKDEFINITIONSURI$SYSTEM_TEAMPROJECT/_build/results?buildId=$1"
124+
}
125+
126+
BREW_INSTALL_PACKAGES=
127+
export GIT_PROVE_OPTS="--timer --jobs 10 --state=failed,slow,save"
128+
export GIT_TEST_OPTS="--verbose-log -x --write-junit-xml"
129+
export MAKEFLAGS="--jobs=10"
105130
else
106131
echo "Could not identify CI type" >&2
107132
exit 1

ci/print-test-failures.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@ do
4141
case "$CI_TYPE" in
4242
travis)
4343
;;
44+
azure-pipelines)
45+
mkdir -p failed-test-artifacts
46+
mv "$trash_dir" failed-test-artifacts
47+
continue
48+
;;
4449
*)
4550
echo "Unhandled CI type: $CI_TYPE" >&2
4651
exit 1

0 commit comments

Comments
 (0)