pipeline { agent { label 'linux' } parameters { booleanParam( name: 'RELEASE', description: 'Enable to create a new release on GitHub and DigitalOcean Space.', defaultValue: false, ) } options { disableConcurrentBuilds() /* Go requires a certain directory structure */ checkoutToSubdirectory('src/github.com/status-im/status-go') /* manage how many builds we keep */ buildDiscarder(logRotator( numToKeepStr: '30', daysToKeepStr: '30', )) } environment { STATUS_PATH = 'src/github.com/status-im/status-go' GOPATH = "${env.WORKSPACE}" PATH = "${env.PATH}:${env.GOPATH}/bin" } stages { stage('Prep') { steps { script { lib = load("${env.STATUS_PATH}/_assets/ci/lib.groovy") println("Git Branch: ${lib.gitBranch()}") println("Git Commit: ${lib.gitCommit()}") } } } stage('Setup') { steps { dir(env.STATUS_PATH) { sh 'make setup' sh 'make xgo' } } } stage('Lint') { steps { dir(env.STATUS_PATH) { sh 'make ci' } } } stage('Build') { parallel { stage('Android') { stages { stage('Compile') { steps { dir(env.STATUS_PATH) { sh 'make statusgo-android' } } } stage('Archive') { steps { sh """ cp ${env.STATUS_PATH}/build/bin/statusgo-android-16.aar \ ${env.WORKSPACE}/status-go-android-${lib.suffix()}.aar """ archiveArtifacts("status-go-android-${lib.suffix()}.aar") } } stage('Upload') { steps { script { lib.uploadArtifact("status-go-android-${lib.suffix()}.aar") } } } stage('Cleanup') { steps { script { sh "rm -f ${env.WORKSPACE}/*.aar" } } } } } stage('iOS') { stages { stage('Compile') { steps { dir(env.STATUS_PATH) { sh 'make statusgo-ios-simulator' dir('build/bin/statusgo-ios-9.3-framework') { sh 'zip -r status-go-ios.zip Statusgo.framework' } } } } stage('Archive') { steps { sh """ cp ${env.STATUS_PATH}/build/bin/statusgo-ios-9.3-framework/status-go-ios.zip \ ${env.WORKSPACE}/status-go-ios-${lib.suffix()}.zip """ archiveArtifacts("status-go-ios-${lib.suffix()}.zip") } } stage('Upload') { steps { script { lib.uploadArtifact("status-go-ios-${lib.suffix()}.zip") } } } stage('Cleanup') { steps { script { sh "rm -f ${env.WORKSPACE}/*.zip" } } } } } } } stage('Release') { when { expression { params.RELEASE == true } } steps { dir(env.STATUS_PATH) { sh 'make prepare-release' withCredentials([[ $class: 'UsernamePasswordMultiBinding', credentialsId: 'status-im-auto', usernameVariable: 'GITHUB_USER', passwordVariable: 'GITHUB_TOKEN' ]]) { sh "yes | make release RELEASE_BRANCH=${lib.gitBranch()}" } sh 'make clean-release' } } } } }