2023-06-29 13:40:43 +00:00
|
|
|
#!/usr/bin/env groovy
|
2023-09-28 18:03:15 +00:00
|
|
|
library 'status-jenkins-lib@v1.7.15'
|
2020-03-06 15:43:04 +00:00
|
|
|
|
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
|
|
|
|
2021-06-24 12:02:20 +00:00
|
|
|
parameters {
|
|
|
|
string(
|
|
|
|
name: 'NIX_CACHE_HOST',
|
|
|
|
description: 'FQDN of Nix binary cache host.',
|
|
|
|
defaultValue: params.NIX_CACHE_HOST ?: 'cache-01.do-ams3.nix.ci.statusim.net'
|
|
|
|
)
|
|
|
|
string(
|
|
|
|
name: 'NIX_CACHE_USER',
|
|
|
|
description: 'Username for Nix binary cache host.',
|
|
|
|
defaultValue: params.NIX_CACHE_USER ?: 'nix-cache'
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
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 */
|
2021-06-24 12:02:20 +00:00
|
|
|
NIX_SSHOPTS = "-o StrictHostKeyChecking=no source .profile;"
|
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 */
|
2023-06-15 07:39:28 +00:00
|
|
|
timeout(time: 120, unit: 'MINUTES')
|
2019-02-28 10:56:58 +00:00
|
|
|
/* Limit builds retained */
|
|
|
|
buildDiscarder(logRotator(
|
|
|
|
numToKeepStr: '20',
|
|
|
|
daysToKeepStr: '30',
|
|
|
|
))
|
|
|
|
}
|
|
|
|
|
|
|
|
stages {
|
|
|
|
stage('Setup') {
|
2019-07-15 16:34:33 +00:00
|
|
|
steps { script {
|
2021-04-12 14:07:55 +00:00
|
|
|
nix.shell('nix-env -i openssh', sandbox: false, pure: false)
|
2019-11-29 10:20:08 +00:00
|
|
|
/* some build targets don't build on MacOS */
|
2023-06-15 07:39:28 +00:00
|
|
|
os = sh(script: 'uname', returnStdout: true)
|
|
|
|
arch = sh(script: 'arch', returnStdout: true)
|
2019-07-15 16:34:33 +00:00
|
|
|
} }
|
2019-02-28 10:56:58 +00:00
|
|
|
}
|
2019-07-22 03:31:47 +00:00
|
|
|
stage('Build status-go') {
|
|
|
|
steps { script {
|
2023-06-15 07:39:28 +00:00
|
|
|
def platforms = ['mobile.android', 'mobile.ios', 'library']
|
|
|
|
if (os != 'Darwin') { platforms.removeAll { it == 'mobile.ios' } }
|
|
|
|
/* FIXME: Remove this when #16237 is merged. */
|
|
|
|
if (arch == 'arm64') { platforms.removeAll { it == 'mobile.android' } }
|
2019-11-29 10:20:08 +00:00
|
|
|
platforms.each { os ->
|
2019-07-15 16:34:33 +00:00
|
|
|
nix.build(
|
2023-06-15 07:39:28 +00:00
|
|
|
attr: "targets.status-go.${os}",
|
2020-02-29 10:40:11 +00:00
|
|
|
sandbox: false,
|
2019-07-15 16:34:33 +00:00
|
|
|
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 {
|
2023-05-30 15:05:10 +00:00
|
|
|
/* Build/fetch deps required for jsbundle build. */
|
2019-07-15 16:34:33 +00:00
|
|
|
nix.build(
|
2023-05-30 15:05:10 +00:00
|
|
|
attr: 'targets.mobile.jsbundle',
|
2020-02-29 10:40:11 +00:00
|
|
|
sandbox: false,
|
2019-07-15 16:34:33 +00:00
|
|
|
pure: false,
|
|
|
|
link: false
|
|
|
|
)
|
|
|
|
} }
|
|
|
|
}
|
|
|
|
stage('Build android deps') {
|
|
|
|
steps { script {
|
2023-05-30 15:05:10 +00:00
|
|
|
/* Build/fetch deps required to build android release. */
|
2019-07-15 16:34:33 +00:00
|
|
|
nix.build(
|
2020-05-16 13:02:28 +00:00
|
|
|
attr: 'targets.mobile.android.release.buildInputs',
|
2020-02-29 10:40:11 +00:00
|
|
|
sandbox: false,
|
2019-07-15 16:34:33 +00:00
|
|
|
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 {
|
2023-06-15 07:39:28 +00:00
|
|
|
def shells = ['android', 'ios', 'fastlane', 'keytool', 'clojure', 'gradle']
|
|
|
|
if (os != "Darwin") { shells.removeAll { it == 'ios' } }
|
2023-05-30 15:05:10 +00:00
|
|
|
/* Build/fetch deps required to start default Nix shell. */
|
2023-06-15 07:39:28 +00:00
|
|
|
shells.each { shell ->
|
|
|
|
nix.build(
|
|
|
|
attr: "shells.${shell}.buildInputs",
|
|
|
|
sandbox: false,
|
|
|
|
link: false
|
|
|
|
)
|
|
|
|
}
|
2019-07-15 16:34:33 +00:00
|
|
|
} }
|
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 \
|
2022-07-17 12:37:46 +00:00
|
|
|
-not -name '*.links' -and -not -name '*-status-mobile-*' \
|
2022-05-07 09:16:20 +00:00
|
|
|
| xargs nix copy \
|
|
|
|
--to ssh-ng://${params.NIX_CACHE_USER}@${params.NIX_CACHE_HOST}
|
2019-07-15 16:34:33 +00:00
|
|
|
""",
|
|
|
|
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)
|
2019-11-29 10:20:08 +00:00
|
|
|
nix.shell('nix/scripts/clean.sh', pure: false)
|
2019-07-15 16:34:33 +00:00
|
|
|
} }
|
2019-06-04 16:50:29 +00:00
|
|
|
}
|
2019-02-28 10:56:58 +00:00
|
|
|
}
|