2020-07-02 17:04:35 +00:00
|
|
|
library 'status-react-jenkins@v1.1.9'
|
2020-03-06 15:43:04 +00:00
|
|
|
|
2018-08-14 18:09:52 +00:00
|
|
|
pipeline {
|
2019-04-11 18:03:36 +00:00
|
|
|
agent { label 'linux' }
|
2018-08-14 18:09:52 +00:00
|
|
|
|
2018-12-11 11:00:22 +00:00
|
|
|
parameters {
|
2018-12-11 14:27:21 +00:00
|
|
|
string(
|
2018-12-11 11:00:22 +00:00
|
|
|
name: 'BUILD_TYPE',
|
|
|
|
description: 'Specify build type. Values: pr / nightly / release',
|
|
|
|
defaultValue: 'pr',
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2018-08-14 18:09:52 +00:00
|
|
|
options {
|
2018-11-13 11:58:34 +00:00
|
|
|
timestamps()
|
2018-10-30 09:38:52 +00:00
|
|
|
/* Prevent Jenkins jobs from running forever */
|
2019-01-22 11:34:34 +00:00
|
|
|
timeout(time: 40, unit: 'MINUTES')
|
2018-10-30 09:38:52 +00:00
|
|
|
/* Limit builds retained */
|
2018-08-14 18:09:52 +00:00
|
|
|
buildDiscarder(logRotator(
|
2018-12-13 09:49:16 +00:00
|
|
|
numToKeepStr: '10',
|
|
|
|
daysToKeepStr: '20',
|
|
|
|
artifactNumToKeepStr: '10',
|
2018-08-14 18:09:52 +00:00
|
|
|
))
|
2020-05-11 09:04:11 +00:00
|
|
|
/* Allows combined build to copy */
|
|
|
|
copyArtifactPermission('/status-react/*')
|
2018-08-14 18:09:52 +00:00
|
|
|
}
|
2018-09-25 17:01:48 +00:00
|
|
|
|
2018-09-05 18:17:25 +00:00
|
|
|
/**
|
|
|
|
* WARNING: Jenkins ignores PATH changes in Docker
|
|
|
|
* https://issues.jenkins-ci.org/browse/JENKINS-49076
|
|
|
|
**/
|
2018-08-14 18:09:52 +00:00
|
|
|
environment {
|
2019-05-10 15:33:54 +00:00
|
|
|
LANG = "en_US.UTF-8"
|
|
|
|
LC_ALL = "en_US.UTF-8"
|
|
|
|
LANGUAGE = "en_US.UTF-8"
|
2019-11-29 10:20:08 +00:00
|
|
|
TARGET = 'linux'
|
2019-03-25 16:35:01 +00:00
|
|
|
NIX_CONF_DIR = "${env.WORKSPACE}/nix"
|
2018-12-21 14:17:49 +00:00
|
|
|
VERBOSE_LEVEL = '3'
|
2019-05-10 15:33:54 +00:00
|
|
|
/* We use EXECUTOR_NUMBER to avoid multiple instances clashing */
|
|
|
|
YARN_CACHE_FOLDER = "/var/tmp/yarn-${EXECUTOR_NUMBER}"
|
|
|
|
GRADLE_USER_HOME = "/var/tmp/gradle-${EXECUTOR_NUMBER}"
|
2018-08-14 18:09:52 +00:00
|
|
|
}
|
2018-09-25 17:01:48 +00:00
|
|
|
|
2018-08-14 18:09:52 +00:00
|
|
|
stages {
|
|
|
|
stage('Prep') {
|
|
|
|
steps {
|
2019-01-15 14:44:50 +00:00
|
|
|
script {
|
2020-03-06 15:43:04 +00:00
|
|
|
btype = utils.getBuildType()
|
2019-02-05 09:35:14 +00:00
|
|
|
print "Running ${btype} build!"
|
2020-03-06 15:43:04 +00:00
|
|
|
jenkins.abortPreviousRunningBuilds()
|
2019-01-15 14:44:50 +00:00
|
|
|
/* Cleanup and Prep */
|
2020-03-06 15:43:04 +00:00
|
|
|
commonPrep(btype)
|
2019-01-15 14:44:50 +00:00
|
|
|
}
|
2018-08-14 18:09:52 +00:00
|
|
|
}
|
|
|
|
}
|
2019-10-09 15:37:58 +00:00
|
|
|
stage('Parallel Assemble') {
|
2019-06-07 16:48:54 +00:00
|
|
|
parallel {
|
|
|
|
stage('Checks') { stages {
|
|
|
|
stage('Lint') {
|
|
|
|
steps {
|
2020-03-26 13:37:41 +00:00
|
|
|
script {
|
|
|
|
/* We want the build result to be uploaded */
|
|
|
|
catchError(
|
|
|
|
message: 'Linting check failed!',
|
|
|
|
buildResult: 'FAILURE',
|
|
|
|
stageResult: 'FAILURE'
|
|
|
|
) {
|
2019-09-07 12:57:22 +00:00
|
|
|
sh 'make lint'
|
2020-03-26 13:37:41 +00:00
|
|
|
}
|
|
|
|
}
|
2019-06-07 16:48:54 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
stage('Tests') {
|
|
|
|
steps {
|
2019-09-07 12:57:22 +00:00
|
|
|
script {
|
|
|
|
sh 'make test'
|
|
|
|
}
|
2019-06-07 16:48:54 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
} }
|
|
|
|
stage('Build') { stages {
|
2019-07-23 20:54:17 +00:00
|
|
|
stage('JSBundle') {
|
2019-06-07 16:48:54 +00:00
|
|
|
steps {
|
2019-07-23 20:54:17 +00:00
|
|
|
script { desktop.buildJSBundle() }
|
2019-06-07 16:48:54 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
stage('Compile') {
|
|
|
|
steps {
|
|
|
|
script { desktop.compile() }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
stage('Bundle') {
|
|
|
|
steps {
|
|
|
|
script { app = desktop.bundleLinux(btype) }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} }
|
2018-08-14 18:09:52 +00:00
|
|
|
}
|
|
|
|
}
|
2019-10-09 15:37:58 +00:00
|
|
|
stage('Parallel Upload') {
|
|
|
|
parallel {
|
|
|
|
stage('Archive') {
|
|
|
|
steps {
|
|
|
|
archiveArtifacts app
|
|
|
|
}
|
|
|
|
}
|
|
|
|
stage('Upload') {
|
|
|
|
steps {
|
2020-03-06 15:43:04 +00:00
|
|
|
script { env.PKG_URL = s3.uploadArtifact(app) }
|
2019-10-09 15:37:58 +00:00
|
|
|
}
|
|
|
|
}
|
2018-12-11 14:27:21 +00:00
|
|
|
}
|
2018-08-14 18:09:52 +00:00
|
|
|
}
|
2018-12-13 09:49:16 +00:00
|
|
|
stage('Cleanup') {
|
|
|
|
steps {
|
2019-06-11 09:43:44 +00:00
|
|
|
sh 'make watchman-clean'
|
2019-02-05 09:35:14 +00:00
|
|
|
sh 'make clean'
|
2018-12-13 09:49:16 +00:00
|
|
|
}
|
|
|
|
}
|
2018-12-11 14:27:21 +00:00
|
|
|
}
|
|
|
|
post {
|
2020-03-06 15:43:04 +00:00
|
|
|
success { script { github.notifyPR(true) } }
|
|
|
|
failure { script { github.notifyPR(false) } }
|
2018-08-14 18:09:52 +00:00
|
|
|
}
|
|
|
|
}
|