Skip to content

Commit

Permalink
Use a label for MINGW/OSX builds in PR
Browse files Browse the repository at this point in the history
By setting the label CI/Build OSX (or MINGW), Jenkins will now build
this PR also with the selected target(s). Useful if you do not have
access to a Mac machine and want to make sure you don't break it.
  • Loading branch information
sjoelund committed Jun 10, 2019
1 parent a2e86cd commit 08bda24
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 12 deletions.
30 changes: 26 additions & 4 deletions .CI/common.groovy
Expand Up @@ -20,7 +20,7 @@ def numPhysicalCPU() {
if (env.JENKINS_NUM_PHYSICAL_CPU) {
return env.JENKINS_NUM_PHYSICAL_CPU
}

if (isWindows())
{
return env.NUMBER_OF_PROCESSORS.toInteger() / 2 ?: 1
Expand Down Expand Up @@ -98,7 +98,7 @@ void partest(cache=true, extraArgs='') {
} else {
sh "rm -f omc-diff.skip && ${makeCommand()} -C testsuite/difftool clean && ${makeCommand()} --output-sync -C testsuite/difftool"
sh 'build/bin/omc-diff -v1.4'

sh ("""#!/bin/bash -x
ulimit -t 1500
ulimit -v 6291456 # Max 6GB per process
Expand Down Expand Up @@ -180,7 +180,7 @@ void buildOMC(CC, CXX, extraFlags) {
) > buildOMCWindows.sh
set MSYSTEM=MINGW64
set MSYS2_PATH_TYPE=inherit
set MSYS2_PATH_TYPE=inherit
%OMDEV%\\tools\\msys\\usr\\bin\\sh --login -i -c "cd `cygpath ' ${WORKSPACE} '` && chmod +x buildOMCWindows.sh && ./buildOMCWindows.sh && rm -f ./buildOMCWindows.sh"
""")
} else {
Expand Down Expand Up @@ -209,7 +209,7 @@ void buildGUI(stash) {
) > buildGUIWindows.sh
set MSYSTEM=MINGW64
set MSYS2_PATH_TYPE=inherit
set MSYS2_PATH_TYPE=inherit
%OMDEV%\\tools\\msys\\usr\\bin\\sh --login -i -c "cd `cygpath ' ${WORKSPACE} '` && chmod +x buildGUIWindows.sh && ./buildGUIWindows.sh && rm -f ./buildGUIWindows.sh"
""")
} else {
Expand Down Expand Up @@ -284,4 +284,26 @@ def makeCommand() {
return env.GMAKE ?: "make"
}

def shouldWeBuildOSX() {
if (env.CHANGE_ID) {
if (pullRequest.labels.contains("CI/Build OSX")) {
return true
}
}
return params.BUILD_OSX
}

def shouldWeBuildMINGW() {
if (env.CHANGE_ID) {
if (pullRequest.labels.contains("CI/Build MINGW")) {
return true
}
}
return params.BUILD_MINGW
}

def isPR() {
return env.CHANGE_ID ? true : false
}

return this
26 changes: 18 additions & 8 deletions Jenkinsfile
@@ -1,4 +1,7 @@
def common
def shouldWeBuildOSX
def shouldWeBuildMINGW
def isPR
pipeline {
agent none
options {
Expand All @@ -24,8 +27,15 @@ pipeline {
def buildNumber = env.BUILD_NUMBER as int
if (buildNumber > 1) milestone(buildNumber - 1)
milestone(buildNumber)
isPR = true
} else {
isPR = false
}
common = load("${env.workspace}/.CI/common.groovy")
shouldWeBuildOSX = common.shouldWeBuildOSX()
print "shouldWeBuildOSX: ${shouldWeBuildOSX}"
shouldWeBuildMINGW = common.shouldWeBuildMINGW()
print "shouldWeBuildMINGW: ${shouldWeBuildMINGW}"
}
}
}
Expand Down Expand Up @@ -68,7 +78,8 @@ pipeline {
}
}
when {
expression { params.BUILD_OSX }
beforeAgent true
expression { shouldWeBuildOSX }
}
environment {
RUNTESTDB = '/Users/hudson/jenkins-cache/runtest/'
Expand All @@ -94,7 +105,8 @@ pipeline {
}
}
when {
expression { params.BUILD_MINGW }
beforeAgent true
expression { shouldWeBuildMINGW }
}
environment {
RUNTESTDB = '/c/dev/'
Expand Down Expand Up @@ -486,9 +498,8 @@ pipeline {
}
}
when {
not {
changeRequest()
}
beforeAgent true
expression { not isPR }
}
steps {
unstash 'compliance'
Expand All @@ -505,9 +516,8 @@ pipeline {
}
}
when {
not {
changeRequest()
}
beforeAgent true
expression { not isPR }
}
steps {
unstash 'usersguide'
Expand Down

0 comments on commit 08bda24

Please sign in to comment.