pipeline { agent { label 'linux' } parameters { string( name: 'BRANCH', defaultValue: 'develop', description: 'Name of branch to build.' ) booleanParam( name: 'RELEASE', defaultValue: false, description: 'Enable to create a new release on GitHub and DigitalOcean Space.', ) } 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 = "${env.WORKSPACE}/src/github.com/status-im/status-go" CI_DIR = "${env.STATUS_PATH}/_assets/ci" GOPATH = "${env.WORKSPACE}" PATH = "/usr/local/go/bin:${env.PATH}:${env.GOPATH}/bin" /* This will override the var in Makefile */ RELEASE_DIR = "${env.WORKSPACE}/out" } stages { stage('Prep') { steps { script { lib = load("${env.STATUS_PATH}/_assets/ci/lib.groovy") version = lib.getVersion() println("Version: ${version}") println("Git Branch: ${lib.gitBranch()}") println("Git Commit: ${lib.gitCommit()}") } } } // stage(Prep) stage('Setup') { steps { dir(env.STATUS_PATH) { /* install release tools */ sh 'make release-install' } } } // stage(Setup) stage('Build') { parallel { stage('iOS') { steps { script { ios = lib.buildBranch('status-go/platforms/ios') } } } stage('Android') { steps { script { android = lib.buildBranch('status-go/platforms/android') } } } stage('Linux') { steps { script { linux = lib.buildBranch('status-go/platforms/linux') } } } stage('Docker') { steps { script { dock = lib.buildBranch('status-go/platforms/docker') } } } stage('XGO') { steps { script { xgo = lib.buildBranch('status-go/platforms/xgo') } } } } // parallel } // stage(Build) stage('Archive') { steps { script { sh("rm -fr ${env.RELEASE_DIR}/*") [ios, android, linux, xgo].each { platformBuild -> lib.copyArts(platformBuild) } dir(env.RELEASE_DIR) { /* generate sha256 checksums for upload */ sh 'sha256sum * | tee checksum.sha256' archiveArtifacts('*') } } } } // stage(Archive) stage('Release') { when { expression { params.RELEASE == true } } steps { script { def suffix = "-"+lib.suffix() /* rename build files to not include versions */ dir(env.RELEASE_DIR) { findFiles(glob: 'status-go-*').each { pkg -> sh "mv ${pkg.path} ${pkg.path.replace(suffix, "")}" } } /* perform the release */ dir(env.STATUS_PATH) { withCredentials([[ $class: 'UsernamePasswordMultiBinding', credentialsId: 'status-im-auto', usernameVariable: 'GITHUB_USER', passwordVariable: 'GITHUB_TOKEN' ]]) { env.RELEASE_BRANCH = lib.gitBranch() env.RELEASE_DIR = env.RELEASE_DIR sh 'yes | make release' } } } } } // stage(Release) } // stages post { always { dir(env.STATUS_PATH) { sh 'make clean-release' } } } }