Skip to content

Commit c340193

Browse files
committed
ci: init iOS build pipeline
- update `status-desktop/mobile/scripts/EnvVariables.mk` to use `$QMAKE` instead of `qmake`. - add `QMAKE` env var in `ci/jenkinsfile.android` - add `ci/Jenkinsfile.ios` pipeline job to build the app and provide the artifact as part of Github PR. - update the bundle id for mobile app to `im.status.app`
1 parent 8724976 commit c340193

File tree

5 files changed

+153
-10
lines changed

5 files changed

+153
-10
lines changed

ci/Jenkinsfile.android

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,15 @@ pipeline {
5050
GOCACHE = "${env.WORKSPACE_TMP}/go-cache"
5151
GOMODCACHE = "${env.WORKSPACE_TMP}/go-mod-cache"
5252
GOTMPDIR = "${env.WORKSPACE_TMP}"
53-
STATUS_APK_ARTIFACT = "pkg/Status-tablet-${BUILD_NUMBER}.apk"
53+
/* sets App Version in Settings */
54+
VERSION = sh(script: "./scripts/version.sh", returnStdout: true).trim()
55+
/* Control output the filename */
56+
APP_TYPE = "${utils.getAppType()}"
57+
STATUS_APK_ARTIFACT = "pkg/${utils.pkgFilename(ext: 'apk', arch: 'arm64', version: env.VERSION, type: env.APP_TYPE)}"
5458
PLATFORM = "android/arm64"
55-
QT_ANDROID_PATH = "/opt/qt/6.9.2/android_arm64_v8a"
59+
QT_VERSION = "6.9.2"
60+
QT_ANDROID_PATH = "/opt/qt/${env.QT_VERSION}/android_arm64_v8a"
61+
QMAKE = "/opt/qt/${env.QT_VERSION}/android_arm64_v8a/bin/qmake"
5662
STATUS_APK = "${WORKSPACE}/mobile/bin/android/qt6/Status-tablet.apk"
5763
}
5864

