1 isPr
= (env
.ghprbPullId
&& !env
.ghprbPullId
.empty ?
true : false)
2 monoBranch
= (isPr ?
"pr" : env
.BRANCH_NAME
)
3 jobName
= env
.JOB_NAME
.split('/').first()
5 if (monoBranch
== 'master') {
6 properties([ /* compressBuildLog() */ // compression is incompatible with JEP-210 right now
7 pipelineTriggers([cron('0 3 * * *')])
10 // multi-branch pipelines still get triggered for each commit, skip these builds on master by checking whether this build was timer-triggered
11 if (currentBuild
.getBuildCauses('hudson.triggers.TimerTrigger$TimerTriggerCause').size() == 0) {
12 echo
"Skipping per-commit build on master."
18 "Android Darwin (Debug)": {
19 throttle(['provisions-android-toolchain']) {
20 node ("osx-devices") {
21 archive ("android", "debug", "Darwin")
25 "Android Darwin (Release)": {
26 throttle(['provisions-android-toolchain']) {
27 node ("osx-devices") {
28 archive ("android", "release", "Darwin")
32 "Android Windows (Release)": {
33 throttle(['provisions-android-toolchain']) {
35 archive ("android", "release", "Windows")
39 "Android Linux (Debug)": {
40 throttle(['provisions-android-toolchain']) {
41 node ("debian-10-amd64-exclusive") {
42 archive ("android", "debug", "Linux", "debian-10-amd64multiarchi386-preview", "g++-mingw-w64 gcc-mingw-w64 lib32stdc++6 lib32z1 libz-mingw-w64-dev linux-libc-dev:i386 zlib1g-dev zlib1g-dev:i386 zulu-8 rsync python3-pip", "/mnt/scratch")
46 "Android Linux (Release)": {
47 throttle(['provisions-android-toolchain']) {
48 node ("debian-10-amd64-exclusive") {
49 archive ("android", "release", "Linux", "debian-10-amd64multiarchi386-preview", "g++-mingw-w64 gcc-mingw-w64 lib32stdc++6 lib32z1 libz-mingw-w64-dev linux-libc-dev:i386 zlib1g-dev zlib1g-dev:i386 zulu-8 rsync python3-pip", "/mnt/scratch")
54 throttle(['provisions-ios-toolchain']) {
56 archive ("ios", "release", "Darwin", "", "", "", "xcode111")
61 throttle(['provisions-mac-toolchain']) {
63 archive ("mac", "release", "Darwin", "", "", "", "xcode111")
68 throttle(['provisions-wasm-toolchain']) {
69 node ("ubuntu-1804-amd64") {
70 archive ("wasm", "release", "Linux", "ubuntu-1804-amd64-preview", "npm dotnet-sdk-2.1 nuget openjdk-8-jre python3-pip")
76 def
archive (product
, configuration
, platform
, chrootname
= "", chrootadditionalpackages
= "", chrootBindMounts
= "", xcodeVersion
= "") {
77 def packageFileName
= null
78 def packageFileSha1
= null
80 def commitContext
= (xcodeVersion
== "" ?
"Archive-${product}-${configuration}-${platform}" : "Archive-${product}-${configuration}-${platform}-${xcodeVersion}")
81 def azureArtifactUrl
= null
82 def azureContainerName
= "mono-sdks"
83 def azureVirtualPath
= null
86 ws ("workspace/${jobName}/${monoBranch}/${product}/${configuration}") {
89 echo
"Running on ${env.NODE_NAME}"
91 // clone and checkout repo
94 utils
= load
"scripts/ci/pipeline/utils.groovy"
97 sh
'git reset --hard HEAD'
98 // homebrew Git 2.22.0 misparses the submodule command and passes arguments like --hard and -xdff
99 // to git-submodule instead of to git-reset or git-clean. Passing the entire command as a single
100 // argument seems to help.
101 sh
'git submodule foreach --recursive "git reset --hard HEAD"'
103 sh
'git submodule foreach --recursive "git clean -xdff"'
105 // get current commit sha
106 commitHash
= sh (script
: 'git rev-parse HEAD', returnStdout
: true).trim()
107 currentBuild
.displayName
= "${commitHash.substring(0,7)}"
111 utils
.reportGitHubStatus (isPr ? env
.ghprbActualCommit
: commitHash
, commitContext
, env
.BUILD_URL
, 'PENDING', 'Building...')
114 timeout (time
: 300, unit
: 'MINUTES') {
115 if (platform
== "Darwin") {
116 def brewpackages
= "autoconf automake ccache cmake coreutils gdk-pixbuf gettext glib gnu-sed gnu-tar intltool ios-deploy jpeg libffi libidn2 libpng libtiff libtool libunistring ninja openssl p7zip pcre pkg-config scons wget xz mingw-w64 make xamarin/xamarin-android-windeps/mingw-zlib"
117 sh
"brew tap xamarin/xamarin-android-windeps"
118 sh
"brew install ${brewpackages} || brew upgrade ${brewpackages}"
119 sh
"CI_TAGS=sdks-${product},no-tests,${configuration},${xcodeVersion} scripts/ci/run-jenkins.sh"
120 } else if (platform
== "Linux") {
121 chroot chrootName
: chrootname
,
122 command
: "CI_TAGS=sdks-${product},no-tests,${configuration} ANDROID_TOOLCHAIN_DIR=/mnt/scratch/android-toolchain ANDROID_TOOLCHAIN_CACHE_DIR=/mnt/scratch/android-archives scripts/ci/run-jenkins.sh",
123 bindMounts
: chrootBindMounts
,
124 additionalPackages
: "xvfb xauth mono-devel git python wget bc build-essential libtool autoconf automake gettext iputils-ping cmake lsof libkrb5-dev curl p7zip-full ninja-build zip unzip gcc-multilib g++-multilib mingw-w64 binutils-mingw-w64 ${chrootadditionalpackages}"
125 } else if (platform
== "Windows") {
126 sh
"PATH=\"/usr/bin:/usr/local/bin:$PATH\" CI_TAGS=sdks-${product},win-amd64,no-tests,${configuration},${xcodeVersion} scripts/ci/run-jenkins.sh"
128 throw new Exception("Unknown platform \"${platform}\"")
131 // find Archive in the workspace root
132 packageFileName
= findFiles (glob
: "${product}-${configuration}-${platform}-${commitHash}.*")[0].name
134 // compute SHA1 of the Archive
135 packageFileSha1
= sha1 (packageFileName
)
136 writeFile (file
: "${packageFileName}.sha1", text
: "${packageFileSha1}")
138 // include xcode version in virtual path if necessary
139 if (xcodeVersion
== "") {
140 azureVirtualPath
= ""
141 azureArtifactUrl
= "https://xamjenkinsartifact.azureedge.net/${azureContainerName}/${packageFileName}"
143 azureVirtualPath
= "xcode-" + readFile ("xcode_version.txt")
144 azureArtifactUrl
= "https://xamjenkinsartifact.azureedge.net/${azureContainerName}/${azureVirtualPath}/${packageFileName}"
147 stage('Upload Archive to Azure') {
148 azureUpload(storageCredentialId
: "fbd29020e8166fbede5518e038544343",
149 storageType
: "blobstorage",
150 containerName
: azureContainerName
,
151 virtualPath
: azureVirtualPath
,
152 filesPath
: "${packageFileName},${packageFileName}.sha1",
153 allowAnonymousAccess
: true,
155 doNotWaitForPreviousBuild
: true,
156 uploadArtifactsOnlyIfSuccessful
: true)
161 utils
.reportGitHubStatus (isPr ? env
.ghprbActualCommit
: commitHash
, commitContext
, azureArtifactUrl
, 'SUCCESS', packageFileName
)
163 catch (Exception e
) {
164 utils
.reportGitHubStatus (isPr ? env
.ghprbActualCommit
: commitHash
, commitContext
, env
.BUILD_URL
, 'FAILURE', "Build failed.")