github.com/status-im/status-go@v1.1.0/_assets/ci/Jenkinsfile (about)

     1  #!/usr/bin/env groovy
     2  library 'status-jenkins-lib@v1.9.6'
     3  
     4  pipeline {
     5    agent { label 'linux' }
     6  
     7    parameters {
     8      string(
     9        name: 'BRANCH',
    10        defaultValue: 'develop',
    11        description: 'Name of branch to build.'
    12      )
    13      booleanParam(
    14        name: 'RELEASE',
    15        defaultValue: false,
    16        description: 'Enable to create a new release on GitHub and DigitalOcean Space.',
    17      )
    18    }
    19  
    20    options {
    21      /* Prevent Jenkins jobs from running forever */
    22      timeout(time: 40, unit: 'MINUTES')
    23      ansiColor('xterm')
    24      disableConcurrentBuilds()
    25      /* Go requires a certain directory structure */
    26      checkoutToSubdirectory('src/github.com/status-im/status-go')
    27      /* manage how many builds we keep */
    28      buildDiscarder(logRotator(
    29        numToKeepStr: '5',
    30        daysToKeepStr: '30',
    31        artifactNumToKeepStr: '1',
    32      ))
    33    }
    34  
    35    environment {
    36      REPO   = "${env.WORKSPACE}/src/github.com/status-im/status-go"
    37      GOPATH = "${env.WORKSPACE}"
    38      PATH   = "/usr/local/go/bin:${env.PATH}:${env.GOPATH}/bin"
    39      /* This will override the var in Makefile */
    40      RELEASE_DIR = "${env.WORKSPACE}/pkg"
    41    }
    42  
    43    stages {
    44      stage('Build') {
    45        parallel {
    46          stage('iOS') { steps { script {
    47            ios = jenkins.Build('status-go/platforms/ios')
    48          } } }
    49          stage('Android') { steps { script {
    50            android = jenkins.Build('status-go/platforms/android')
    51          } } }
    52          stage('Linux') { steps { script {
    53            linux = jenkins.Build('status-go/platforms/linux')
    54          } } }
    55          stage('Docker') { steps { script {
    56            dock = jenkins.Build('status-go/platforms/docker')
    57          } } }
    58        } // parallel
    59      } // stage(Build)
    60  
    61      stage('Archive') {
    62        steps { script {
    63          sh "rm -fr ${env.RELEASE_DIR}"
    64          sh "mkdir ${env.RELEASE_DIR}"
    65          [ios, android, linux].each { platformBuild ->
    66            jenkins.copyArts(platformBuild)
    67          }
    68          dir(env.RELEASE_DIR) {
    69            /* generate sha256 checksums for upload */
    70            sh 'sha256sum * | tee checksum.sha256'
    71            archiveArtifacts('*')
    72          }
    73        } }
    74      } // stage(Archive)
    75  
    76      stage('Release') {
    77        when { expression { params.RELEASE == true } }
    78        steps { script {
    79          dir (env.REPO) { version = utils.getVersion() }
    80          github.publishReleaseFiles(
    81            repo: 'status-go',
    82            version: version,
    83            desc: ':warning: Fill me in!',
    84         )
    85        } }
    86      } // stage(Release)
    87    } // stages
    88  
    89    post {
    90      always { dir(env.REPO) {
    91        sh 'make clean-release'
    92      } }
    93    }
    94  }