ci/Jenkinsfile.ios

Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
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+
10+
agent { label 'macos && arm64 && nix-2.24 && xcode-16.2' }
11+
12+
parameters {
13+
booleanParam(
14+
name: 'RELEASE',
15+
description: 'Decides whether release credentials are used.',
16+
defaultValue: params.RELEASE ?: false
17+
)
18+
choice(
19+
name: 'VERBOSE',
20+
description: 'Level of verbosity based on nimbus-build-system setup.',
21+
choices: ['0','1','2','3']
22+
)
23+
}
24+
25+
options {
26+
timestamps()
27+
/* Prevent Jenkins jobs from running forever */
28+
timeout(time: 45, unit: 'MINUTES')
29+
/* manage how many builds we keep */
30+
buildDiscarder(logRotator(
31+
numToKeepStr: '10',
32+
daysToKeepStr: '30',
33+
artifactNumToKeepStr: '3',
34+
))
35+
/* Allows combined build to copy */
36+
copyArtifactPermission('/status-desktop/*')
37+
/* Abort old PR builds. */
38+
disableConcurrentBuilds(abortPrevious: isPRBuild)
39+
disableRestartFromStage()
40+
}
41+
42+
environment {
43+
GOCACHE = "${env.WORKSPACE_TMP}/go-cache"
44+
GOMODCACHE = "${env.WORKSPACE_TMP}/go-mod-cache"
45+
GOTMPDIR = "${env.WORKSPACE_TMP}"
46+
PLATFORM = "ios/${getArch()}"
47+
/* Improve make performance */
48+
MAKEFLAGS = "-j4 V=${params.VERBOSE}"
49+
QT_VERSION="6.9.2"
50+
QMAKE = "/Users/admin/${QT_VERSION}/ios/bin/qmake"
51+
QT_HOST_PATH = "/Users/admin/${QT_VERSION}/macos"
52+
/* QMAKE = sh(script: "which qmake", returnStdout: true).trim() */
53+
QTDIR = sh(script:"${env.QMAKE} -query QT_INSTALL_PREFIX", returnStdout: true).trim()
54+
/* Enforce Go version installed infra-role-golang. */
55+
/* to fix missing rcc, since QT6 rcc is located at ${QTDIR}/libexec/rcc */
56+
PATH = "${env.QTDIR}/bin:${env.QTDIR}/libexec:${env.HOME}/go/bin:/usr/local/go/bin:${env.PATH}"
57+
/* prevent sharing cache dir across different jobs */
58+
GO_GENERATE_FAST_DIR = "${env.WORKSPACE_TMP}/go-generate-fast"
59+
XDG_CACHE_HOME = "${env.WORKSPACE_TMP}/.cache"
60+
/* sets App Version in Settings */
61+
VERSION = sh(script: "./scripts/version.sh", returnStdout: true).trim()
62+
/* Control output the filename */
63+
APP_TYPE = "${utils.getAppType()}"
64+
/* iOS build configuration */
65+
IPHONE_SDK = "iphoneos"
66+
ARCH = "x86_64"
67+
/* iOS app paths */
68+
STATUS_IOS_APP_ARTIFACT = "pkg/${utils.pkgFilename(ext: 'app.zip', arch: getArch(), version: env.VERSION, type: env.APP_TYPE)}"
69+
STATUS_IOS_APP = "${WORKSPACE}/mobile/bin/ios/qt6/Status-tablet.app"
70+
}
71+
72+
stages {
73+
74+
stage('Fetch submodules') {
75+
steps {
76+
sh 'git submodule update --init --recursive'
77+
}
78+
}
79+
80+
stage('status-go') {
81+
steps {
82+
sh 'make status-go'
83+
}
84+
}
85+
86+
stage('Build iOS App') {
87+
steps {
88+
sh 'make mobile-build'
89+
}
90+
}
91+
92+
stage('Package iOS App') {
93+
steps {
94+
sh 'mkdir -p pkg'
95+
sh "cd mobile/bin/ios/qt6 && zip -r ${env.WORKSPACE}/${env.STATUS_IOS_APP_ARTIFACT} Status-tablet.app"
96+
sh "ls -la ${env.STATUS_IOS_APP_ARTIFACT}"
97+
}
98+
}
99+
100+
stage('Parallel Upload') {
101+
parallel {
102+
stage('Upload') {
103+
steps {
104+
script {
105+
env.PKG_URL = s5cmd.upload(env.STATUS_IOS_APP_ARTIFACT)
106+
jenkins.setBuildDesc(APP: env.PKG_URL)
107+
}
108+
}
109+
}
110+
stage('Archive') {
111+
steps {
112+
archiveArtifacts env.STATUS_IOS_APP_ARTIFACT
113+
}
114+
}
115+
}
116+
}
117+
}
118+
119+
post {
120+
success { script { github.notifyPR(true) } }
121+
failure { script { github.notifyPR(false) } }
122+
cleanup { sh './scripts/clean-git.sh' }
123+
}
124+
}
125+
126+
def getArch() {
127+
def tokens = Thread.currentThread().getName().split('/')
128+
for (def arch in ['x86_64', 'aarch64']) {
129+
if (tokens.contains(arch)) { return arch }
130+
}
131+
}
132+
133+
/* We extract the name of the job from currentThread because
134+
* before an agent is picked env is not available. */
135+
def getJobPathTokens() {
136+
return Thread.currentThread().getName().split('/')
137+
}

