Skip to content

Commit

Permalink
Add an optional arm64-macOS (M1) job that runs on PRs. (#9430)
Browse files Browse the repository at this point in the history
* Add an optional arm64-macOS (M1) job that runs on PRs.

  - This can be enabled by setting the label:
    `CI/CMake/Enable/macOS`

  - Change the label `CI/Skip CMake build` to `CI/CMake/Disable/All`
    Setting this label disables all CMake builds. At the moment these are
      - building on x86-64 ubuntu (bionic)
      - building on arm64 macOS (even when `CI/CMake/Enable/macOS` is set)

* Remove the old non-functional osx CI job.

* Remove the non-functional CentOS7 job.
  • Loading branch information
mahge committed Sep 26, 2022
1 parent d85e729 commit 9f60c80
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 88 deletions.
21 changes: 6 additions & 15 deletions .CI/common.groovy
Expand Up @@ -489,15 +489,6 @@ def makeCommand() {
return env.GMAKE ?: "make"
}

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

def shouldWeBuildMINGW() {
if (isPR()) {
if (pullRequest.labels.contains("CI/Build MINGW")) {
Expand All @@ -507,22 +498,22 @@ def shouldWeBuildMINGW() {
return params.BUILD_MINGW
}

def shouldWeBuildCENTOS7() {
def shouldWeDisableAllCMakeBuilds() {
if (isPR()) {
if (pullRequest.labels.contains("CI/Build CentOS")) {
if (pullRequest.labels.contains("CI/CMake/Disable/All")) {
return true
}
}
return params.BUILD_CENTOS7
return params.DISABLE_ALL_CMAKE_BUILDS
}

def shouldWeSkipCMakeBuild() {
def shouldWeEnableMacOSCMakeBuild() {
if (isPR()) {
if (pullRequest.labels.contains("CI/Skip CMake Build")) {
if (pullRequest.labels.contains("CI/CMake/Enable/macOS")) {
return true
}
}
return params.SKIP_CMAKE_BUILD
return params.ENABLE_MACOS_CMAKE_BUILD
}

def shouldWeRunTests() {
Expand Down
106 changes: 33 additions & 73 deletions Jenkinsfile
@@ -1,8 +1,7 @@
def common
def shouldWeBuildOSX
def shouldWeBuildMINGW
def shouldWeBuildCENTOS7
def shouldWeSkipCMakeBuild_value
def shouldWeDisableAllCMakeBuilds_value
def shouldWeEnableMacOSCMakeBuild_value
def shouldWeRunTests
def isPR
pipeline {
Expand All @@ -15,10 +14,9 @@ pipeline {
LC_ALL = 'C.UTF-8'
}
parameters {
booleanParam(name: 'BUILD_OSX', defaultValue: false, description: 'Build with OSX')
booleanParam(name: 'BUILD_MINGW', defaultValue: false, description: 'Build with Win/MinGW')
booleanParam(name: 'BUILD_CENTOS7', defaultValue: false, description: 'Build on CentOS7 with CMake 2.8')
booleanParam(name: 'SKIP_CMAKE_BUILD', defaultValue: false, description: 'Skip building omc with the CMake build system (CMake 3.17.2)')
booleanParam(name: 'DISABLE_ALL_CMAKE_BUILDS', defaultValue: false, description: 'Skip building omc with CMake (CMake 3.17.2) on all platforms')
booleanParam(name: 'ENABLE_MACOS_CMAKE_BUILD', defaultValue: false, description: 'Skip building omc with CMake on macOS')
}
// stages are ordered according to execution time; highest time first
// nodes are selected based on a priority (in Jenkins config)
Expand All @@ -37,14 +35,12 @@ pipeline {
common = load("${env.workspace}/.CI/common.groovy")
isPR = common.isPR()
print "isPR: ${isPR}"
shouldWeBuildOSX = common.shouldWeBuildOSX()
print "shouldWeBuildOSX: ${shouldWeBuildOSX}"
shouldWeBuildMINGW = common.shouldWeBuildMINGW()
print "shouldWeBuildMINGW: ${shouldWeBuildMINGW}"
shouldWeBuildCENTOS7 = common.shouldWeBuildCENTOS7()
print "shouldWeBuildCENTOS7: ${shouldWeBuildCENTOS7}"
shouldWeSkipCMakeBuild_value = common.shouldWeSkipCMakeBuild()
print "shouldWeSkipCMakeBuild: ${shouldWeSkipCMakeBuild_value}"
shouldWeDisableAllCMakeBuilds_value = common.shouldWeDisableAllCMakeBuilds()
print "shouldWeDisableAllCMakeBuilds: ${shouldWeDisableAllCMakeBuilds_value}"
shouldWeEnableMacOSCMakeBuild_value = common.shouldWeEnableMacOSCMakeBuild()
print "shouldWeEnableMacOSCMakeBuild: ${shouldWeEnableMacOSCMakeBuild_value}"
shouldWeRunTests = common.shouldWeRunTests()
print "shouldWeRunTests: ${shouldWeRunTests}"
}
Expand Down Expand Up @@ -91,41 +87,6 @@ pipeline {
stash name: 'omc-clang', includes: 'build/**, **/config.status'
}
}
stage('MacOS') {
agent {
node {
label 'osx'
}
}
when {
beforeAgent true
expression { shouldWeBuildOSX }
}
environment {
RUNTESTDB = '/Users/hudson/jenkins-cache/runtest/'
LIBRARIES = '/Users/hudson/jenkins-cache/omlibrary'
GMAKE = 'gmake'
LC_ALL = 'C'
}
steps {
script {
// Qt5 is MacOS 10.12+...
withEnv (["PATH=${env.MACPORTS}/bin:${env.PATH}:/usr/local/bin/", "QTDIR=${env.MACPORTS}/libexec/qt4"]) {
sh "echo PATH: \$PATH QTDIR: \$QTDIR"
sh "${env.GMAKE} --version"
common.buildOMC('cc', 'c++', "OMPCC='gcc-mp-5 -fopenmp -mno-avx' GNUCXX=g++-mp-5 FC=gfortran-mp-5 LDFLAGS=-L${env.MACPORTS}/lib CPPFLAGS=-I${env.MACPORTS}/include --without-omlibrary", true, false)
common.buildGUI('', false)
sh label: "All dylibs and their deps in build/", script: 'find build/ -name "*.dylib" -exec otool -L {} ";"'
sh label: "Look for relative paths in dylibs", script: '! ( find build/ -name "*.dylib" -exec otool -L {} ";" | tr -d "\t" | grep -v : | grep -v "^[/@]" )'
sh label: "All executables and therir deps in build/bin", script: 'find build/bin -type f -exec otool -L {} ";"'
sh label: "Look for relative paths in bin folder", script: '! ( find build/bin -type f -exec otool -L {} ";" | tr -d "\t" | grep -v : | grep -v "^[/@]" )'
// TODO: OMCppOSUSimulation throws error for help display
//sh label: "Sanity check for Cpp runtime", script: "./build/bin/OMCppOSUSimulation --help"
sh label: "Sanity check for OMEdit", script: "./build/Applications/OMEdit.app/Contents/MacOS/OMEdit --help"
}
}
}
}
stage('Win/MinGW') {
agent {
node {
Expand Down Expand Up @@ -153,55 +114,54 @@ pipeline {
}
}
}
stage('CentOS7') {
stage('cmake-bionic-gcc') {
agent {
dockerfile {
additionalBuildArgs '--pull'
dir '.CI/cache-centos7'
dir '.CI/cache-bionic-cmake-3.17.2'
label 'linux'
args "-v /var/lib/jenkins/gitcache:/var/lib/jenkins/gitcache"
args "--mount type=volume,source=omlibrary-cache,target=/cache/omlibrary " +
"-v /var/lib/jenkins/gitcache:/var/lib/jenkins/gitcache"
}
}
when {
beforeAgent true
expression { shouldWeBuildCENTOS7 }
}
environment {
QTDIR = "/usr/lib64/qt5/"
expression { !shouldWeDisableAllCMakeBuilds_value }
}
steps {
sh "source /opt/rh/devtoolset-8/enable"
script {
common.buildOMC(
'/opt/rh/devtoolset-8/root/usr/bin/gcc',
'/opt/rh/devtoolset-8/root/usr/bin/g++',
'FC=/opt/rh/devtoolset-8/root/usr/bin/gfortran CMAKE=cmake3',
false, // Building C++ runtime doesn't work at the moment
false)
echo "Running on: ${env.NODE_NAME}"
common.buildOMC_CMake('-DCMAKE_BUILD_TYPE=Release -DOM_USE_CCACHE=OFF -DCMAKE_INSTALL_PREFIX=build', '/opt/cmake-3.17.2/bin/cmake')
sh "build/bin/omc --version"
}
//stash name: 'omc-centos7', includes: 'build/**, **/config.status'
// stash name: 'omc-cmake-gcc', includes: 'OMCompiler/build_cmake/install_cmake/bin/**'
}
}
stage('cmake-gcc') {
stage('cmake-macos-arm64-gcc') {
agent {
dockerfile {
additionalBuildArgs '--pull'
dir '.CI/cache-bionic-cmake-3.17.2'
label 'linux'
args "--mount type=volume,source=omlibrary-cache,target=/cache/omlibrary " +
"-v /var/lib/jenkins/gitcache:/var/lib/jenkins/gitcache"
node {
label 'M1'
}
}
when {
beforeAgent true
expression { !shouldWeSkipCMakeBuild_value }
expression { !shouldWeDisableAllCMakeBuilds_value && shouldWeEnableMacOSCMakeBuild_value}
}
steps {
script {
common.buildOMC_CMake('-DCMAKE_BUILD_TYPE=Release -DOM_USE_CCACHE=OFF -DCMAKE_INSTALL_PREFIX=build', '/opt/cmake-3.17.2/bin/cmake')
sh "build/bin/omc --version"
echo "Running on: ${env.NODE_NAME}"
withEnv (["PATH=/opt/homebrew/bin:/opt/homebrew/opt/openjdk/bin:/usr/local/bin:${env.PATH}"]) {
sh "echo PATH: $PATH"
common.buildOMC_CMake("-DCMAKE_BUILD_TYPE=Release" +
" -DOM_USE_CCACHE=OFF" +
" -DCMAKE_INSTALL_PREFIX=build" +
" -DOM_OMC_ENABLE_FORTRAN=OFF" +
" -DOM_OMC_ENABLE_IPOPT=OFF" +
" -DOM_OMC_ENABLE_CPP_RUNTIME=OFF"
)
sh "build/bin/omc --version"
}
}
// stash name: 'omc-cmake-gcc', includes: 'OMCompiler/build_cmake/install_cmake/bin/**'
}
}
stage('checks') {
Expand Down

0 comments on commit 9f60c80

Please sign in to comment.