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 {
|
|
|
|
/* 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 {
|
|
|
|
stage('Setup') {
|
|
|
|
steps {
|
2019-04-09 19:02:39 +00:00
|
|
|
sh 'scripts/setup'
|
2019-06-04 16:50:29 +00:00
|
|
|
sh '''
|
2019-02-28 10:56:58 +00:00
|
|
|
. ~/.nix-profile/etc/profile.d/nix.sh && \
|
|
|
|
nix-env -i openssh
|
2019-06-04 16:50:29 +00:00
|
|
|
'''
|
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 ->
|
|
|
|
sh """
|
|
|
|
. ~/.nix-profile/etc/profile.d/nix.sh && \
|
|
|
|
nix-build --argstr target-os all -A targets.status-go.${os}.buildInputs
|
|
|
|
"""
|
|
|
|
}
|
|
|
|
} }
|
|
|
|
}
|
2019-07-23 20:54:17 +00:00
|
|
|
stage('Build jsbundle-android') {
|
2019-02-28 10:56:58 +00:00
|
|
|
steps {
|
2019-07-23 20:54:17 +00:00
|
|
|
// Run a Nix build to build/fetch everything that is necessary to produce a jsbundle for TARGET_OS=android (e.g. maven and node repos)
|
2019-06-04 16:50:29 +00:00
|
|
|
sh '''
|
2019-07-23 20:54:17 +00:00
|
|
|
args="--argstr target-os android --show-trace -A targets.mobile.jsbundle"
|
2019-06-04 16:50:29 +00:00
|
|
|
|
2019-02-28 10:56:58 +00:00
|
|
|
. ~/.nix-profile/etc/profile.d/nix.sh && \
|
2019-06-04 16:50:29 +00:00
|
|
|
nix-build --pure --no-out-link $args
|
|
|
|
|
|
|
|
prodBuildDrv=$(nix-instantiate --quiet $args) && \
|
|
|
|
prodBuildSrcPath=$(nix-store -q --binding src $prodBuildDrv) && \
|
|
|
|
prodBuildOutPath=$(nix-store -q --outputs $prodBuildDrv) && \
|
|
|
|
nix-store --delete $prodBuildDrv $prodBuildSrcPath $prodBuildOutPath
|
|
|
|
'''
|
|
|
|
}
|
|
|
|
}
|
|
|
|
stage('Build nix shell deps') {
|
|
|
|
steps {
|
|
|
|
// Run a Nix build to build/fetch everything that is necessary to instantiate shell.nix for TARGET_OS=all
|
|
|
|
sh '''
|
|
|
|
. ~/.nix-profile/etc/profile.d/nix.sh && \
|
2019-07-22 03:31:47 +00:00
|
|
|
nix-shell --argstr target-os all --pure --show-trace shell.nix
|
2019-06-04 16:50:29 +00:00
|
|
|
'''
|
2019-02-28 10:56:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
stage('Upload') {
|
|
|
|
steps {
|
|
|
|
sshagent(credentials: ['nix-cache-ssh']) {
|
|
|
|
sh """
|
|
|
|
. ~/.nix-profile/etc/profile.d/nix.sh && \
|
2019-06-04 16:50:29 +00:00
|
|
|
find /nix/store/ -mindepth 1 -maxdepth 1 \
|
|
|
|
-not -name '.links' -and -not -name '*.lock' \
|
2019-07-23 20:54:17 +00:00
|
|
|
-and -not -name '*-status-react-jsbundle-source' \
|
2019-06-04 16:50:29 +00:00
|
|
|
-and -not -name '*-status-react-release-android-source' \
|
2019-07-23 20:54:17 +00:00
|
|
|
-and -not -name '*-jsbundle-*' \
|
2019-06-04 16:50:29 +00:00
|
|
|
-and -not -name '*-release-android' | \
|
2019-02-28 10:56:58 +00:00
|
|
|
xargs nix-copy-closure -v --to ${NIX_CACHE_USER}@${NIX_CACHE_HOST}
|
|
|
|
"""
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-06-04 16:50:29 +00:00
|
|
|
post {
|
|
|
|
always {
|
|
|
|
sh '''
|
|
|
|
. ~/.nix-profile/etc/profile.d/nix.sh && \
|
|
|
|
nix-store --optimize
|
|
|
|
'''
|
|
|
|
}
|
|
|
|
}
|
2019-02-28 10:56:58 +00:00
|
|
|
}
|