mobile/scripts/EnvVariables.mk

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#OS: ios, android
2-
QSPEC:=$(shell qmake -query QMAKE_XSPEC)
2+
QSPEC:=$(shell $(QMAKE) -query QMAKE_XSPEC)
33
ifeq ($(QSPEC),macx-ios-clang)
44
OS:=ios
55
else ifeq ($(QSPEC),macx-clang)
@@ -18,8 +18,8 @@ HOST_OS=$(shell uname -s | tr '[:upper:]' '[:lower:]')
1818
#Architectures: arm64, arm, x86_64. x86_64 is default for simulator
1919
ARCH?=$(shell uname -m)
2020
# Detect Qt version from qmake
21-
QT_MAJOR?=$(shell qmake -query QT_VERSION | head -c 1 2>/dev/null)
22-
QT_DIR?=$(shell qmake -query QT_INSTALL_PREFIX)
21+
QT_MAJOR?=$(shell $(QMAKE) -query QT_VERSION | head -c 1 2>/dev/null)
22+
QT_DIR?=$(shell $(QMAKE) -query QT_INSTALL_PREFIX)
2323
MAKEFILE_DIR := $(realpath $(dir $(lastword $(MAKEFILE_LIST))))
2424

2525
ifneq ($(QT_MAJOR),6)
@@ -95,13 +95,13 @@ endif
9595

9696

9797
# Verify tools are installed
98-
QMAKE := $(shell which qmake)
98+
QMAKE ?= $(shell which qmake)
9999
ifeq ($(QMAKE),)
100100
$(error qmake not found)
101101
endif
102102
$(info QMAKE: $(QMAKE))
103103

104-
RCC := $(shell qmake -query QT_HOST_LIBEXECS)/rcc
104+
RCC := $(shell $(QMAKE) -query QT_HOST_LIBEXECS)/rcc
105105
ifeq ($(RCC),)
106106
$(error rcc not found)
107107
endif

mobile/scripts/buildApp.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ else
4646
QMAKE_BIN="${QMAKE:-qmake}"
4747
"$QMAKE_BIN" "$CWD/../wrapperApp/Status-tablet.pro" -spec macx-ios-clang CONFIG+=release CONFIG+="$SDK" CONFIG+=device -after
4848
# Compile resources
49-
xcodebuild -configuration Release -target "Qt Preprocess" -sdk "$SDK" -arch "$ARCH" CODE_SIGN_STYLE=Automatic | xcbeautify
49+
xcodebuild -configuration Release -target "Qt Preprocess" -sdk "$SDK" -arch "$ARCH" CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO | xcbeautify
5050
# Compile the app
51-
xcodebuild -configuration Release -target Status-tablet install -sdk "$SDK" -arch "$ARCH" DSTROOT="$BIN_DIR" INSTALL_PATH="/" TARGET_BUILD_DIR="$BIN_DIR" CODE_SIGN_STYLE=Automatic QMAKE_BUNDLE_SUFFIX=$(id -un) -allowProvisioningUpdates | xcbeautify
51+
xcodebuild -configuration Release -target Status-tablet install -sdk "$SDK" -arch "$ARCH" DSTROOT="$BIN_DIR" INSTALL_PATH="/" TARGET_BUILD_DIR="$BIN_DIR" CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO | xcbeautify
5252

5353
if [[ -e "$BIN_DIR/Status-tablet.app/Info.plist" ]]; then
5454
echo "Build succeeded"

mobile/wrapperApp/Status-tablet.pro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ ios {
4242
QMAKE_INFO_PLIST = $$PWD/../ios/Info.plist
4343
QMAKE_IOS_DEPLOYMENT_TARGET=16.0
4444
QMAKE_TARGET_BUNDLE_PREFIX = im.status
45-
QMAKE_BUNDLE = status$${QMAKE_BUNDLE_SUFFIX}
45+
QMAKE_BUNDLE = app
4646
QMAKE_ASSET_CATALOGS += $$PWD/../ios/Images.xcassets
4747

4848
LIBS += -L$$PWD/../lib/$$LIB_PREFIX -lnim_status_client -lDOtherSideStatic -lstatusq -lstatus -lssl_3 -lcrypto_3 -lqzxing -lresolv -lqrcodegen

0 commit comments

Comments
 (0)