Skip to content

Commit 682aca6

Browse files
committed
ci: job to build QT6 Image and android APK
- https://ci.status.im/job/status-desktop/job/systems/job/QT/ is set up to build our own QT6 Image from source. Running this would be a manual job and we would only need to do this when we'd have to change the version of QT. - https://ci.status.im/job/status-desktop/job/prs/job/android/job/arm64/job/package/ is set up to build Android APK for each PR. fixes: #18468
1 parent df4c233 commit 682aca6

File tree

6 files changed

+911
-55
lines changed

6 files changed

+911
-55
lines changed

ci/Jenkinsfile.android

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
#!/usr/bin/env groovy
2+
3+
4+
/* Options section can't access functions in objects. */
5+
def isPRBuild = utils.isPRBuild()
6+
def isNightlyBuild = utils.isNightlyBuild()
7+
8+
pipeline {
9+
agent {
10+
/* Image with Ubuntu 22.04, QT 6.9.0, Android SDK/NDK, Go, and Nim */
11+
docker {
12+
label 'linux'
13+
image 'statusteam/nim-status-client-build:1.0.3-qt6.9.0-android'
14+
alwaysPull true
15+
}
16+
}
17+
18+
parameters {
19+
booleanParam(
20+
name: 'RELEASE',
21+
description: 'Decides whether release credentials are used.',
22+
defaultValue: params.RELEASE ?: false
23+
)
24+
}
25+
26+
options {
27+
timestamps()
28+
/* Prevent Jenkins jobs from running forever */
29+
timeout(time: 45, unit: 'MINUTES')
30+
/* manage how many builds we keep */
31+
buildDiscarder(logRotator(
32+
numToKeepStr: '10',
33+
daysToKeepStr: '30',
34+
artifactNumToKeepStr: '3',
35+
))
36+
/* Allows combined build to copy */
37+
copyArtifactPermission('/status-desktop/*')
38+
/* Abort old PR builds. */
39+
disableConcurrentBuilds(abortPrevious: isPRBuild)
40+
disableRestartFromStage()
41+
}
42+
43+
environment {
44+
USE_SYSTEM_NIM = "1"
45+
GOCACHE = "${env.WORKSPACE_TMP}/go-cache"
46+
GOMODCACHE = "${env.WORKSPACE_TMP}/go-mod-cache"
47+
GOTMPDIR = "${env.WORKSPACE_TMP}"
48+
STATUS_APK_ARTIFACT = "pkg/Status-tablet-${BUILD_NUMBER}.apk"
49+
PLATFORM = "android/arm64"
50+
QT_ANDROID_PATH = "/opt/qt/6.9.0/android_arm64_v8a"
51+
STATUS_APK = "${WORKSPACE}/mobile/bin/android/qt6/default/Status-tablet.apk"
52+
}
53+
54+
stages {
55+
56+
stage('Build Android APK') {
57+
steps {
58+
sh """
59+
make mobile-clean
60+
make -j${utils.getProcCount()} mobile-build V=3 USE_SYSTEM_NIM=1
61+
"""
62+
}
63+
}
64+
65+
stage('Package APK') {
66+
steps {
67+
sh """
68+
mkdir -p pkg
69+
cp '${env.STATUS_APK}' '${env.STATUS_APK_ARTIFACT}'
70+
ls -la '${env.STATUS_APK_ARTIFACT}'
71+
"""
72+
}
73+
}
74+
75+
stage('Parallel Upload') {
76+
parallel {
77+
stage('Upload') {
78+
steps {
79+
script {
80+
env.PKG_URL = s5cmd.upload(env.STATUS_APK_ARTIFACT)
81+
jenkins.setBuildDesc(APK: env.PKG_URL)
82+
}
83+
}
84+
}
85+
stage('Archive') {
86+
steps {
87+
archiveArtifacts env.STATUS_APK_ARTIFACT
88+
}
89+
}
90+
}
91+
}
92+
}
93+
94+
post {
95+
success { script { github.notifyPR(true) } }
96+
failure { script { github.notifyPR(false) } }
97+
cleanup { sh './scripts/clean-git.sh' }
98+
}
99+
}
100+

ci/Jenkinsfile.qt-build

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
#!/usr/bin/env groovy
2+
3+
4+
pipeline {
5+
agent {
6+
label 'linux && x86_64 && qt-builder'
7+
}
8+
9+
options {
10+
buildDiscarder(logRotator(numToKeepStr: '20'))
11+
timestamps()
12+
timeout(time: 12, unit: 'HOURS')
13+
}
14+
15+
parameters {
16+
string(
17+
name: 'QT_VERSION',
18+
defaultValue: '6.9.0',
19+
description: 'Qt version to build'
20+
)
21+
string(
22+
name: 'DOCKER_TAG',
23+
defaultValue: '1.0.3-qt6.9.0-android',
24+
description: 'Docker image tag for the final image'
25+
)
26+
booleanParam(
27+
name: 'PUSH_TO_DOCKERHUB',
28+
defaultValue: true,
29+
description: 'Push the final image to DockerHub'
30+
)
31+
}
32+
33+
environment {
34+
DOCKER_REGISTRY = 'statusteam'
35+
DOCKER_IMAGE_BASE = 'nim-status-client-build'
36+
MOBILE_BUILD_DIR = "${WORKSPACE}/mobile/docker"
37+
}
38+
39+
stages {
40+
stage('Build Docker Images') {
41+
steps {
42+
script {
43+
dir("${MOBILE_BUILD_DIR}") {
44+
45+
def image = docker.build(
46+
"${DOCKER_REGISTRY}/${DOCKER_IMAGE_BASE}:${params.DOCKER_TAG}",
47+
"--build-arg QTVER=${params.QT_VERSION} " +
48+
"--build-arg TARGETARCH=amd64 " +
49+
"--build-arg JAVA_VERSION=17 " +
50+
"--build-arg ANDROID_API_LEVEL=35 " +
51+
"--build-arg ANDROID_NDK_VERSION=27.2.12479018 " +
52+
"--build-arg GOLANG_VERSION=1.23.10 " +
53+
"--build-arg NIM_VERSION=2.0.12 " +
54+
"--build-arg NIX_VERSION=2.24.11 " +
55+
"--target mobile-build ."
56+
)
57+
58+
env.BUILT_IMAGE = "${DOCKER_REGISTRY}/${DOCKER_IMAGE_BASE}:${params.DOCKER_TAG}"
59+
}
60+
}
61+
}
62+
}
63+
64+
stage('Test Images') {
65+
parallel {
66+
stage('Test Mobile Build Image') {
67+
steps {
68+
script {
69+
def testImage = "${DOCKER_REGISTRY}/${DOCKER_IMAGE_BASE}:${params.DOCKER_TAG}"
70+
docker.image(testImage).inside('--entrypoint=""') {
71+
sh "qmake --version"
72+
sh "nim --version"
73+
sh "go version"
74+
sh "protoc --version"
75+
sh "java -version"
76+
sh "ls -la /opt/qt/${params.QT_VERSION}/"
77+
}
78+
}
79+
}
80+
}
81+
82+
}
83+
}
84+
85+
stage('Push to DockerHub') {
86+
when {
87+
expression { params.PUSH_TO_DOCKERHUB == true }
88+
}
89+
steps {
90+
script {
91+
def image = docker.image(env.BUILT_IMAGE)
92+
image.push()
93+
}
94+
}
95+
}
96+
}
97+
98+
post {
99+
always { cleanWs() }
100+
success { script { github.notifyPR(true) } }
101+
failure { script { github.notifyPR(false) } }
102+
}
103+
}

0 commit comments

Comments
 (0)