Files
status-go/_assets/ci/Jenkinsfile.android

99 lines
2.4 KiB
Groovy

#!/usr/bin/env groovy
library 'status-jenkins-lib@v1.9.39'
pipeline {
agent {
docker {
label 'linuxcontainer'
image 'harbor.status.im/infra/ci-build-containers:linux-base-1.0.0'
dir '_assets/ci/'
args '--volume=/nix:/nix ' +
'--volume=/etc/nix:/etc/nix '
}
}
parameters {
string(
name: 'BRANCH',
defaultValue: 'develop',
description: 'Name of branch to build.'
)
booleanParam(
name: 'RELEASE',
defaultValue: false,
description: 'Enable to create build for release.',
)
}
options {
timestamps()
ansiColor('xterm')
/* Prevent Jenkins jobs from running forever */
timeout(time: 15, unit: 'MINUTES')
disableConcurrentBuilds()
disableRestartFromStage()
/* manage how many builds we keep */
buildDiscarder(logRotator(
numToKeepStr: '5',
daysToKeepStr: '30',
artifactNumToKeepStr: '1',
artifactDaysToKeepStr: '30',
))
}
environment {
PLATFORM = "android"
EXT = "so"
TMPDIR = "${WORKSPACE_TMP}"
GOPATH = "${WORKSPACE_TMP}/go"
GOCACHE = "${WORKSPACE_TMP}/gocache"
PATH = "${PATH}:${GOPATH}/bin"
REPO_SRC = "${GOPATH}/src/github.com/status-im/status-go"
VERSION = sh(script: "./scripts/version.sh", returnStdout: true)
ARTIFACT = utils.pkgFilename(
name: 'status-go',
type: env.PLATFORM,
version: env.VERSION,
ext: env.EXT
)
/* prevent sharing cache dir across different jobs */
GO_GENERATE_FAST_DIR = "${env.WORKSPACE_TMP}/go-generate-fast"
}
stages {
stage('Setup') {
steps { /* Go needs to find status-go in GOPATH. */
sh "mkdir -p \$(dirname ${REPO_SRC})"
sh "ln -s ${WORKSPACE} ${REPO_SRC}"
}
}
stage('Compile') {
steps { script {
nix.develop("make statusgo-${env.PLATFORM}-library", pure: false, sandbox: true)
sh "mv build/bin/libstatus.${env.EXT} ${ARTIFACT}"
} }
}
stage('Archive') {
steps { script {
archiveArtifacts(ARTIFACT)
} }
}
stage('Upload') {
steps { script {
env.PKG_URL = s5cmd.upload(ARTIFACT)
} }
}
} // stages
post {
success { script { github.notifyPR(true) } }
failure { script { github.notifyPR(false) } }
cleanup {
cleanWs()
dir(env.WORKSPACE_TMP) { deleteDir() }
}
} // post
} // pipeline