2019-02-28 10:56:58 +00:00
|
|
|
pipeline {
|
2019-04-18 12:39:40 +00:00
|
|
|
agent { label params.AGENT_LABEL }
|
2019-02-28 10:56:58 +00:00
|
|
|
|
|
|
|
environment {
|
2019-11-26 13:21:10 +00:00
|
|
|
/* See nix/README.md */
|
|
|
|
NIX_IGNORE_SYMLINK_STORE = 1
|
2019-02-28 10:56:58 +00:00
|
|
|
/* we source .bash_profile to be able to use nix-store */
|
2019-04-02 20:27:01 +00:00
|
|
|
NIX_SSHOPTS = "-o StrictHostKeyChecking=no source .bash_profile;"
|
2019-02-28 10:56:58 +00:00
|
|
|
/* where our /nix/store is hosted */
|
|
|
|
NIX_CACHE_USER = 'nix-cache'
|
|
|
|
NIX_CACHE_HOST = 'master-01.do-ams3.ci.misc.statusim.net'
|
2019-04-03 11:06:42 +00:00
|
|
|
NIX_CONF_DIR = "${env.WORKSPACE}/nix"
|
2019-02-28 10:56:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
options {
|
|
|
|
timestamps()
|
|
|
|
disableConcurrentBuilds()
|
|
|
|
/* Prevent Jenkins jobs from running forever */
|
2019-04-02 20:27:01 +00:00
|
|
|
timeout(time: 300, unit: 'MINUTES')
|
2019-02-28 10:56:58 +00:00
|
|
|
/* Limit builds retained */
|
|
|
|
buildDiscarder(logRotator(
|
|
|
|
numToKeepStr: '20',
|
|
|
|
daysToKeepStr: '30',
|
|
|
|
))
|
|
|
|
}
|
|
|
|
|
|
|
|
stages {
|
2019-07-15 16:34:33 +00:00
|
|
|
stage('Prep') {
|
|
|
|
steps { script {
|
|
|
|
nix = load('ci/nix.groovy')
|
|
|
|
} }
|
|
|
|
}
|
2019-02-28 10:56:58 +00:00
|
|
|
stage('Setup') {
|
2019-07-15 16:34:33 +00:00
|
|
|
steps { script {
|
2019-04-09 19:02:39 +00:00
|
|
|
sh 'scripts/setup'
|
2019-07-15 16:34:33 +00:00
|
|
|
nix.shell('nix-env -i openssh', pure: false)
|
|
|
|
} }
|
2019-02-28 10:56:58 +00:00
|
|
|
}
|
2019-07-22 03:31:47 +00:00
|
|
|
stage('Build status-go') {
|
|
|
|
steps { script {
|
|
|
|
['android', 'desktop', 'ios'].each { os ->
|
2019-07-15 16:34:33 +00:00
|
|
|
nix.build(
|
|
|
|
attr: "targets.status-go.${os}.buildInputs",
|
|
|
|
args: ['target-os': 'all'],
|
|
|
|
link: false
|
|
|
|
)
|
2019-07-22 03:31:47 +00:00
|
|
|
}
|
|
|
|
} }
|
|
|
|
}
|
2019-07-26 14:51:06 +00:00
|
|
|
stage('Build android jsbundle') {
|
2019-07-15 16:34:33 +00:00
|
|
|
steps { script {
|
|
|
|
/* build/fetch things required to produce a js-bundle for android
|
|
|
|
* (e.g. maven and node repos) */
|
|
|
|
nix.build(
|
|
|
|
attr: 'targets.mobile.jsbundle',
|
|
|
|
args: ['target-os': 'android'],
|
|
|
|
pure: false,
|
|
|
|
link: false
|
|
|
|
)
|
|
|
|
} }
|
|
|
|
}
|
|
|
|
stage('Build android deps') {
|
|
|
|
steps { script {
|
|
|
|
/* build/fetch things required to build jsbundle and android */
|
|
|
|
nix.build(
|
|
|
|
attr: 'targets.mobile.android.buildInputs',
|
|
|
|
args: ['target-os': 'android'],
|
|
|
|
pure: false,
|
|
|
|
link: false
|
|
|
|
)
|
|
|
|
} }
|
2019-06-04 16:50:29 +00:00
|
|
|
}
|
|
|
|
stage('Build nix shell deps') {
|
2019-07-15 16:34:33 +00:00
|
|
|
steps { script {
|
|
|
|
/* build/fetch things required to instantiate shell.nix for TARGET_OS=all */
|
|
|
|
nix.build(
|
|
|
|
attr: 'shell',
|
|
|
|
args: ['target-os': 'all'],
|
|
|
|
link: false
|
|
|
|
)
|
|
|
|
} }
|
2019-02-28 10:56:58 +00:00
|
|
|
}
|
|
|
|
stage('Upload') {
|
2019-07-15 16:34:33 +00:00
|
|
|
steps { script {
|
2019-02-28 10:56:58 +00:00
|
|
|
sshagent(credentials: ['nix-cache-ssh']) {
|
2019-07-15 16:34:33 +00:00
|
|
|
nix.shell("""
|
2019-07-26 14:51:06 +00:00
|
|
|
find /nix/store/ -mindepth 1 -maxdepth 1 -type d \
|
|
|
|
-not -name '*.links' -and -not -name '*-status-react-*' \
|
2019-07-15 16:34:33 +00:00
|
|
|
| xargs nix-copy-closure -v --to ${NIX_CACHE_USER}@${NIX_CACHE_HOST}
|
|
|
|
""",
|
|
|
|
pure: false
|
|
|
|
)
|
2019-02-28 10:56:58 +00:00
|
|
|
}
|
2019-07-15 16:34:33 +00:00
|
|
|
} }
|
2019-02-28 10:56:58 +00:00
|
|
|
}
|
|
|
|
}
|
2019-06-04 16:50:29 +00:00
|
|
|
post {
|
2019-07-15 16:34:33 +00:00
|
|
|
always { script {
|
|
|
|
nix.shell('nix-store --optimize', pure: false)
|
|
|
|
nix.shell('nix/clean.sh', pure: false)
|
|
|
|
} }
|
2019-06-04 16:50:29 +00:00
|
|
|
}
|
2019-02-28 10:56:58 +00:00
|
|
|
}
|